Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147828
b: refs/heads/master
c: 5a3e5cb
h: refs/heads/master
v: v3
  • Loading branch information
Jan Kara authored and Al Viro committed Jun 12, 2009
1 parent add5039 commit 5e39505
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 876a9f76abbcb775f8d21cbc99fa161f9e5937f1
refs/heads/master: 5a3e5cb8e08bd876e2542c1451c9a93dab1b0e39
9 changes: 9 additions & 0 deletions trunk/fs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,12 @@ extern void chroot_fs_refs(struct path *, struct path *);
* file_table.c
*/
extern void mark_files_ro(struct super_block *);

/*
* super.c
*/
#ifdef CONFIG_BLOCK
extern void sync_blockdevs(void);
#else
static inline void sync_blockdevs(void) { }
#endif
29 changes: 28 additions & 1 deletion trunk/fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,14 @@ void __fsync_super(struct super_block *sb)
{
sync_inodes_sb(sb, 0);
vfs_dq_sync(sb);
sync_inodes_sb(sb, 1);
lock_super(sb);
if (sb->s_dirt && sb->s_op->write_super)
sb->s_op->write_super(sb);
unlock_super(sb);
if (sb->s_op->sync_fs)
sb->s_op->sync_fs(sb, 1);
sync_blockdev(sb->s_bdev);
sync_inodes_sb(sb, 1);
}

/*
Expand Down Expand Up @@ -522,6 +522,33 @@ void sync_filesystems(int wait)
mutex_unlock(&mutex);
}

#ifdef CONFIG_BLOCK
/*
* Sync all block devices underlying some superblock
*/
void sync_blockdevs(void)
{
struct super_block *sb;

spin_lock(&sb_lock);
restart:
list_for_each_entry(sb, &super_blocks, s_list) {
if (!sb->s_bdev)
continue;
sb->s_count++;
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
if (sb->s_root)
sync_blockdev(sb->s_bdev);
up_read(&sb->s_umount);
spin_lock(&sb_lock);
if (__put_super_and_need_restart(sb))
goto restart;
}
spin_unlock(&sb_lock);
}
#endif

/**
* get_super - get the superblock of a device
* @bdev: device to get the superblock for
Expand Down
4 changes: 3 additions & 1 deletion trunk/fs/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/pagemap.h>
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
#include "internal.h"

#define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \
SYNC_FILE_RANGE_WAIT_AFTER)
Expand All @@ -26,10 +27,11 @@ static void do_sync(unsigned long wait)
wakeup_pdflush(0);
sync_inodes(0); /* All mappings, inodes and their blockdevs */
vfs_dq_sync(NULL);
sync_inodes(wait); /* Mappings, inodes and blockdevs, again. */
sync_supers(); /* Write the superblocks */
sync_filesystems(0); /* Start syncing the filesystems */
sync_filesystems(wait); /* Waitingly sync the filesystems */
sync_inodes(wait); /* Mappings, inodes and blockdevs, again. */
sync_blockdevs();
if (!wait)
printk("Emergency Sync complete\n");
if (unlikely(laptop_mode))
Expand Down

0 comments on commit 5e39505

Please sign in to comment.