Skip to content

Commit 94fe021

Browse files
committed
btrfs: add helper folio_end()
There are several cases of folio_pos + folio_size, add a convenience helper for that. This is a local helper and not proposed as folio API because it does not seem to be heavily used elsewhere: A quick grep (folio_size + folio_end) in fs/ shows 24 btrfs 4 iomap 4 ext4 2 xfs 2 netfs 1 gfs2 1 f2fs 1 bcachefs 1 buffer.c Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c9ed36a commit 94fe021

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/btrfs/misc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <linux/bitmap.h>
88
#include <linux/sched.h>
99
#include <linux/wait.h>
10+
#include <linux/mm.h>
11+
#include <linux/pagemap.h>
1012
#include <linux/math64.h>
1113
#include <linux/rbtree.h>
1214

@@ -158,4 +160,9 @@ static inline bool bitmap_test_range_all_zero(const unsigned long *addr,
158160
return (found_set == start + nbits);
159161
}
160162

163+
static inline u64 folio_end(struct folio *folio)
164+
{
165+
return folio_pos(folio) + folio_size(folio);
166+
}
167+
161168
#endif

0 commit comments

Comments
 (0)