Re: [PATCH] Convert NFS client to use ->readpages()

Andrew Morton
2002-11-06T09:28:20Z

Trond Myklebust wrote:
>
> +int
> +nfs_readpages(struct file *filp, struct address_space *mapping,
> + struct list_head *pages, unsigned nr_pages)
> +{
> + LIST_HEAD(head);
> + struct nfs_readdesc desc = {
> + .filp = filp,
> + .head = &head,
> + };
> + struct nfs_server *server = NFS_SERVER(mapping->host);
> + int is_sync = server->rsize < PAGE_CACHE_SIZE;
> + int ret;
> +
> + ret = read_cache_pages(mapping, pages,
> + is_sync ? readpage_sync_filler :
> + readpage_async_filler,
> + &desc);
> + if (!list_empty(pages)) {
> + struct page *page = list_entry(pages->prev, struct page, list);
> + list_del(&page->list);
> + page_cache_release(page);
> + }

What are the above few lines doing? Looks odd.

Or should it be

while (!list_empty(...))

?

> + if (!list_empty(&head)) {
> + int err = nfs_pagein_list(&head, server->rpages);
> + if (!ret)
> + ret = err;
> + }
> + return ret;
> +}
> +