diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-19 19:07:28 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:59 -0400 |
commit | a86a92cb0d7837b2e23f6b503242810db5ec93c7 (patch) | |
tree | 59c3fbae64b06597d57882677565440d3d0943be /fs/bcachefs/fs-io.c | |
parent | e8d28c3e47d25f6a9bf83a6548395078c851d532 (diff) |
bcachefs: bch2_seek_pagecache_data() folio conversion
This converts bch2_seek_pagecache_data() to handle large folios.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs-io.c')
-rw-r--r-- | fs/bcachefs/fs-io.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index 0cb76238f487..de4e5effca06 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -3488,10 +3488,10 @@ err: static int folio_data_offset(struct folio *folio, unsigned offset) { struct bch_folio *s = bch2_folio(folio); - unsigned i; + unsigned i, sectors = folio_sectors(folio); if (s) - for (i = offset >> 9; i < PAGE_SECTORS; i++) + for (i = offset >> 9; i < sectors; i++) if (s->s[i].state >= SECTOR_DIRTY) return i << 9; @@ -3519,12 +3519,10 @@ static loff_t bch2_seek_pagecache_data(struct inode *vinode, folio_lock(folio); offset = folio_data_offset(folio, - folio->index == start_index - ? start_offset & (PAGE_SIZE - 1) - : 0); + max(folio_pos(folio), start_offset) - + folio_pos(folio)); if (offset >= 0) { - ret = clamp(((loff_t) folio->index << PAGE_SHIFT) + - offset, + ret = clamp(folio_pos(folio) + offset, start_offset, end_offset); folio_unlock(folio); folio_batch_release(&fbatch); |