From 84a346c538f60a85297c8d652c82c5c59e5c89c5 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 5 May 2009 16:08:56 +0200 Subject: [PATCH] --- yaml --- r: 147843 b: refs/heads/master c: e5004753388dcf5e1b8a52ac0ab807d232340fbb h: refs/heads/master i: 147841: 139605552803eb8fecc7a5928b095b0bff0ffb62 147839: 00146c8b2dae24a869791535cff2b20d46ca2a8c v: v3 --- [refs] | 2 +- trunk/fs/super.c | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 90c88def0b60..be390a7af938 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f3da392e9ff14b9f388e74319e6d195848991c07 +refs/heads/master: e5004753388dcf5e1b8a52ac0ab807d232340fbb diff --git a/trunk/fs/super.c b/trunk/fs/super.c index d9a29d5b1d28..cb19fffc7681 100644 --- a/trunk/fs/super.c +++ b/trunk/fs/super.c @@ -399,16 +399,14 @@ void drop_super(struct super_block *sb) EXPORT_SYMBOL(drop_super); -static inline void write_super(struct super_block *sb) -{ - lock_super(sb); - if (sb->s_root && sb->s_dirt) - if (sb->s_op->write_super) - sb->s_op->write_super(sb); - unlock_super(sb); -} - -/* +/** + * sync_supers - helper for periodic superblock writeback + * + * Call the write_super method if present on all dirty superblocks in + * the system. This is for the periodic writeback used by most older + * filesystems. For data integrity superblock writeback use + * sync_filesystems() instead. + * * Note: check the dirty flag before waiting, so we don't * hold up the sync while mounting a device. (The newly * mounted device won't need syncing.) @@ -420,12 +418,17 @@ void sync_supers(void) spin_lock(&sb_lock); restart: list_for_each_entry(sb, &super_blocks, s_list) { - if (sb->s_dirt) { + if (sb->s_op->write_super && sb->s_dirt) { sb->s_count++; spin_unlock(&sb_lock); + down_read(&sb->s_umount); - write_super(sb); + lock_super(sb); + if (sb->s_root && sb->s_dirt) + sb->s_op->write_super(sb); + unlock_super(sb); up_read(&sb->s_umount); + spin_lock(&sb_lock); if (__put_super_and_need_restart(sb)) goto restart;