Re: [PATCH][RFC] splice support

From: Jens Axboe
Date: Thu Mar 30 2006 - 03:48:27 EST


On Thu, Mar 30 2006, Andrew Morton wrote:
> Jens Axboe <axboe@xxxxxxx> wrote:
> >
> > > find_get_pages() does "find me the next N pages above `index' which are
> > > presently in pagecache'. So it can return an array of page*'s which do not
> > > represent contiguous pages in the file - there can be holes in there.
> > >
> > > IOW: pages[n]->index !necessarily= pages[n+1]->index-1
> > >
> > > Maybe the code handles that by making sure that all the pages in the range
> > > are already in pagecache - I didn't check. But that would take some heroic
> > > locking.
> >
> > It doesn't, I'm assuming that find_get_pages() returns consequtive pages
> > atm. Would seem like the sane interface :-)
>
> Yeah, sorry. It's a "gather what's presently there" thing. For writeback.
>
> Nick has some gang-lookup-slots code. So instead of populating an array of
> page*'s you can populate an array of (effectively) page**'s. Then one
> could walk that. All while holding ->tree_lock. This doesn't help ;)
>
> Or you could walk the pages[] array until you hit an ->index which doesn't
> match and then toss the rest away. That's a bit of extra work, but in the
> common case all the pages will be good. Perhaps.
>
> > We continue doing find_or_create_page() on the remaining, but using 'i'
> > as the 'index' addition. So if we had non-conseq pages, we'd be screwed.
>
> Yup.
>
> Probably the simplest for now is an open-coded find_get_page() loop. Later
> on we should optimise that into a find_get_contig_pages() which only takes
> tree_lock a single time.
>
> Doing it with a new radix_tree_gang_lookup_contig_name_me_longer() would be
> relatively straightforward too. It would bale out as soon as it hit a
> not-present slot.

I'll go for the simple approach right now, going over the returned
find_get_pages() array and moving pages around and filling holes doesn't
sound too alluring. Thanks!

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/