From: Josef Bacik Date: Wed, 14 Jul 2021 18:47:23 +0000 (-0400) Subject: btrfs: use the filemap_fdatawrite_wbc helper for delalloc shrinking X-Git-Tag: accepted/tizen/unified/20230118.172025~6109^2~76 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3776305278e5937366f512d3e655ace13b8b027;p=platform%2Fkernel%2Flinux-rpi.git btrfs: use the filemap_fdatawrite_wbc helper for delalloc shrinking sync_inode() has some holes that can cause problems if we're under heavy ENOSPC pressure. If there's writeback running on a separate thread sync_inode() will skip writing the inode altogether. What we really want is to make sure writeback has been started on all the pages to make sure we can see the ordered extents and wait on them if appropriate. Switch to this new helper which will allow us to accomplish this and avoid ENOSPC'ing early. Reviewed-by: Nikolay Borisov Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 25eb214..c917e31 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -9878,7 +9878,7 @@ static int start_delalloc_inodes(struct btrfs_root *root, btrfs_queue_work(root->fs_info->flush_workers, &work->work); } else { - ret = sync_inode(inode, wbc); + ret = filemap_fdatawrite_wbc(inode->i_mapping, wbc); btrfs_add_delayed_iput(inode); if (ret || wbc->nr_to_write <= 0) goto out;