diff options
author | Jan Kara <jack@suse.cz> | 2012-07-03 16:45:27 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-22 23:58:18 +0400 |
commit | 6eedc70150d55b5885800eb6664ea226dc2cb66f (patch) | |
tree | e0d0762e047d1fae5d7b6ead1214545bcb205f4e | |
parent | 9e9ad5f408889db6038a59b38ede29ff1ba9ef2f (diff) | |
download | op-kernel-dev-6eedc70150d55b5885800eb6664ea226dc2cb66f.zip op-kernel-dev-6eedc70150d55b5885800eb6664ea226dc2cb66f.tar.gz |
vfs: Move noop_backing_dev_info check from sync into writeback
In principle, a filesystem may want to have ->sync_fs() called during sync(1)
although it does not have a bdi (i.e. s_bdi is set to noop_backing_dev_info).
Only writeback code really needs bdi set to something reasonable. So move the
checks where they are more logical.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/fs-writeback.c | 5 | ||||
-rw-r--r-- | fs/sync.c | 7 |
2 files changed, 5 insertions, 7 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 41a3ccf..8f660dd 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1315,6 +1315,8 @@ void writeback_inodes_sb_nr(struct super_block *sb, .reason = reason, }; + if (sb->s_bdi == &noop_backing_dev_info) + return; WARN_ON(!rwsem_is_locked(&sb->s_umount)); bdi_queue_work(sb->s_bdi, &work); wait_for_completion(&done); @@ -1398,6 +1400,9 @@ void sync_inodes_sb(struct super_block *sb) .reason = WB_REASON_SYNC, }; + /* Nothing to do? */ + if (sb->s_bdi == &noop_backing_dev_info) + return; WARN_ON(!rwsem_is_locked(&sb->s_umount)); bdi_queue_work(sb->s_bdi, &work); @@ -29,13 +29,6 @@ */ static int __sync_filesystem(struct super_block *sb, int wait) { - /* - * This should be safe, as we require bdi backing to actually - * write out data in the first place - */ - if (sb->s_bdi == &noop_backing_dev_info) - return 0; - if (sb->s_qcop && sb->s_qcop->quota_sync) sb->s_qcop->quota_sync(sb, -1, wait); |