Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1199705 > unrolled thread
| Started by | Andreas Gruenbacher <andreas.gruenbacher@gmail.com> |
|---|---|
| First post | 2015-08-04 14:00 +0200 |
| Last post | 2015-08-04 14:00 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC v6 35/40] sunrpc: Allow to demand-allocate pages to encode into Andreas Gruenbacher <andreas.gruenbacher@gmail.com> - 2015-08-04 14:00 +0200
| From | Andreas Gruenbacher <andreas.gruenbacher@gmail.com> |
|---|---|
| Date | 2015-08-04 14:00 +0200 |
| Subject | [RFC v6 35/40] sunrpc: Allow to demand-allocate pages to encode into |
| Message-ID | <pTJ2W-1c2-5@gated-at.bofh.it> |
When encoding large, variable-length objects such as acls into xdr_bufs,
it is easier to allocate buffer pages on demand rather than precomputing
the required buffer size.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
net/sunrpc/xdr.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 4439ac4..63c1c36 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -537,6 +537,15 @@ static __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
*/
xdr->scratch.iov_base = xdr->p;
xdr->scratch.iov_len = frag1bytes;
+
+ if (!*xdr->page_ptr) {
+ struct page *page = alloc_page(GFP_NOFS);
+
+ if (!page)
+ return NULL;
+ *xdr->page_ptr = page;
+ }
+
p = page_address(*xdr->page_ptr);
/*
* Note this is where the next encode will start after we've
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web