aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2005-06-22 13:16:22 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 16:07:11 -0400
commit96928206961be05f22c3839f0097b610cc485b5d (patch)
tree08140ef501c7b675833ed7445c909cb60df59ecf /fs/nfs
parent6b3b5496d7b261d6c9202008dc528e52dbd11e57 (diff)
[PATCH] NFSv4: fix fattr size calculations
Make nfs4 fattr size calculations more explicit, revising them downward a bit in the process. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4xdr.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index e86406eff0eb..8204926bb467 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -83,12 +83,16 @@ static int nfs_stat_to_errno(int);
83#define encode_getfh_maxsz (op_encode_hdr_maxsz) 83#define encode_getfh_maxsz (op_encode_hdr_maxsz)
84#define decode_getfh_maxsz (op_decode_hdr_maxsz + 1 + \ 84#define decode_getfh_maxsz (op_decode_hdr_maxsz + 1 + \
85 ((3+NFS4_FHSIZE) >> 2)) 85 ((3+NFS4_FHSIZE) >> 2))
86#define encode_getattr_maxsz (op_encode_hdr_maxsz + 3) 86#define nfs4_fattr_bitmap_maxsz 3
87#define encode_getattr_maxsz (op_encode_hdr_maxsz + nfs4_fattr_bitmap_maxsz)
87#define nfs4_name_maxsz (1 + ((3 + NFS4_MAXNAMLEN) >> 2)) 88#define nfs4_name_maxsz (1 + ((3 + NFS4_MAXNAMLEN) >> 2))
88#define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2)) 89#define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2))
89#define nfs4_fattr_bitmap_maxsz (36 + 2 * nfs4_name_maxsz) 90/* This is based on getfattr, which uses the most attributes: */
90#define decode_getattr_maxsz (op_decode_hdr_maxsz + 3 + \ 91#define nfs4_fattr_value_maxsz (1 + (1 + 2 + 2 + 4 + 2 + 1 + 1 + 2 + 2 + \
91 nfs4_fattr_bitmap_maxsz) 92 3 + 3 + 3 + 2 * nfs4_name_maxsz))
93#define nfs4_fattr_maxsz (nfs4_fattr_bitmap_maxsz + \
94 nfs4_fattr_value_maxsz)
95#define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz)
92#define encode_savefh_maxsz (op_encode_hdr_maxsz) 96#define encode_savefh_maxsz (op_encode_hdr_maxsz)
93#define decode_savefh_maxsz (op_decode_hdr_maxsz) 97#define decode_savefh_maxsz (op_decode_hdr_maxsz)
94#define encode_fsinfo_maxsz (op_encode_hdr_maxsz + 2) 98#define encode_fsinfo_maxsz (op_encode_hdr_maxsz + 2)
@@ -123,11 +127,11 @@ static int nfs_stat_to_errno(int);
123#define encode_symlink_maxsz (op_encode_hdr_maxsz + \ 127#define encode_symlink_maxsz (op_encode_hdr_maxsz + \
124 1 + nfs4_name_maxsz + \ 128 1 + nfs4_name_maxsz + \
125 nfs4_path_maxsz + \ 129 nfs4_path_maxsz + \
126 nfs4_fattr_bitmap_maxsz) 130 nfs4_fattr_maxsz)
127#define decode_symlink_maxsz (op_decode_hdr_maxsz + 8) 131#define decode_symlink_maxsz (op_decode_hdr_maxsz + 8)
128#define encode_create_maxsz (op_encode_hdr_maxsz + \ 132#define encode_create_maxsz (op_encode_hdr_maxsz + \
129 2 + nfs4_name_maxsz + \ 133 2 + nfs4_name_maxsz + \
130 nfs4_fattr_bitmap_maxsz) 134 nfs4_fattr_maxsz)
131#define decode_create_maxsz (op_decode_hdr_maxsz + 8) 135#define decode_create_maxsz (op_decode_hdr_maxsz + 8)
132#define encode_delegreturn_maxsz (op_encode_hdr_maxsz + 4) 136#define encode_delegreturn_maxsz (op_encode_hdr_maxsz + 4)
133#define decode_delegreturn_maxsz (op_decode_hdr_maxsz) 137#define decode_delegreturn_maxsz (op_decode_hdr_maxsz)
@@ -206,7 +210,7 @@ static int nfs_stat_to_errno(int);
206#define NFS4_enc_setattr_sz (compound_encode_hdr_maxsz + \ 210#define NFS4_enc_setattr_sz (compound_encode_hdr_maxsz + \
207 encode_putfh_maxsz + \ 211 encode_putfh_maxsz + \
208 op_encode_hdr_maxsz + 4 + \ 212 op_encode_hdr_maxsz + 4 + \
209 nfs4_fattr_bitmap_maxsz + \ 213 nfs4_fattr_maxsz + \
210 encode_getattr_maxsz) 214 encode_getattr_maxsz)
211#define NFS4_dec_setattr_sz (compound_decode_hdr_maxsz + \ 215#define NFS4_dec_setattr_sz (compound_decode_hdr_maxsz + \
212 decode_putfh_maxsz + \ 216 decode_putfh_maxsz + \