On Mon, Jan 24, 2022 at 03:46:27PM +0000, David Howells wrote: > Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > > > Would it be possible to make readahead_count() do: > > > > > > return rac->_nr_pages - rac->_batch_count; > > > > > > maybe? > > > > Yes, I think that would make sense. Do we also need to change > > readhead_length()? It seems to me that it's only ever called once at > > initialisation, so it should be possible to keep the two in sync. > > Can you write & test such a patch? I'll support it going upstream > > (either by taking it myself or giving you a R-b to take it through your > > tree). > > It seems I also have a problem with readahead_index() needing compensation > too. I'm guessing that's more of a problem, however, as I think that's > expected to refer to the beginning of the current batch. Well, that's the problem isn't it? You're expecting to mutate the state and then refer to its previous state instead of its current state, whereas the other users refer to the current state instead of the previous state. Can't you pull readahead_index() out of the ractl ahead of the mutation? -- Linux-cachefs mailing list Linux-cachefs@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/linux-cachefs