All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] NFS: move nfs_pgarray_set() to open code
@ 2017-04-18 15:40 Benjamin Coddington
  2017-04-18 15:40 ` [PATCH 2/2] NFS: Use GFP_NOIO for two allocations in writeback Benjamin Coddington
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Benjamin Coddington @ 2017-04-18 15:40 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs

Since commit 00bfa30abe86 ("NFS: Create a common pgio_alloc and
pgio_release function"), nfs_pgarray_set() has only a single caller.  Let's
open code it to make it easier to use the correct GFP_ flags in a following
patch.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/nfs/pagelist.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 6e629b856a00..19eaae0dee51 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -29,19 +29,6 @@
 static struct kmem_cache *nfs_page_cachep;
 static const struct rpc_call_ops nfs_pgio_common_ops;
 
-static bool nfs_pgarray_set(struct nfs_page_array *p, unsigned int pagecount)
-{
-	p->npages = pagecount;
-	if (pagecount <= ARRAY_SIZE(p->page_array))
-		p->pagevec = p->page_array;
-	else {
-		p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL);
-		if (!p->pagevec)
-			p->npages = 0;
-	}
-	return p->pagevec != NULL;
-}
-
 struct nfs_pgio_mirror *
 nfs_pgio_current_mirror(struct nfs_pageio_descriptor *desc)
 {
@@ -754,13 +741,21 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc,
 				*last_page;
 	struct list_head *head = &mirror->pg_list;
 	struct nfs_commit_info cinfo;
+	struct nfs_page_array *pg_array = &hdr->page_array;
 	unsigned int pagecount, pageused;
 
 	pagecount = nfs_page_array_len(mirror->pg_base, mirror->pg_count);
-	if (!nfs_pgarray_set(&hdr->page_array, pagecount)) {
-		nfs_pgio_error(hdr);
-		desc->pg_error = -ENOMEM;
-		return desc->pg_error;
+
+	if (pagecount <= ARRAY_SIZE(pg_array->page_array))
+		pg_array->pagevec = pg_array->page_array;
+	else {
+		pg_array->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL);
+		if (!pg_array->pagevec) {
+			pg_array->npages = 0;
+			nfs_pgio_error(hdr);
+			desc->pg_error = -ENOMEM;
+			return desc->pg_error;
+		}
 	}
 
 	nfs_init_cinfo(&cinfo, desc->pg_inode, desc->pg_dreq);
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-04-19 14:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-18 15:40 [PATCH 1/2] NFS: move nfs_pgarray_set() to open code Benjamin Coddington
2017-04-18 15:40 ` [PATCH 2/2] NFS: Use GFP_NOIO for two allocations in writeback Benjamin Coddington
2017-04-18 16:42   ` Trond Myklebust
2017-04-18 20:32     ` Benjamin Coddington
2017-04-19 10:08       ` Benjamin Coddington
2017-04-19 12:26         ` Benjamin Coddington
2017-04-19 14:11 ` [PATCH v2 1/3] " Benjamin Coddington
2017-04-19 14:11 ` [PATCH v2 2/3] NFS: move nfs_pgarray_set() to open code Benjamin Coddington
2017-04-19 14:11 ` [PATCH v2 3/3] NFS: move rw_mode to nfs_pageio_header Benjamin Coddington

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.