[PATCH] fuse: use release_pages()

From: Miklos Szeredi
Date: Wed Sep 22 2010 - 10:28:03 EST


From: Miklos Szeredi <mszeredi@xxxxxxx>

Replace iterated page_cache_release() with release_pages(), which is
faster and shorter.

Needs release_pages() to be exported to modules.

Suggested-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
---
fs/fuse/dev.c | 7 +------
mm/swap.c | 1 +
2 files changed, 2 insertions(+), 6 deletions(-)

Index: linux-2.6/fs/fuse/dev.c
===================================================================
--- linux-2.6.orig/fs/fuse/dev.c 2010-09-22 16:14:36.000000000 +0200
+++ linux-2.6/fs/fuse/dev.c 2010-09-22 16:14:49.000000000 +0200
@@ -1336,12 +1336,7 @@ out_finish:

static void fuse_retrieve_end(struct fuse_conn *fc, struct fuse_req *req)
{
- int i;
-
- for (i = 0; i < req->num_pages; i++) {
- struct page *page = req->pages[i];
- page_cache_release(page);
- }
+ release_pages(req->pages, req->num_pages, 0);
}

static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
Index: linux-2.6/mm/swap.c
===================================================================
--- linux-2.6.orig/mm/swap.c 2010-08-06 13:58:19.000000000 +0200
+++ linux-2.6/mm/swap.c 2010-09-22 16:15:55.000000000 +0200
@@ -378,6 +378,7 @@ void release_pages(struct page **pages,

pagevec_free(&pages_to_free);
}
+EXPORT_SYMBOL(release_pages);

/*
* The pages which we're about to release may be in the deferred lru-addition
--
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/