[PATCH] btrfs: increase usage of folio_next_index() helper

Qianfeng Rong posted 1 patch 3 months, 3 weeks ago
fs/btrfs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] btrfs: increase usage of folio_next_index() helper
Posted by Qianfeng Rong 3 months, 3 weeks ago
Simplify code pattern of 'folio->index + folio_nr_pages(folio)' by using
the existing helper folio_next_index().

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 fs/btrfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 2902de88dd1b..e7d080ef4d32 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2195,7 +2195,7 @@ static bool check_range_has_page(struct inode *inode, u64 start, u64 end)
 		if (folio->index < start_index)
 			continue;
 		/* A large folio extends beyond the end. Not a target. */
-		if (folio->index + folio_nr_pages(folio) > end_index)
+		if (folio_next_index(folio) > end_index)
 			continue;
 		/* A folio doesn't cover the head/tail index. Found a target. */
 		ret = true;
-- 
2.34.1
Re: [PATCH] btrfs: increase usage of folio_next_index() helper
Posted by David Sterba 3 months, 2 weeks ago
On Thu, Jun 19, 2025 at 06:15:01PM +0800, Qianfeng Rong wrote:
> Simplify code pattern of 'folio->index + folio_nr_pages(folio)' by using
> the existing helper folio_next_index().
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>

Added to for-next, thanks.