Commit 9137bdf3 authored by Anna Schumaker's avatar Anna Schumaker Committed by Trond Myklebust

NFS: Create a common results structure for reads and writes

Reads and writes have very similar results.  This patch combines the two
structs together with comments to show where the differing fields are
used.
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 3c6b899c
...@@ -103,7 +103,7 @@ static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) ...@@ -103,7 +103,7 @@ static void print_overflow_msg(const char *func, const struct xdr_stream *xdr)
/* /*
* typedef opaque nfsdata<>; * typedef opaque nfsdata<>;
*/ */
static int decode_nfsdata(struct xdr_stream *xdr, struct nfs_readres *result) static int decode_nfsdata(struct xdr_stream *xdr, struct nfs_pgio_res *result)
{ {
u32 recvd, count; u32 recvd, count;
__be32 *p; __be32 *p;
...@@ -857,7 +857,7 @@ static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req, ...@@ -857,7 +857,7 @@ static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req,
* }; * };
*/ */
static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_readres *result) struct nfs_pgio_res *result)
{ {
enum nfs_stat status; enum nfs_stat status;
int error; int error;
...@@ -878,7 +878,7 @@ static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -878,7 +878,7 @@ static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
} }
static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_writeres *result) struct nfs_pgio_res *result)
{ {
/* All NFSv2 writes are "file sync" writes */ /* All NFSv2 writes are "file sync" writes */
result->verf->committed = NFS_FILE_SYNC; result->verf->committed = NFS_FILE_SYNC;
......
...@@ -1589,7 +1589,7 @@ static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req, ...@@ -1589,7 +1589,7 @@ static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req,
* }; * };
*/ */
static int decode_read3resok(struct xdr_stream *xdr, static int decode_read3resok(struct xdr_stream *xdr,
struct nfs_readres *result) struct nfs_pgio_res *result)
{ {
u32 eof, count, ocount, recvd; u32 eof, count, ocount, recvd;
__be32 *p; __be32 *p;
...@@ -1625,7 +1625,7 @@ static int decode_read3resok(struct xdr_stream *xdr, ...@@ -1625,7 +1625,7 @@ static int decode_read3resok(struct xdr_stream *xdr,
} }
static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_readres *result) struct nfs_pgio_res *result)
{ {
enum nfs_stat status; enum nfs_stat status;
int error; int error;
...@@ -1673,7 +1673,7 @@ static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -1673,7 +1673,7 @@ static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr,
* }; * };
*/ */
static int decode_write3resok(struct xdr_stream *xdr, static int decode_write3resok(struct xdr_stream *xdr,
struct nfs_writeres *result) struct nfs_pgio_res *result)
{ {
__be32 *p; __be32 *p;
...@@ -1697,7 +1697,7 @@ static int decode_write3resok(struct xdr_stream *xdr, ...@@ -1697,7 +1697,7 @@ static int decode_write3resok(struct xdr_stream *xdr,
} }
static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_writeres *result) struct nfs_pgio_res *result)
{ {
enum nfs_stat status; enum nfs_stat status;
int error; int error;
......
...@@ -5087,7 +5087,8 @@ static int decode_putrootfh(struct xdr_stream *xdr) ...@@ -5087,7 +5087,8 @@ static int decode_putrootfh(struct xdr_stream *xdr)
return decode_op_hdr(xdr, OP_PUTROOTFH); return decode_op_hdr(xdr, OP_PUTROOTFH);
} }
static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res) static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req,
struct nfs_pgio_res *res)
{ {
__be32 *p; __be32 *p;
uint32_t count, eof, recvd; uint32_t count, eof, recvd;
...@@ -5341,7 +5342,7 @@ static int decode_setclientid_confirm(struct xdr_stream *xdr) ...@@ -5341,7 +5342,7 @@ static int decode_setclientid_confirm(struct xdr_stream *xdr)
return decode_op_hdr(xdr, OP_SETCLIENTID_CONFIRM); return decode_op_hdr(xdr, OP_SETCLIENTID_CONFIRM);
} }
static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res) static int decode_write(struct xdr_stream *xdr, struct nfs_pgio_res *res)
{ {
__be32 *p; __be32 *p;
int status; int status;
...@@ -6638,7 +6639,7 @@ static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, struct xdr_stream *xdr, ...@@ -6638,7 +6639,7 @@ static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
* Decode Read response * Decode Read response
*/ */
static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr, static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
struct nfs_readres *res) struct nfs_pgio_res *res)
{ {
struct compound_hdr hdr; struct compound_hdr hdr;
int status; int status;
...@@ -6663,7 +6664,7 @@ static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr, ...@@ -6663,7 +6664,7 @@ static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
* Decode WRITE response * Decode WRITE response
*/ */
static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, struct xdr_stream *xdr, static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
struct nfs_writeres *res) struct nfs_pgio_res *res)
{ {
struct compound_hdr hdr; struct compound_hdr hdr;
int status; int status;
......
...@@ -471,7 +471,7 @@ int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data) ...@@ -471,7 +471,7 @@ int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data)
static void nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data) static void nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data)
{ {
struct nfs_pgio_args *argp = &data->args; struct nfs_pgio_args *argp = &data->args;
struct nfs_readres *resp = &data->res; struct nfs_pgio_res *resp = &data->res;
/* This is a short read! */ /* This is a short read! */
nfs_inc_stats(data->header->inode, NFSIOS_SHORTREAD); nfs_inc_stats(data->header->inode, NFSIOS_SHORTREAD);
......
...@@ -1389,7 +1389,7 @@ static int nfs_should_remove_suid(const struct inode *inode) ...@@ -1389,7 +1389,7 @@ static int nfs_should_remove_suid(const struct inode *inode)
void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data) void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
{ {
struct nfs_pgio_args *argp = &data->args; struct nfs_pgio_args *argp = &data->args;
struct nfs_writeres *resp = &data->res; struct nfs_pgio_res *resp = &data->res;
struct inode *inode = data->header->inode; struct inode *inode = data->header->inode;
int status; int status;
......
...@@ -488,16 +488,6 @@ struct nfs4_delegreturnres { ...@@ -488,16 +488,6 @@ struct nfs4_delegreturnres {
const struct nfs_server *server; const struct nfs_server *server;
}; };
/*
* Arguments to the read call.
*/
struct nfs_readres {
struct nfs4_sequence_res seq_res;
struct nfs_fattr * fattr;
__u32 count;
int eof;
};
/* /*
* Arguments to the write call. * Arguments to the write call.
*/ */
...@@ -510,14 +500,6 @@ struct nfs_writeverf { ...@@ -510,14 +500,6 @@ struct nfs_writeverf {
enum nfs3_stable_how committed; enum nfs3_stable_how committed;
}; };
struct nfs_writeres {
struct nfs4_sequence_res seq_res;
struct nfs_fattr * fattr;
struct nfs_writeverf * verf;
__u32 count;
const struct nfs_server *server;
};
/* /*
* Arguments shared by the read and write call. * Arguments shared by the read and write call.
*/ */
...@@ -535,6 +517,16 @@ struct nfs_pgio_args { ...@@ -535,6 +517,16 @@ struct nfs_pgio_args {
enum nfs3_stable_how stable; /* used by write */ enum nfs3_stable_how stable; /* used by write */
}; };
struct nfs_pgio_res {
struct nfs4_sequence_res seq_res;
struct nfs_fattr * fattr;
__u32 count;
int eof; /* used by read */
struct nfs_writeverf * verf; /* used by write */
const struct nfs_server *server; /* used by write */
};
/* /*
* Arguments to the commit call. * Arguments to the commit call.
*/ */
...@@ -1261,7 +1253,7 @@ struct nfs_read_data { ...@@ -1261,7 +1253,7 @@ struct nfs_read_data {
struct rpc_task task; struct rpc_task task;
struct nfs_fattr fattr; /* fattr storage */ struct nfs_fattr fattr; /* fattr storage */
struct nfs_pgio_args args; struct nfs_pgio_args args;
struct nfs_readres res; struct nfs_pgio_res res;
unsigned long timestamp; /* For lease renewal */ unsigned long timestamp; /* For lease renewal */
int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data); int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
__u64 mds_offset; __u64 mds_offset;
...@@ -1313,7 +1305,7 @@ struct nfs_write_data { ...@@ -1313,7 +1305,7 @@ struct nfs_write_data {
struct nfs_fattr fattr; struct nfs_fattr fattr;
struct nfs_writeverf verf; struct nfs_writeverf verf;
struct nfs_pgio_args args; /* argument struct */ struct nfs_pgio_args args; /* argument struct */
struct nfs_writeres res; /* result struct */ struct nfs_pgio_res res; /* result struct */
unsigned long timestamp; /* For lease renewal */ unsigned long timestamp; /* For lease renewal */
int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data); int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
__u64 mds_offset; /* Filelayout dense stripe */ __u64 mds_offset; /* Filelayout dense stripe */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment