mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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>
This commit is contained in:
parent
9e9ad5f408
commit
6eedc70150
2 changed files with 5 additions and 7 deletions
|
@ -1315,6 +1315,8 @@ void writeback_inodes_sb_nr(struct super_block *sb,
|
||||||
.reason = reason,
|
.reason = reason,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (sb->s_bdi == &noop_backing_dev_info)
|
||||||
|
return;
|
||||||
WARN_ON(!rwsem_is_locked(&sb->s_umount));
|
WARN_ON(!rwsem_is_locked(&sb->s_umount));
|
||||||
bdi_queue_work(sb->s_bdi, &work);
|
bdi_queue_work(sb->s_bdi, &work);
|
||||||
wait_for_completion(&done);
|
wait_for_completion(&done);
|
||||||
|
@ -1398,6 +1400,9 @@ void sync_inodes_sb(struct super_block *sb)
|
||||||
.reason = WB_REASON_SYNC,
|
.reason = WB_REASON_SYNC,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Nothing to do? */
|
||||||
|
if (sb->s_bdi == &noop_backing_dev_info)
|
||||||
|
return;
|
||||||
WARN_ON(!rwsem_is_locked(&sb->s_umount));
|
WARN_ON(!rwsem_is_locked(&sb->s_umount));
|
||||||
|
|
||||||
bdi_queue_work(sb->s_bdi, &work);
|
bdi_queue_work(sb->s_bdi, &work);
|
||||||
|
|
|
@ -29,13 +29,6 @@
|
||||||
*/
|
*/
|
||||||
static int __sync_filesystem(struct super_block *sb, int wait)
|
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)
|
if (sb->s_qcop && sb->s_qcop->quota_sync)
|
||||||
sb->s_qcop->quota_sync(sb, -1, wait);
|
sb->s_qcop->quota_sync(sb, -1, wait);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue