Re: [PATCH 18/18] xfs: stop using the page cache to back the buffer cache

Christoph Hellwig
2010-09-14T23:19:16Z

On Tue, Sep 14, 2010 at 08:56:17PM +1000, Dave Chinner wrote:
> The only open question is how to best handle sub-page buffers - can we use
> kmalloc/slab memory for sub-page sized buffers, or do we need to split up
> pages ourselves? Worth noting is that the current code still works on sub-page
> block size filesystems, it is just inefficient w.r.t. memory usage.

As mentioned before I think we're fine to use slab/kmalloc pages now.
In fact using them will probably be more efficient than the current
code, given that at least btree blocks usually won't be close to each
other, so the old code wasted lots of memory for it, too.

> for (i = 0; i < bp->b_page_count; i++) {
> struct page *page;
> uint retries = 0;
> +retry:
> + page = alloc_page(gfp_mask);
> if (unlikely(page == NULL)) {
> if (flags & XBF_READ_AHEAD) {
> bp->b_page_count = i;
> for (i = 0; i < bp->b_page_count; i++)
> + __free_page(bp->b_pages[i]);
> return -ENOMEM;

Maybe convert this to and out_free_pages goto while you're at it?