aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2021-09-27 15:21:58 +0800
committerDavid Sterba <dsterba@suse.com>2021-10-26 19:08:04 +0200
commit2bd0fc9349b63653216d71671c5ea84d11a4f348 (patch)
tree5aa44e8bd862881150374da7cc8ed50eb6351177 /fs/btrfs/inode.c
parentbtrfs: refactor submit_compressed_extents() (diff)
downloadlinux-dev-2bd0fc9349b63653216d71671c5ea84d11a4f348.tar.xz
linux-dev-2bd0fc9349b63653216d71671c5ea84d11a4f348.zip
btrfs: cleanup for extent_write_locked_range()
There are several cleanups for extent_write_locked_range(), most of them are pure cleanups, but with some preparation for future subpage support. - Add a proper comment for which call sites are suitable Unlike regular synchronized extent write back, if async COW or zoned COW happens, we have all pages in the range still locked. Thus for those (only) two call sites, we need this function to submit page content into bios and submit them. - Remove @mode parameter All the existing two call sites pass WB_SYNC_ALL. No need for @mode parameter. - Better error handling Currently if we hit an error during the page iteration loop, we overwrite @ret, causing only the last error can be recorded. Here we add @found_error and @first_error variable to record if we hit any error, and the first error we hit. So the first error won't get lost. - Don't reuse @start as the cursor We reuse the parameter @start as the cursor to iterate the range, not a big problem, but since we're here, introduce a proper @cur as the cursor. - Remove impossible branch Since all pages are still locked after the ordered extent is inserted, there is no way that pages can get its dirty bit cleared. Remove the branch where page is not dirty and replace it with an ASSERT(). Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index bb47b0b04a0a..aaeb2192b24d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -873,8 +873,7 @@ static int submit_one_async_extent(struct btrfs_inode *inode,
* drive.
*/
if (!page_started && !ret)
- extent_write_locked_range(&inode->vfs_inode, start,
- end, WB_SYNC_ALL);
+ extent_write_locked_range(&inode->vfs_inode, start, end);
else if (ret && async_chunk->locked_page)
unlock_page(async_chunk->locked_page);
kfree(async_extent);
@@ -1454,7 +1453,7 @@ static noinline int run_delalloc_zoned(struct btrfs_inode *inode,
__set_page_dirty_nobuffers(locked_page);
account_page_redirty(locked_page);
- extent_write_locked_range(&inode->vfs_inode, start, end, WB_SYNC_ALL);
+ extent_write_locked_range(&inode->vfs_inode, start, end);
*page_started = 1;
return 0;