nfs41-for-2.6.30 cleanup patches
Subsystems (2)
cover nfs41-for-2.6.30 cleanup patches
Trond,
The following cleanup patches address your review comments. They are tested to compile and I'll test them on hardware ASAP. Once ready, I'd like to squash them in to the patchset and resend a new version.
[PATCH 1/7] SQUASHME: nfs41: remove ifdefs around nfs_client_initdata.minorversion [PATCH 2/7] SQUASHME: nfs41: use kcalloc to allocate slot table [PATCH 3/7] SQUASHME: nfs41: alloc session with GFP_KERNEL
[PATCH 4/7] SQUASHME: nfs41: embed resp_len in nfs_getaclres
[PATCH 5/7] SQUASHME: Revert "NFS: fix decode_fs_locations_maxsz" [PATCH 6/7] SQUASHME: nfs41: get fs_locations replen before encoding the GETATTR [PATCH 7/7] SQUASHME: nfs41: get getacl replen before encoding the GETATTR
Other than that I've made the following changes to be included in the next version:
- fixed bisectability issues
- got rid of rpc_clnt.cl_private, use *session in seq args/res instead
- moved nfs4_init_slot_table's definition from "sessions client infrastructure" to first usage, in "create_session operations".
- moved new xdr op args/res definitions away from "client xdr definitions", to where they're first used.
- move find_slot and free_slot closer to where they're first used.
Benny
PATCH 1/7 SQUASHME: nfs41: remove ifdefs around nfs_client_initdata.minorversion
Quoted 3 lines · Trond Myklebust
This is really ugly and unnecessary. Please just remove those ifdefs, and have
clp->cl_minorversiondata->minorversionalways defined, and set to 0.
squash intto "nfs41: Use mount minorversion option"
--- fs/nfs/client.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
fs/nfs/client.c +1 -5
@@ -102,9 +102,7 @@ struct nfs_client_initdata {size_t addrlen;const struct nfs_rpc_ops *rpc_ops;int proto; -#ifdef CONFIG_NFS_V4 u32 minorversion; -#endif };/*
@@ -451,11 +449,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *datif (clp->cl_proto != data->proto)continue ; -#ifdef CONFIG_NFS_V4 -/* Match minorversion */ +/* Match nfsv4 minorversion */ if (clp->cl_minorversion != data->minorversion)continue ; -#endif /* Match the full socket address */ if (!nfs_sockaddr_cmp (sap, clap))continue ;
Signature · 1 line
1.6.2.1
PATCH 2/7 SQUASHME: nfs41: use kcalloc to allocate slot table
In reply to Benny HalevyAlso, change gfp flags to GFP_KERNEL.
FIXME: move nfs4_init_slot_table's definition from "nfs41: sessions client infrastructure" to "nfs41: create_session operation" and squash this patch there.
--- fs/nfs/nfs4proc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +1 -1
@@ -4470,7 +4470,7 @@ static int nfs4_init_slot_table(struct nfs4_slot_table *tbl,dprintk ("--> %s: max_reqs=%u\n" , __func__, max_slots); - slot =kzalloc (max_slots *sizeof (struct nfs4_slot ),GFP_ATOMIC ); + slot =kcalloc (max_slots,sizeof (struct nfs4_slot ),GFP_KERNEL );if (!slot) goto out;for (i =0 ; i < max_slots; ++i)
Signature · 1 line
1.6.2.1
PATCH 3/7 SQUASHME: nfs41: alloc session with GFP_KERNEL
In reply to Benny HalevyNo reason for using GFP_ATOMIC.
--- fs/nfs/nfs4proc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +1 -1
@@ -4525,7 +4525,7 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp)struct nfs4_session *session;struct nfs4_slot_table *tbl; - session =kzalloc (sizeof (struct nfs4_session ),GFP_ATOMIC ); + session =kzalloc (sizeof (struct nfs4_session ),GFP_KERNEL );if (!session)return NULL ;
Signature · 1 line
1.6.2.1
PATCH 4/7 SQUASHME: nfs41: embed resp_len in nfs_getaclres
In reply to Benny HalevyAs per Trond's review comment.
squash into "nfs41: use nfs4_getaclres"
--- fs/nfs/nfs4proc.c | 17 ++++++++--------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-)
fs/nfs/nfs4proc.c +8 -9
@@ -3192,14 +3192,13 @@ out:static ssize_t __nfs4_get_acl_uncached (struct inode *inode,void *buf,size_t buflen) {struct page *pages[NFS4ACL_MAXPAGES ]; -size_t resp_len = buflen;struct nfs_getaclargs args = { .fh =NFS_FH (inode), .acl_pages = pages, .acl_len = buflen, };struct nfs_getaclres res = { - .acl_len = &resp_len, + .acl_len = buflen, };void *resp_buf;struct rpc_message msg = {
@@ -3219,7 +3218,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bureturn -ENOMEM ; args.acl_pages[0 ] = localpage; args.acl_pgbase =0 ; - resp_len = args.acl_len =PAGE_SIZE ; + args.acl_len =PAGE_SIZE ; }else { resp_buf = buf;buf_to_pages (buf, buflen, args.acl_pages, &args.acl_pgbase);
@@ -3227,18 +3226,18 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu ret =nfs4_call_sync (NFS_SERVER (inode), &msg, &args, &res,0 );if (ret) goto out_free; -if (resp_len > args.acl_len) -nfs4_write_cached_acl (inode,NULL , resp_len); +if (res.acl_len > args.acl_len) +nfs4_write_cached_acl (inode,NULL , res.acl_len);else -nfs4_write_cached_acl (inode, resp_buf, resp_len); +nfs4_write_cached_acl (inode, resp_buf, res.acl_len);if (buf) { ret = -ERANGE ; -if (resp_len > buflen) +if (res.acl_len > buflen) goto out_free;if (localpage) -memcpy (buf, resp_buf, resp_len); +memcpy (buf, resp_buf, res.acl_len); } - ret = resp_len; + ret = res.acl_len; out_free:if (localpage)__free_page (localpage);
fs/nfs/nfs4xdr.c +1 -1
@@ -4599,7 +4599,7 @@ nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, __be32 *p, status =decode_putfh (&xdr);if (status) goto out; - status =decode_getacl (&xdr, rqstp, res->acl_len); + status =decode_getacl (&xdr, rqstp, &res->acl_len); out:return status;
include/linux/nfs_xdr.h +1 -1
@@ -431,7 +431,7 @@ struct nfs_getaclargs { };struct nfs_getaclres { -size_t *acl_len; +size_t acl_len;struct nfs4_sequence_res seq_res; };
Signature · 1 line
1.6.2.1
PATCH 5/7 SQUASHME: Revert "NFS: fix decode_fs_locations_maxsz"
In reply to Benny HalevyThis reverts commit d3a269cdeb581e688dce0eab4684fbe294b99b93.
Conflicts:
fs/nfs/nfs4xdr.c
--- fs/nfs/nfs4xdr.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/nfs4xdr.c +1 -1
@@ -243,7 +243,7 @@ static int nfs4_stat_to_errno(int);#define encode_fs_locations_maxsz \ (encode_getattr_maxsz)#define decode_fs_locations_maxsz \ - (decode_getattr_maxsz) + (0)#if defined(CONFIG_NFS_V4_1 )#define NFS4_MAX_MACHINE_NAME_LEN (64)
Signature · 1 line
1.6.2.1
PATCH 6/7 SQUASHME: nfs41: get fs_locations replen before encoding the GETATTR
In reply to Benny Halevysquash into "NFS: use dynamically computed compound_hdr.replen for xdr_inline_pages offset"
--- fs/nfs/nfs4xdr.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
fs/nfs/nfs4xdr.c +3 -1
@@ -2356,15 +2356,17 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfsstruct compound_hdr hdr = { .minorversion =nfs4_xdr_minorversion (&args->seq_args), }; +uint32_t replen;xdr_init_encode (&xdr, &req->rq_snd_buf, p);encode_compound_hdr (&xdr, req, &hdr);encode_sequence (&xdr, &args->seq_args, &hdr);encode_putfh (&xdr, args->dir_fh, &hdr);encode_lookup (&xdr, args->name, &hdr); + replen = hdr.replen;/* get the attribute into args->page */ encode_fs_locations (&xdr, args->bitmask, &hdr); -xdr_inline_pages (&req->rq_rcv_buf, hdr.replen <<2 , &args->page, +xdr_inline_pages (&req->rq_rcv_buf, replen <<2 , &args->page,0 ,PAGE_SIZE );encode_nops (&hdr);return 0 ;
Signature · 1 line
1.6.2.1
PATCH 7/7 SQUASHME: nfs41: get getacl replen before encoding the GETATTR
In reply to Benny Halevysquash into "NFS: use dynamically computed compound_hdr.replen for xdr_inline_pages offset"
--- fs/nfs/nfs4xdr.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
fs/nfs/nfs4xdr.c +3 -1
@@ -2137,14 +2137,16 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,struct compound_hdr hdr = { .minorversion =nfs4_xdr_minorversion (&args->seq_args), }; +uint32_t replen;xdr_init_encode (&xdr, &req->rq_snd_buf, p);encode_compound_hdr (&xdr, req, &hdr);encode_sequence (&xdr, &args->seq_args, &hdr);encode_putfh (&xdr, args->fh, &hdr); + replen = hdr.replen + nfs4_fattr_bitmap_maxsz +1 ;encode_getattr_two (&xdr,FATTR4_WORD0_ACL ,0 , &hdr); -xdr_inline_pages (&req->rq_rcv_buf, hdr.replen <<2 , +xdr_inline_pages (&req->rq_rcv_buf, replen <<2 , args->acl_pages, args->acl_pgbase, args->acl_len);encode_nops (&hdr);return 0 ;
Signature · 1 line
1.6.2.1