diff options
author | Christoph Hellwig <hch@lst.de> | 2023-06-28 17:31:42 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-08-21 14:52:16 +0200 |
commit | 778b878543f05ddf11843cd44ba9b1e775216fc0 (patch) | |
tree | bb2c2174d0814ccb63d2501dfbf366e346643867 /fs/btrfs/inode.c | |
parent | 6e144bf16ba07dff649e6bd6afd79d2e353f6216 (diff) |
btrfs: don't redirty locked_page in run_delalloc_zoned
extent_write_locked_range currently expects that either all or no
pages are dirty when it is called. Bur run_delalloc_zoned is called
directly in the writepages path, and has the dirty bit cleared only
for locked_page and which the extent_write_cache_pages currently
operates. It currently works around this by redirtying locked_page,
but that is a bit inefficient and cumbersome. Pass a locked_page
argument to run_delalloc_zoned so that clearing the dirty bit can
be skipped on just that page.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0617e47fb9e3..29a137d55cf2 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1105,7 +1105,8 @@ static void submit_uncompressed_range(struct btrfs_inode *inode, /* All pages will be unlocked, including @locked_page */ wbc_attach_fdatawrite_inode(&wbc, &inode->vfs_inode); - extent_write_locked_range(&inode->vfs_inode, start, end, &wbc, false); + extent_write_locked_range(&inode->vfs_inode, NULL, start, end, &wbc, + false); wbc_detach_inode(&wbc); } @@ -1719,7 +1720,6 @@ static noinline int run_delalloc_zoned(struct btrfs_inode *inode, { u64 done_offset = end; int ret; - bool locked_page_done = false; while (start <= end) { ret = cow_file_range(inode, locked_page, start, end, &done_offset, @@ -1727,13 +1727,8 @@ static noinline int run_delalloc_zoned(struct btrfs_inode *inode, if (ret) return ret; - if (!locked_page_done) { - __set_page_dirty_nobuffers(locked_page); - account_page_redirty(locked_page); - } - locked_page_done = true; - extent_write_locked_range(&inode->vfs_inode, start, done_offset, - wbc, true); + extent_write_locked_range(&inode->vfs_inode, locked_page, start, + done_offset, wbc, true); start = done_offset + 1; } |