mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
btrfs: use variable for end offset in extent_writepage_io()
Instead of repeating the expression "start + len" multiple times, store it in a variable and use it where needed. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Anand Jain <asj@kernel.org> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
18de34daa7
commit
46a2390859
|
|
@ -1690,6 +1690,7 @@ static noinline_for_stack int extent_writepage_io(struct btrfs_inode *inode,
|
|||
unsigned long range_bitmap = 0;
|
||||
bool submitted_io = false;
|
||||
int found_error = 0;
|
||||
const u64 end = start + len;
|
||||
const u64 folio_start = folio_pos(folio);
|
||||
const u64 folio_end = folio_start + folio_size(folio);
|
||||
const unsigned int blocks_per_folio = btrfs_blocks_per_folio(fs_info, folio);
|
||||
|
|
@ -1697,7 +1698,7 @@ static noinline_for_stack int extent_writepage_io(struct btrfs_inode *inode,
|
|||
int bit;
|
||||
int ret = 0;
|
||||
|
||||
ASSERT(start >= folio_start && start + len <= folio_end);
|
||||
ASSERT(start >= folio_start && end <= folio_end);
|
||||
|
||||
ret = btrfs_writepage_cow_fixup(folio);
|
||||
if (ret == -EAGAIN) {
|
||||
|
|
@ -1713,7 +1714,7 @@ static noinline_for_stack int extent_writepage_io(struct btrfs_inode *inode,
|
|||
return ret;
|
||||
}
|
||||
|
||||
for (cur = start; cur < start + len; cur += fs_info->sectorsize)
|
||||
for (cur = start; cur < end; cur += fs_info->sectorsize)
|
||||
set_bit((cur - folio_start) >> fs_info->sectorsize_bits, &range_bitmap);
|
||||
bitmap_and(&bio_ctrl->submit_bitmap, &bio_ctrl->submit_bitmap, &range_bitmap,
|
||||
blocks_per_folio);
|
||||
|
|
@ -1742,7 +1743,7 @@ static noinline_for_stack int extent_writepage_io(struct btrfs_inode *inode,
|
|||
btrfs_put_ordered_extent(ordered);
|
||||
|
||||
btrfs_mark_ordered_io_finished(inode, folio, cur,
|
||||
start + len - cur, true);
|
||||
end - cur, true);
|
||||
/*
|
||||
* This range is beyond i_size, thus we don't need to
|
||||
* bother writing back.
|
||||
|
|
@ -1751,8 +1752,7 @@ static noinline_for_stack int extent_writepage_io(struct btrfs_inode *inode,
|
|||
* writeback the sectors with subpage dirty bits,
|
||||
* causing writeback without ordered extent.
|
||||
*/
|
||||
btrfs_folio_clear_dirty(fs_info, folio, cur,
|
||||
start + len - cur);
|
||||
btrfs_folio_clear_dirty(fs_info, folio, cur, end - cur);
|
||||
break;
|
||||
}
|
||||
ret = submit_one_sector(inode, folio, cur, bio_ctrl, i_size);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user