Skip to content

Commit d4aeb5f

Browse files
Li Zetaokdave
authored andcommitted
btrfs: convert get_next_extent_buffer() to take a folio
The old page API is being gradually replaced and converted to use folio to improve code readability and avoid repeated conversion between page and folio. Use folio_pos instead of page_offset, which is more consistent with folio usage. Signed-off-by: Li Zetao <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 266a936 commit d4aeb5f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/btrfs/extent_io.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,17 +4041,17 @@ void memmove_extent_buffer(const struct extent_buffer *dst,
40414041

40424042
#define GANG_LOOKUP_SIZE 16
40434043
static struct extent_buffer *get_next_extent_buffer(
4044-
const struct btrfs_fs_info *fs_info, struct page *page, u64 bytenr)
4044+
const struct btrfs_fs_info *fs_info, struct folio *folio, u64 bytenr)
40454045
{
40464046
struct extent_buffer *gang[GANG_LOOKUP_SIZE];
40474047
struct extent_buffer *found = NULL;
4048-
u64 page_start = page_offset(page);
4049-
u64 cur = page_start;
4048+
u64 folio_start = folio_pos(folio);
4049+
u64 cur = folio_start;
40504050

4051-
ASSERT(in_range(bytenr, page_start, PAGE_SIZE));
4051+
ASSERT(in_range(bytenr, folio_start, PAGE_SIZE));
40524052
lockdep_assert_held(&fs_info->buffer_lock);
40534053

4054-
while (cur < page_start + PAGE_SIZE) {
4054+
while (cur < folio_start + PAGE_SIZE) {
40554055
int ret;
40564056
int i;
40574057

@@ -4063,7 +4063,7 @@ static struct extent_buffer *get_next_extent_buffer(
40634063
goto out;
40644064
for (i = 0; i < ret; i++) {
40654065
/* Already beyond page end */
4066-
if (gang[i]->start >= page_start + PAGE_SIZE)
4066+
if (gang[i]->start >= folio_start + PAGE_SIZE)
40674067
goto out;
40684068
/* Found one */
40694069
if (gang[i]->start >= bytenr) {
@@ -4096,7 +4096,7 @@ static int try_release_subpage_extent_buffer(struct page *page)
40964096
* with spinlock rather than RCU.
40974097
*/
40984098
spin_lock(&fs_info->buffer_lock);
4099-
eb = get_next_extent_buffer(fs_info, page, cur);
4099+
eb = get_next_extent_buffer(fs_info, page_folio(page), cur);
41004100
if (!eb) {
41014101
/* No more eb in the page range after or at cur */
41024102
spin_unlock(&fs_info->buffer_lock);

0 commit comments

Comments
 (0)