mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
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>
This commit is contained in:
parent
e8d28c3e47
commit
a86a92cb0d
1 changed files with 5 additions and 7 deletions
|
@ -3488,10 +3488,10 @@ loff_t bch2_remap_file_range(struct file *file_src, loff_t pos_src,
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue