aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@netapp.com>2014-05-06 09:12:24 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-28 18:12:02 -0400
commit3c6b899c49e5e9c2803b59ee553eddaf69cea7f6 (patch)
treea246624f122f66a823365dfaaf6d3e56be1d2fa8
parentfab5fc25d230edcc8ee72367e505955a2fae0cac (diff)
NFS: Create a common argument structure for reads and writes
Reads and writes have very similar arguments. This patch combines them together and documents the few fields used only by write. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/nfs2xdr.c8
-rw-r--r--fs/nfs/nfs3xdr.c8
-rw-r--r--fs/nfs/nfs4proc.c4
-rw-r--r--fs/nfs/nfs4xdr.c10
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/write.c2
-rw-r--r--include/linux/nfs_xdr.h47
7 files changed, 37 insertions, 44 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 62db136339ea..461cd8bd9401 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -613,7 +613,7 @@ static void nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req,
613 * }; 613 * };
614 */ 614 */
615static void encode_readargs(struct xdr_stream *xdr, 615static void encode_readargs(struct xdr_stream *xdr,
616 const struct nfs_readargs *args) 616 const struct nfs_pgio_args *args)
617{ 617{
618 u32 offset = args->offset; 618 u32 offset = args->offset;
619 u32 count = args->count; 619 u32 count = args->count;
@@ -629,7 +629,7 @@ static void encode_readargs(struct xdr_stream *xdr,
629 629
630static void nfs2_xdr_enc_readargs(struct rpc_rqst *req, 630static void nfs2_xdr_enc_readargs(struct rpc_rqst *req,
631 struct xdr_stream *xdr, 631 struct xdr_stream *xdr,
632 const struct nfs_readargs *args) 632 const struct nfs_pgio_args *args)
633{ 633{
634 encode_readargs(xdr, args); 634 encode_readargs(xdr, args);
635 prepare_reply_buffer(req, args->pages, args->pgbase, 635 prepare_reply_buffer(req, args->pages, args->pgbase,
@@ -649,7 +649,7 @@ static void nfs2_xdr_enc_readargs(struct rpc_rqst *req,
649 * }; 649 * };
650 */ 650 */
651static void encode_writeargs(struct xdr_stream *xdr, 651static void encode_writeargs(struct xdr_stream *xdr,
652 const struct nfs_writeargs *args) 652 const struct nfs_pgio_args *args)
653{ 653{
654 u32 offset = args->offset; 654 u32 offset = args->offset;
655 u32 count = args->count; 655 u32 count = args->count;
@@ -669,7 +669,7 @@ static void encode_writeargs(struct xdr_stream *xdr,
669 669
670static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req, 670static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req,
671 struct xdr_stream *xdr, 671 struct xdr_stream *xdr,
672 const struct nfs_writeargs *args) 672 const struct nfs_pgio_args *args)
673{ 673{
674 encode_writeargs(xdr, args); 674 encode_writeargs(xdr, args);
675 xdr->buf->flags |= XDRBUF_WRITE; 675 xdr->buf->flags |= XDRBUF_WRITE;
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index fa6d72131c19..02f16c212007 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -953,7 +953,7 @@ static void nfs3_xdr_enc_readlink3args(struct rpc_rqst *req,
953 * }; 953 * };
954 */ 954 */
955static void encode_read3args(struct xdr_stream *xdr, 955static void encode_read3args(struct xdr_stream *xdr,
956 const struct nfs_readargs *args) 956 const struct nfs_pgio_args *args)
957{ 957{
958 __be32 *p; 958 __be32 *p;
959 959
@@ -966,7 +966,7 @@ static void encode_read3args(struct xdr_stream *xdr,
966 966
967static void nfs3_xdr_enc_read3args(struct rpc_rqst *req, 967static void nfs3_xdr_enc_read3args(struct rpc_rqst *req,
968 struct xdr_stream *xdr, 968 struct xdr_stream *xdr,
969 const struct nfs_readargs *args) 969 const struct nfs_pgio_args *args)
970{ 970{
971 encode_read3args(xdr, args); 971 encode_read3args(xdr, args);
972 prepare_reply_buffer(req, args->pages, args->pgbase, 972 prepare_reply_buffer(req, args->pages, args->pgbase,
@@ -992,7 +992,7 @@ static void nfs3_xdr_enc_read3args(struct rpc_rqst *req,
992 * }; 992 * };
993 */ 993 */
994static void encode_write3args(struct xdr_stream *xdr, 994static void encode_write3args(struct xdr_stream *xdr,
995 const struct nfs_writeargs *args) 995 const struct nfs_pgio_args *args)
996{ 996{
997 __be32 *p; 997 __be32 *p;
998 998
@@ -1008,7 +1008,7 @@ static void encode_write3args(struct xdr_stream *xdr,
1008 1008
1009static void nfs3_xdr_enc_write3args(struct rpc_rqst *req, 1009static void nfs3_xdr_enc_write3args(struct rpc_rqst *req,
1010 struct xdr_stream *xdr, 1010 struct xdr_stream *xdr,
1011 const struct nfs_writeargs *args) 1011 const struct nfs_pgio_args *args)
1012{ 1012{
1013 encode_write3args(xdr, args); 1013 encode_write3args(xdr, args);
1014 xdr->buf->flags |= XDRBUF_WRITE; 1014 xdr->buf->flags |= XDRBUF_WRITE;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 21cd1f2ee35a..4794ca693367 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4055,7 +4055,7 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data)
4055} 4055}
4056 4056
4057static bool nfs4_read_stateid_changed(struct rpc_task *task, 4057static bool nfs4_read_stateid_changed(struct rpc_task *task,
4058 struct nfs_readargs *args) 4058 struct nfs_pgio_args *args)
4059{ 4059{
4060 4060
4061 if (!nfs4_error_stateid_expired(task->tk_status) || 4061 if (!nfs4_error_stateid_expired(task->tk_status) ||
@@ -4121,7 +4121,7 @@ static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data
4121} 4121}
4122 4122
4123static bool nfs4_write_stateid_changed(struct rpc_task *task, 4123static bool nfs4_write_stateid_changed(struct rpc_task *task,
4124 struct nfs_writeargs *args) 4124 struct nfs_pgio_args *args)
4125{ 4125{
4126 4126
4127 if (!nfs4_error_stateid_expired(task->tk_status) || 4127 if (!nfs4_error_stateid_expired(task->tk_status) ||
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 73ce8d4fe2c8..032159c36a57 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1556,7 +1556,8 @@ static void encode_putrootfh(struct xdr_stream *xdr, struct compound_hdr *hdr)
1556 encode_op_hdr(xdr, OP_PUTROOTFH, decode_putrootfh_maxsz, hdr); 1556 encode_op_hdr(xdr, OP_PUTROOTFH, decode_putrootfh_maxsz, hdr);
1557} 1557}
1558 1558
1559static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args, struct compound_hdr *hdr) 1559static void encode_read(struct xdr_stream *xdr, const struct nfs_pgio_args *args,
1560 struct compound_hdr *hdr)
1560{ 1561{
1561 __be32 *p; 1562 __be32 *p;
1562 1563
@@ -1701,7 +1702,8 @@ static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs4
1701 encode_nfs4_verifier(xdr, &arg->confirm); 1702 encode_nfs4_verifier(xdr, &arg->confirm);
1702} 1703}
1703 1704
1704static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr) 1705static void encode_write(struct xdr_stream *xdr, const struct nfs_pgio_args *args,
1706 struct compound_hdr *hdr)
1705{ 1707{
1706 __be32 *p; 1708 __be32 *p;
1707 1709
@@ -2451,7 +2453,7 @@ static void nfs4_xdr_enc_readdir(struct rpc_rqst *req, struct xdr_stream *xdr,
2451 * Encode a READ request 2453 * Encode a READ request
2452 */ 2454 */
2453static void nfs4_xdr_enc_read(struct rpc_rqst *req, struct xdr_stream *xdr, 2455static void nfs4_xdr_enc_read(struct rpc_rqst *req, struct xdr_stream *xdr,
2454 struct nfs_readargs *args) 2456 struct nfs_pgio_args *args)
2455{ 2457{
2456 struct compound_hdr hdr = { 2458 struct compound_hdr hdr = {
2457 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2459 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
@@ -2513,7 +2515,7 @@ static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
2513 * Encode a WRITE request 2515 * Encode a WRITE request
2514 */ 2516 */
2515static void nfs4_xdr_enc_write(struct rpc_rqst *req, struct xdr_stream *xdr, 2517static void nfs4_xdr_enc_write(struct rpc_rqst *req, struct xdr_stream *xdr,
2516 struct nfs_writeargs *args) 2518 struct nfs_pgio_args *args)
2517{ 2519{
2518 struct compound_hdr hdr = { 2520 struct compound_hdr hdr = {
2519 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2521 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 7f87461be3a9..46d555206023 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -470,7 +470,7 @@ int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data)
470 470
471static void nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data) 471static void nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data)
472{ 472{
473 struct nfs_readargs *argp = &data->args; 473 struct nfs_pgio_args *argp = &data->args;
474 struct nfs_readres *resp = &data->res; 474 struct nfs_readres *resp = &data->res;
475 475
476 /* This is a short read! */ 476 /* This is a short read! */
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index ee6d46fde76c..25ba3830ec8b 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1388,7 +1388,7 @@ static int nfs_should_remove_suid(const struct inode *inode)
1388 */ 1388 */
1389void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data) 1389void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1390{ 1390{
1391 struct nfs_writeargs *argp = &data->args; 1391 struct nfs_pgio_args *argp = &data->args;
1392 struct nfs_writeres *resp = &data->res; 1392 struct nfs_writeres *resp = &data->res;
1393 struct inode *inode = data->header->inode; 1393 struct inode *inode = data->header->inode;
1394 int status; 1394 int status;
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 3e8fc1fe585b..5875001928f9 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -491,18 +491,6 @@ struct nfs4_delegreturnres {
491/* 491/*
492 * Arguments to the read call. 492 * Arguments to the read call.
493 */ 493 */
494struct nfs_readargs {
495 struct nfs4_sequence_args seq_args;
496 struct nfs_fh * fh;
497 struct nfs_open_context *context;
498 struct nfs_lock_context *lock_context;
499 nfs4_stateid stateid;
500 __u64 offset;
501 __u32 count;
502 unsigned int pgbase;
503 struct page ** pages;
504};
505
506struct nfs_readres { 494struct nfs_readres {
507 struct nfs4_sequence_res seq_res; 495 struct nfs4_sequence_res seq_res;
508 struct nfs_fattr * fattr; 496 struct nfs_fattr * fattr;
@@ -513,20 +501,6 @@ struct nfs_readres {
513/* 501/*
514 * Arguments to the write call. 502 * Arguments to the write call.
515 */ 503 */
516struct nfs_writeargs {
517 struct nfs4_sequence_args seq_args;
518 struct nfs_fh * fh;
519 struct nfs_open_context *context;
520 struct nfs_lock_context *lock_context;
521 nfs4_stateid stateid;
522 __u64 offset;
523 __u32 count;
524 enum nfs3_stable_how stable;
525 unsigned int pgbase;
526 struct page ** pages;
527 const u32 * bitmask;
528};
529
530struct nfs_write_verifier { 504struct nfs_write_verifier {
531 char data[8]; 505 char data[8];
532}; 506};
@@ -545,6 +519,23 @@ struct nfs_writeres {
545}; 519};
546 520
547/* 521/*
522 * Arguments shared by the read and write call.
523 */
524struct nfs_pgio_args {
525 struct nfs4_sequence_args seq_args;
526 struct nfs_fh * fh;
527 struct nfs_open_context *context;
528 struct nfs_lock_context *lock_context;
529 nfs4_stateid stateid;
530 __u64 offset;
531 __u32 count;
532 unsigned int pgbase;
533 struct page ** pages;
534 const u32 * bitmask; /* used by write */
535 enum nfs3_stable_how stable; /* used by write */
536};
537
538/*
548 * Arguments to the commit call. 539 * Arguments to the commit call.
549 */ 540 */
550struct nfs_commitargs { 541struct nfs_commitargs {
@@ -1269,7 +1260,7 @@ struct nfs_read_data {
1269 struct list_head list; 1260 struct list_head list;
1270 struct rpc_task task; 1261 struct rpc_task task;
1271 struct nfs_fattr fattr; /* fattr storage */ 1262 struct nfs_fattr fattr; /* fattr storage */
1272 struct nfs_readargs args; 1263 struct nfs_pgio_args args;
1273 struct nfs_readres res; 1264 struct nfs_readres res;
1274 unsigned long timestamp; /* For lease renewal */ 1265 unsigned long timestamp; /* For lease renewal */
1275 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data); 1266 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
@@ -1321,7 +1312,7 @@ struct nfs_write_data {
1321 struct rpc_task task; 1312 struct rpc_task task;
1322 struct nfs_fattr fattr; 1313 struct nfs_fattr fattr;
1323 struct nfs_writeverf verf; 1314 struct nfs_writeverf verf;
1324 struct nfs_writeargs args; /* argument struct */ 1315 struct nfs_pgio_args args; /* argument struct */
1325 struct nfs_writeres res; /* result struct */ 1316 struct nfs_writeres res; /* result struct */
1326 unsigned long timestamp; /* For lease renewal */ 1317 unsigned long timestamp; /* For lease renewal */
1327 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data); 1318 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);