Commit 6eedc70150d55b5885800eb6664ea226dc2cb66f

Authored by Jan Kara
Committed by Al Viro
1 parent 9e9ad5f408

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>

Showing 2 changed files with 5 additions and 7 deletions Side-by-side Diff

... ... @@ -1315,6 +1315,8 @@
1315 1315 .reason = reason,
1316 1316 };
1317 1317  
  1318 + if (sb->s_bdi == &noop_backing_dev_info)
  1319 + return;
1318 1320 WARN_ON(!rwsem_is_locked(&sb->s_umount));
1319 1321 bdi_queue_work(sb->s_bdi, &work);
1320 1322 wait_for_completion(&done);
... ... @@ -1398,6 +1400,9 @@
1398 1400 .reason = WB_REASON_SYNC,
1399 1401 };
1400 1402  
  1403 + /* Nothing to do? */
  1404 + if (sb->s_bdi == &noop_backing_dev_info)
  1405 + return;
1401 1406 WARN_ON(!rwsem_is_locked(&sb->s_umount));
1402 1407  
1403 1408 bdi_queue_work(sb->s_bdi, &work);
... ... @@ -29,13 +29,6 @@
29 29 */
30 30 static int __sync_filesystem(struct super_block *sb, int wait)
31 31 {
32   - /*
33   - * This should be safe, as we require bdi backing to actually
34   - * write out data in the first place
35   - */
36   - if (sb->s_bdi == &noop_backing_dev_info)
37   - return 0;
38   -
39 32 if (sb->s_qcop && sb->s_qcop->quota_sync)
40 33 sb->s_qcop->quota_sync(sb, -1, wait);
41 34