]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: remove the dirty_page local variable
authorQu Wenruo <wqu@suse.com>
Tue, 1 Oct 2024 23:17:48 +0000 (08:47 +0930)
committerDavid Sterba <dsterba@suse.com>
Mon, 11 Nov 2024 13:34:14 +0000 (14:34 +0100)
commit00c5135dceaf57b212a808444d719d321444c819
tree975aaf107bf395ac4bb8fd2f45f0f6daf2f3c290
parentb628c139519ae0e5453e5327161a41bae966201d
btrfs: remove the dirty_page local variable

Inside btrfs_buffered_write(), we have a local variable @dirty_pages,
recording the number of pages we dirtied in the current iteration.

However we do not really need that variable, since it can be calculated
from @pos and @copied.

In fact there is already a problem inside the short copy path, where we
use @dirty_pages to calculate the range we need to release.
But that usage assumes sectorsize == PAGE_SIZE, which is no longer true.

Instead of keeping @dirty_pages and cause incorrect usage, just
calculate the number of dirtied pages inside btrfs_dirty_pages().

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c
fs/btrfs/file.h
fs/btrfs/free-space-cache.c