aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/defrag.c
diff options
context:
space:
mode:
authorDavid Sterba <[email protected]>2025-06-10 12:17:55 +0000
committerDavid Sterba <[email protected]>2025-07-21 21:58:01 +0000
commit55cd57faa5034674200aac4a91387c06c3f1170c (patch)
treee37adc448a3de29833d9cc7e9385f0b8b28992cc /fs/btrfs/defrag.c
parentbtrfs: add helper folio_end() (diff)
downloadkernel-55cd57faa5034674200aac4a91387c06c3f1170c.tar.gz
kernel-55cd57faa5034674200aac4a91387c06c3f1170c.zip
btrfs: use folio_end() where appropriate
Simplify folio_pos() + folio_size() and use the new helper. Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/defrag.c')
-rw-r--r--fs/btrfs/defrag.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
index faa563ee3000..701b6b51ea85 100644
--- a/fs/btrfs/defrag.c
+++ b/fs/btrfs/defrag.c
@@ -886,7 +886,7 @@ again:
}
lock_start = folio_pos(folio);
- lock_end = folio_pos(folio) + folio_size(folio) - 1;
+ lock_end = folio_end(folio) - 1;
/* Wait for any existing ordered extent in the range */
while (1) {
struct btrfs_ordered_extent *ordered;
@@ -1178,8 +1178,7 @@ static int defrag_one_locked_target(struct btrfs_inode *inode,
if (!folio)
break;
- if (start >= folio_pos(folio) + folio_size(folio) ||
- start + len <= folio_pos(folio))
+ if (start >= folio_end(folio) || start + len <= folio_pos(folio))
continue;
btrfs_folio_clamp_clear_checked(fs_info, folio, start, len);
btrfs_folio_clamp_set_dirty(fs_info, folio, start, len);
@@ -1220,7 +1219,7 @@ static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len,
folios[i] = NULL;
goto free_folios;
}
- cur = folio_pos(folios[i]) + folio_size(folios[i]);
+ cur = folio_end(folios[i]);
}
for (int i = 0; i < nr_pages; i++) {
if (!folios[i])