NFS: Add v4.2 SEEK support
Subsystems (2)
PATCH 1/1 NFS: Add v4.2 SEEK support
This patch adds support for the NFS v4.2 operation SEEK.
I think nfs4proc.c and nfs4xdr.c have grown out of control, and I would like to avoid adding new functions to these files unless absolutely necessary. Therefore, I created nfs4.2proc.c and nfs4.2xdr.h in an attempt to separate out the new code.
Questions? Comments? Thoughts?
Anna
Anna Schumaker (1):
NFS: Implement SEEK
fs/nfs/Makefile | 1 + fs/nfs/inode.c | 2 + fs/nfs/nfs4.2.h | 14 +++++++ fs/nfs/nfs4.2proc.c | 39 +++++++++++++++++++ fs/nfs/nfs4.2xdr.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4_fs.h | 7 ++++ fs/nfs/nfs4client.c | 2 + fs/nfs/nfs4file.c | 68 ++++++++++++++++++++++++++++++++ fs/nfs/nfs4proc.c | 1 - fs/nfs/nfs4xdr.c | 7 ++++ fs/nfsd/nfs4proc.c | 2 +- include/linux/nfs4.h | 3 ++ include/linux/nfs_fs_sb.h | 1 + include/linux/nfs_xdr.h | 19 +++++++++ 14 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 fs/nfs/nfs4.2.h create mode 100644 fs/nfs/nfs4.2proc.c create mode 100644 fs/nfs/nfs4.2xdr.h
Signature · 1 line
2.1.0
PATCH 1/1 NFS: Implement SEEK
From: Anna Schumaker <[email protected]>
The SEEK operation is used when an application makes an lseek call with either the SEEK_HOLE or SEEK_DATA flags set. I fall back on nfs_file_llseek() if the server does not have SEEK support.
--- fs/nfs/Makefile | 1 + fs/nfs/inode.c | 2 + fs/nfs/nfs4.2.h | 14 +++++++ fs/nfs/nfs4.2proc.c | 39 +++++++++++++++++++ fs/nfs/nfs4.2xdr.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4_fs.h | 7 ++++ fs/nfs/nfs4client.c | 2 + fs/nfs/nfs4file.c | 68 ++++++++++++++++++++++++++++++++ fs/nfs/nfs4proc.c | 1 - fs/nfs/nfs4xdr.c | 7 ++++ fs/nfsd/nfs4proc.c | 2 +- include/linux/nfs4.h | 3 ++ include/linux/nfs_fs_sb.h | 1 + include/linux/nfs_xdr.h | 19 +++++++++ 14 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 fs/nfs/nfs4.2.h create mode 100644 fs/nfs/nfs4.2proc.c create mode 100644 fs/nfs/nfs4.2xdr.h
fs/nfs/Makefile +1 -0
@@ -28,6 +28,7 @@ nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o nfsv4-$(CONFIG_SYSCTL) += nfs4sysctl.o nfsv4-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o +nfsv4-$(CONFIG_NFS_V4_2) += nfs4.2proc.o obj-$(CONFIG_PNFS_FILE_LAYOUT) += filelayout/ obj-$(CONFIG_PNFS_OBJLAYOUT) += objlayout/
fs/nfs/inode.c +2 -0
@@ -716,6 +716,7 @@ struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx)kfree (new);return res; } +EXPORT_SYMBOL_GPL (nfs_get_lock_context);void nfs_put_lock_context (struct nfs_lock_context *l_ctx) {
@@ -728,6 +729,7 @@ void nfs_put_lock_context(struct nfs_lock_context *l_ctx)spin_unlock (&inode->i_lock);kfree (l_ctx); } +EXPORT_SYMBOL_GPL (nfs_put_lock_context);/** * nfs_close_context - Common close_context() routine NFSv2/v3
fs/nfs/nfs4.2.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* Copyright (c) 2014 Anna Schumaker <Anna.Schumaker@Netapp> +*/ + +#ifndef __LINUX_FS_NFS_NFS4_2_H +#define __LINUX_FS_NFS_NFS4_2_H + +/* nfs4.2proc.c */ +loff_t nfs42_proc_llseek (struct inode *,nfs4_stateid *,loff_t ,int ); + +/* nfs4.2xdr.h */ +extern struct rpc_procinfo nfs4_2_procedures[]; + +#endif /* __LINUX_FS_NFS_NFS4_2_H */
fs/nfs/nfs4.2proc.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Copyright (c) 2014 Anna Schumaker <Anna.Schumaker@Netapp> +*/ +#include <linux/fs.h> +#include <linux/sunrpc/sched.h> +#include <linux/nfs.h> +#include <linux/nfs3.h> +#include <linux/nfs4.h> +#include <linux/nfs_xdr.h> +#include <linux/nfs_fs.h> +#include "nfs4_fs.h" +#include "nfs4.2.h" + + +loff_t nfs42_proc_llseek (struct inode *inode,nfs4_stateid *stateid, +loff_t offset,int whence) +{ +struct nfs42_seek_args args = { + .sa_fh =NFS_FH (inode), + .sa_stateid = stateid, + .sa_offset = offset, + .sa_what = (whence ==SEEK_HOLE ) ? +NFS4_CONTENT_HOLE :NFS4_CONTENT_DATA , + }; +struct nfs42_seek_res res; +struct rpc_message msg = { + .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SEEK ], + .rpc_argp = &args, + .rpc_resp = &res, + }; +struct nfs_server *server =NFS_SERVER (inode); +int status; + + status =nfs4_call_sync (server->client, server, &msg, + &args.seq_args, &res.seq_res,0 ); +if (status) +return status; +return res.sr_offset; +}
fs/nfs/nfs4.2xdr.h new file +98 -0
98 lines not on this page · raw message
fs/nfs/nfs4_fs.h +7 -0
@@ -227,6 +227,9 @@ int nfs4_replace_transport(struct nfs_server *server, const struct nfs4_fs_locations *locations);/* nfs4proc.c */ +extern int nfs4_call_sync (struct rpc_clnt *,struct nfs_server *, +struct rpc_message *,struct nfs4_sequence_args *, +struct nfs4_sequence_res *,int );extern int nfs4_proc_setclientid (struct nfs_client *,u32 ,unsigned short ,struct rpc_cred *,struct nfs4_setclientid_res *);extern int nfs4_proc_setclientid_confirm (struct nfs_client *,struct nfs4_setclientid_res *arg,struct rpc_cred *);extern int nfs4_proc_get_rootfh (struct nfs_server *,struct nfs_fh *,struct nfs_fsinfo *,bool );
@@ -364,6 +367,10 @@ nfs4_state_protect_write(struct nfs_client *clp, struct rpc_clnt **clntp, }#endif /* CONFIG_NFS_V4_1 */ +#ifdef CONFIG_NFS_V4_2 +loff_t nfs42_proc_llseek (struct inode *,nfs4_stateid *,loff_t ,int ); +#endif /* CONFIG_NFS_V4_2 */ +extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[];extern const u32 nfs4_fattr_bitmap[3 ];
fs/nfs/nfs4client.c +2 -0
@@ -931,6 +931,8 @@ static int nfs4_server_common_setup(struct nfs_server *server, server->client->cl_auth->au_flavor == RPC_AUTH_UNIX) server->caps |= NFS_CAP_UIDGID_NOMAP; +if (server->nfs_client->cl_minorversion >=2 ) + server->caps |=NFS_CAP_SEEK ;/* Probe the root fh to retrieve its FSID and filehandle */ error =nfs4_get_rootfh (server, mntfh, auth_probe);
fs/nfs/nfs4file.c +68 -0
82 lines not on this page · raw message
fs/nfs/nfs4proc.c +0 -1
@@ -875,7 +875,6 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,return ret; } -static int nfs4_call_sync(struct rpc_clnt *clnt, struct nfs_server *server, struct rpc_message *msg,
fs/nfs/nfs4xdr.c +7 -0
@@ -7427,6 +7427,10 @@ nfs4_stat_to_errno(int stat)return -stat; } +#if defined(CONFIG_NFS_V4_2 ) +#include "nfs4.2xdr.h" +#endif /* CONFIG_NFS_V4_2 */ +#define PROC (proc, argtype, restype) \ [NFSPROC4_CLNT_##proc] = { \ .p_proc = NFSPROC4_COMPOUND, \
@@ -7495,6 +7499,9 @@ struct rpc_procinfo nfs4_procedures[] = { enc_bind_conn_to_session, dec_bind_conn_to_session), PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid),#endif /* CONFIG_NFS_V4_1 */ +#if defined(CONFIG_NFS_V4_2 ) + PROC(SEEK, enc_seek, dec_seek), +#endif /* CONFIG_NFS_V4_2 */ };const struct rpc_version nfs_version4 = {
fs/nfsd/nfs4proc.c +1 -1
@@ -1019,7 +1019,7 @@ nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_seek *seek) {struct file *file; -__be32 status = nfs_ok; +__be32 status; status = nfs4_preprocess_stateid_op(SVC_NET(rqstp), cstate, &seek->seek_stateid,
include/linux/nfs4.h +3 -0
@@ -487,6 +487,9 @@ enum {NFSPROC4_CLNT_GETDEVICELIST ,NFSPROC4_CLNT_BIND_CONN_TO_SESSION ,NFSPROC4_CLNT_DESTROY_CLIENTID , + +/* nfs42 */ + NFSPROC4_CLNT_SEEK, };/* nfs41 types */
include/linux/nfs_fs_sb.h +1 -0
@@ -230,5 +230,6 @@ struct nfs_server {#define NFS_CAP_STATEID_NFSV41 (1U << 16)#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)#define NFS_CAP_SECURITY_LABEL (1U << 18) +#define NFS_CAP_SEEK (1U << 19)#endif
include/linux/nfs_xdr.h +19 -0
@@ -1239,6 +1239,25 @@ struct pnfs_ds_commit_info {#endif /* CONFIG_NFS_V4_1 */ +#ifdef CONFIG_NFS_V4_2 +struct nfs42_seek_args { +struct nfs4_sequence_args seq_args; + +struct nfs_fh *sa_fh; +nfs4_stateid *sa_stateid; +u64 sa_offset; +u32 sa_what; +}; + +struct nfs42_seek_res { +struct nfs4_sequence_res seq_res; +unsigned int status; + +u32 sr_eof; +u64 sr_offset; +}; +#endif +struct nfs_page ;#define NFS_PAGEVEC_SIZE (8U)
Signature · 1 line
2.1.0
Hi Anna,
Do you have a git tree that I can use to build your latest NFSv4.2 changes?
Thanks, Marc.
From: Anna Schumaker <[email protected]> To: <[email protected]>, <[email protected]>, Date: 08/27/2014 08:19 AM Subject: [PATCH] NFS: Add v4.2 SEEK support Sent by: [email protected]
This patch adds support for the NFS v4.2 operation SEEK.
I think nfs4proc.c and nfs4xdr.c have grown out of control, and I would like
to avoid adding new functions to these files unless absolutely necessary. Therefore, I created nfs4.2proc.c and nfs4.2xdr.h in an attempt to separate
out the new code.
Questions? Comments? Thoughts?
Anna
Anna Schumaker (1):
NFS: Implement SEEK
fs/nfs/Makefile | 1 + fs/nfs/inode.c | 2 + fs/nfs/nfs4.2.h | 14 +++++++ fs/nfs/nfs4.2proc.c | 39 +++++++++++++++++++ fs/nfs/nfs4.2xdr.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4_fs.h | 7 ++++ fs/nfs/nfs4client.c | 2 + fs/nfs/nfs4file.c | 68 ++++++++++++++++++++++++++++++++ fs/nfs/nfs4proc.c | 1 - fs/nfs/nfs4xdr.c | 7 ++++ fs/nfsd/nfs4proc.c | 2 +- include/linux/nfs4.h | 3 ++ include/linux/nfs_fs_sb.h | 1 + include/linux/nfs_xdr.h | 19 +++++++++ 14 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 fs/nfs/nfs4.2.h create mode 100644 fs/nfs/nfs4.2proc.c create mode 100644 fs/nfs/nfs4.2xdr.h
Signature · 6 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Anna Schumaker
This patch adds support for the NFS v4.2 operation SEEK.
I think
nfs4proc.candnfs4xdr.chave grown out of control, and I would like to avoid adding new functions to these files unless absolutely necessary. Therefore, I creatednfs4.2proc.candnfs4.2xdr.hin an attempt to separate out the new code.Questions? Comments? Thoughts?
I hate the dot in the name :) why not nfs42proc.c and co?
Also without splitting out the much larger 4.1 ops this seems a bit pointless, although I generally like the idea.
Quoted 3 lines · Marc Eshel
Hi Anna,
Do you have a git tree that I can use to build your latest NFSv4.2 changes?
Not at the moment, but I can make one!
Anna
Quoted 49 lines
Thanks, Marc.
From: Anna Schumaker <[email protected]> To: <[email protected]>, <[email protected]>, Date: 08/27/2014 08:19 AM Subject: [PATCH] NFS: Add v4.2 SEEK support Sent by: [email protected]This patch adds support for the NFS v4.2 operation SEEK.
I think
nfs4proc.candnfs4xdr.chave grown out of control, and I would like
to avoid adding new functions to these files unless absolutely necessary. Therefore, I creatednfs4.2proc.candnfs4.2xdr.hin an attempt to separate
out the new code.Questions? Comments? Thoughts?
Anna
Anna Schumaker (1):
NFS: Implement SEEKfs/nfs/Makefile | 1 + fs/nfs/inode.c | 2 + fs/nfs/nfs4.2.h | 14 +++++++ fs/nfs/nfs4.2proc.c | 39 +++++++++++++++++++ fs/nfs/nfs4.2xdr.h | 98 +++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4_fs.h | 7 ++++ fs/nfs/nfs4client.c | 2 + fs/nfs/nfs4file.c | 68 ++++++++++++++++++++++++++++++++ fs/nfs/nfs4proc.c | 1 - fs/nfs/nfs4xdr.c | 7 ++++ fs/nfsd/nfs4proc.c | 2 +- include/linux/nfs4.h | 3 ++ include/linux/nfs_fs_sb.h | 1 + include/linux/nfs_xdr.h | 19 +++++++++ 14 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 fs/nfs/nfs4.2.h create mode 100644 fs/nfs/nfs4.2proc.c create mode 100644 fs/nfs/nfs4.2xdr.h
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Anna Schumaker
This patch adds support for the NFS v4.2 operation SEEK.
I think
nfs4proc.candnfs4xdr.chave grown out of control, and I would like to avoid adding new functions to these files unless absolutely necessary. Therefore, I creatednfs4.2proc.candnfs4.2xdr.hin an attempt to separate out the new code.Questions? Comments? Thoughts?
I hate the dot in the name :) why not
nfs42proc.cand co?
Sure, I can change that. I put the dot because I kept reading it "fourty-two" and now "four two".
Quoted 3 lines
Also without splitting out the much larger 4.1 ops this seems a bit pointless, although I generally like the idea.
Oh, but I want to split those out too :D. I figured it would be easiest to come up with a solution now, when we're adding a new minor version, and then split out v4.1 once we know what we're doing.
Anna
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html