Re: [PATCH 03/13] filemap: align the index to mapping_min_order in the page cache

From: Kent Overstreet
Date: Tue Feb 27 2024 - 12:06:45 EST


On Tue, Feb 27, 2024 at 05:55:35PM +0100, Pankaj Raghav (Samsung) wrote:
> > > >
> > > > you guys are both wrong, just use rounddown()
> > >
> > > Umm, what do you mean just use rounddown? rounddown to ...?
> > >
> > > We need to get index that are in PAGE units but aligned to min_order
> > > pages.
> > >
> > > The original patch did this:
> > >
> > > index = mapping_align_start_index(mapping, iocb->ki_pos >> PAGE_SHIFT);
> > >
> > > Which is essentially a rounddown operation (probably this is what you
> > > are suggesting?).
> > >
> > > So what willy is proposing will do the same. To me, what I proposed is
> > > less complicated but to willy it is the other way around.
> >
> > Ok, I just found the code for mapping_align_start_index() - it is just a
> > round_down().
> >
> > Never mind; patch looks fine (aside from perhaps some quibbling over
> > whether the round_down()) should be done before calling readahead or
> > within readahead; I think that might have been more what willy was
> > keying in on)
>
> Yeah, exactly.
>
> I have one question while I have you here.
>
> When we have this support in the page cache, do you think bcachefs can make
> use of this support to enable bs > ps in bcachefs as it already makes use
> of large folios?

Yes, of course.

> Do you think it is just a simple mapping_set_large_folios ->
> mapping_set_folio_min_order(.., block_size order) or it requires more
> effort?

I think that's all that would be required. There's very little in the
way of references to PAGE_SIZE in bcachefs.