diff options
author | David Quigley <dpquigl@davequigley.com> | 2013-05-22 12:50:41 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-06-08 16:20:14 -0400 |
commit | a09df2ca2313fd49f0f3e1f2caa546bcacf7b6df (patch) | |
tree | a928093ccb8d0def9ced381de12fbc276af57f53 | |
parent | e058f70b8070608fedfd3e39c2ead935beecb552 (diff) |
NFSv4: Extend fattr bitmaps to support all 3 words
The fattr handling bitmap code only uses the first two fattr words sofar. This
patch adds the 3rd word to being sent but doesn't populate it yet.
Signed-off-by: Miguel Rodel Felipe <Rodel_FM@dsi.a-star.edu.sg>
Signed-off-by: Phua Eu Gene <PHUA_Eu_Gene@dsi.a-star.edu.sg>
Signed-off-by: Khin Mi Mi Aung <Mi_Mi_AUNG@dsi.a-star.edu.sg>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4_fs.h | 6 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 10 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 20 | ||||
-rw-r--r-- | fs/nfs/super.c | 1 | ||||
-rw-r--r-- | include/linux/nfs_fs_sb.h | 2 |
5 files changed, 22 insertions, 17 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index a1dd768d0a35..283fd284bdb8 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -303,10 +303,10 @@ is_ds_client(struct nfs_client *clp) | |||
303 | extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[]; | 303 | extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[]; |
304 | 304 | ||
305 | extern const u32 nfs4_fattr_bitmap[3]; | 305 | extern const u32 nfs4_fattr_bitmap[3]; |
306 | extern const u32 nfs4_statfs_bitmap[2]; | 306 | extern const u32 nfs4_statfs_bitmap[3]; |
307 | extern const u32 nfs4_pathconf_bitmap[2]; | 307 | extern const u32 nfs4_pathconf_bitmap[3]; |
308 | extern const u32 nfs4_fsinfo_bitmap[3]; | 308 | extern const u32 nfs4_fsinfo_bitmap[3]; |
309 | extern const u32 nfs4_fs_locations_bitmap[2]; | 309 | extern const u32 nfs4_fs_locations_bitmap[3]; |
310 | 310 | ||
311 | void nfs4_free_client(struct nfs_client *); | 311 | void nfs4_free_client(struct nfs_client *); |
312 | 312 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index abf46f4b5d19..bcf60f15213c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -161,7 +161,7 @@ static const u32 nfs4_open_noattr_bitmap[3] = { | |||
161 | | FATTR4_WORD0_FILEID, | 161 | | FATTR4_WORD0_FILEID, |
162 | }; | 162 | }; |
163 | 163 | ||
164 | const u32 nfs4_statfs_bitmap[2] = { | 164 | const u32 nfs4_statfs_bitmap[3] = { |
165 | FATTR4_WORD0_FILES_AVAIL | 165 | FATTR4_WORD0_FILES_AVAIL |
166 | | FATTR4_WORD0_FILES_FREE | 166 | | FATTR4_WORD0_FILES_FREE |
167 | | FATTR4_WORD0_FILES_TOTAL, | 167 | | FATTR4_WORD0_FILES_TOTAL, |
@@ -170,7 +170,7 @@ const u32 nfs4_statfs_bitmap[2] = { | |||
170 | | FATTR4_WORD1_SPACE_TOTAL | 170 | | FATTR4_WORD1_SPACE_TOTAL |
171 | }; | 171 | }; |
172 | 172 | ||
173 | const u32 nfs4_pathconf_bitmap[2] = { | 173 | const u32 nfs4_pathconf_bitmap[3] = { |
174 | FATTR4_WORD0_MAXLINK | 174 | FATTR4_WORD0_MAXLINK |
175 | | FATTR4_WORD0_MAXNAME, | 175 | | FATTR4_WORD0_MAXNAME, |
176 | 0 | 176 | 0 |
@@ -185,7 +185,7 @@ const u32 nfs4_fsinfo_bitmap[3] = { FATTR4_WORD0_MAXFILESIZE | |||
185 | FATTR4_WORD2_LAYOUT_BLKSIZE | 185 | FATTR4_WORD2_LAYOUT_BLKSIZE |
186 | }; | 186 | }; |
187 | 187 | ||
188 | const u32 nfs4_fs_locations_bitmap[2] = { | 188 | const u32 nfs4_fs_locations_bitmap[3] = { |
189 | FATTR4_WORD0_TYPE | 189 | FATTR4_WORD0_TYPE |
190 | | FATTR4_WORD0_CHANGE | 190 | | FATTR4_WORD0_CHANGE |
191 | | FATTR4_WORD0_SIZE | 191 | | FATTR4_WORD0_SIZE |
@@ -201,7 +201,7 @@ const u32 nfs4_fs_locations_bitmap[2] = { | |||
201 | | FATTR4_WORD1_TIME_ACCESS | 201 | | FATTR4_WORD1_TIME_ACCESS |
202 | | FATTR4_WORD1_TIME_METADATA | 202 | | FATTR4_WORD1_TIME_METADATA |
203 | | FATTR4_WORD1_TIME_MODIFY | 203 | | FATTR4_WORD1_TIME_MODIFY |
204 | | FATTR4_WORD1_MOUNTED_ON_FILEID | 204 | | FATTR4_WORD1_MOUNTED_ON_FILEID, |
205 | }; | 205 | }; |
206 | 206 | ||
207 | static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dentry, | 207 | static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dentry, |
@@ -5318,7 +5318,7 @@ static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir, | |||
5318 | struct page *page) | 5318 | struct page *page) |
5319 | { | 5319 | { |
5320 | struct nfs_server *server = NFS_SERVER(dir); | 5320 | struct nfs_server *server = NFS_SERVER(dir); |
5321 | u32 bitmask[2] = { | 5321 | u32 bitmask[3] = { |
5322 | [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS, | 5322 | [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS, |
5323 | }; | 5323 | }; |
5324 | struct nfs4_fs_locations_arg args = { | 5324 | struct nfs4_fs_locations_arg args = { |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 4be8d135ed61..727cfe080eae 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -979,15 +979,16 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const | |||
979 | int len; | 979 | int len; |
980 | uint32_t bmval0 = 0; | 980 | uint32_t bmval0 = 0; |
981 | uint32_t bmval1 = 0; | 981 | uint32_t bmval1 = 0; |
982 | uint32_t bmval2 = 0; | ||
982 | 983 | ||
983 | /* | 984 | /* |
984 | * We reserve enough space to write the entire attribute buffer at once. | 985 | * We reserve enough space to write the entire attribute buffer at once. |
985 | * In the worst-case, this would be | 986 | * In the worst-case, this would be |
986 | * 12(bitmap) + 4(attrlen) + 8(size) + 4(mode) + 4(atime) + 4(mtime) | 987 | * 16(bitmap) + 4(attrlen) + 8(size) + 4(mode) + 4(atime) + 4(mtime) |
987 | * = 36 bytes, plus any contribution from variable-length fields | 988 | * = 40 bytes, plus any contribution from variable-length fields |
988 | * such as owner/group. | 989 | * such as owner/group. |
989 | */ | 990 | */ |
990 | len = 16; | 991 | len = 20; |
991 | 992 | ||
992 | /* Sigh */ | 993 | /* Sigh */ |
993 | if (iap->ia_valid & ATTR_SIZE) | 994 | if (iap->ia_valid & ATTR_SIZE) |
@@ -1031,9 +1032,9 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const | |||
1031 | * We write the bitmap length now, but leave the bitmap and the attribute | 1032 | * We write the bitmap length now, but leave the bitmap and the attribute |
1032 | * buffer length to be backfilled at the end of this routine. | 1033 | * buffer length to be backfilled at the end of this routine. |
1033 | */ | 1034 | */ |
1034 | *p++ = cpu_to_be32(2); | 1035 | *p++ = cpu_to_be32(3); |
1035 | q = p; | 1036 | q = p; |
1036 | p += 3; | 1037 | p += 4; |
1037 | 1038 | ||
1038 | if (iap->ia_valid & ATTR_SIZE) { | 1039 | if (iap->ia_valid & ATTR_SIZE) { |
1039 | bmval0 |= FATTR4_WORD0_SIZE; | 1040 | bmval0 |= FATTR4_WORD0_SIZE; |
@@ -1080,9 +1081,10 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const | |||
1080 | len, ((char *)p - (char *)q) + 4); | 1081 | len, ((char *)p - (char *)q) + 4); |
1081 | BUG(); | 1082 | BUG(); |
1082 | } | 1083 | } |
1083 | len = (char *)p - (char *)q - 12; | 1084 | len = (char *)p - (char *)q - 16; |
1084 | *q++ = htonl(bmval0); | 1085 | *q++ = htonl(bmval0); |
1085 | *q++ = htonl(bmval1); | 1086 | *q++ = htonl(bmval1); |
1087 | *q++ = htonl(bmval2); | ||
1086 | *q = htonl(len); | 1088 | *q = htonl(len); |
1087 | 1089 | ||
1088 | /* out: */ | 1090 | /* out: */ |
@@ -1188,8 +1190,10 @@ encode_getattr_three(struct xdr_stream *xdr, | |||
1188 | 1190 | ||
1189 | static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) | 1191 | static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) |
1190 | { | 1192 | { |
1191 | encode_getattr_two(xdr, bitmask[0] & nfs4_fattr_bitmap[0], | 1193 | encode_getattr_three(xdr, bitmask[0] & nfs4_fattr_bitmap[0], |
1192 | bitmask[1] & nfs4_fattr_bitmap[1], hdr); | 1194 | bitmask[1] & nfs4_fattr_bitmap[1], |
1195 | bitmask[2] & nfs4_fattr_bitmap[2], | ||
1196 | hdr); | ||
1193 | } | 1197 | } |
1194 | 1198 | ||
1195 | static void encode_getfattr_open(struct xdr_stream *xdr, const u32 *bitmask, | 1199 | static void encode_getfattr_open(struct xdr_stream *xdr, const u32 *bitmask, |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 2e94f2168b03..b30c003b47d1 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -833,6 +833,7 @@ int nfs_show_stats(struct seq_file *m, struct dentry *root) | |||
833 | seq_printf(m, "\n\tnfsv4:\t"); | 833 | seq_printf(m, "\n\tnfsv4:\t"); |
834 | seq_printf(m, "bm0=0x%x", nfss->attr_bitmask[0]); | 834 | seq_printf(m, "bm0=0x%x", nfss->attr_bitmask[0]); |
835 | seq_printf(m, ",bm1=0x%x", nfss->attr_bitmask[1]); | 835 | seq_printf(m, ",bm1=0x%x", nfss->attr_bitmask[1]); |
836 | seq_printf(m, ",bm2=0x%x", nfss->attr_bitmask[2]); | ||
836 | seq_printf(m, ",acl=0x%x", nfss->acl_bitmask); | 837 | seq_printf(m, ",acl=0x%x", nfss->acl_bitmask); |
837 | show_sessions(m, nfss); | 838 | show_sessions(m, nfss); |
838 | show_pnfs(m, nfss); | 839 | show_pnfs(m, nfss); |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 2ddd00a0848e..d4348ab1e0e4 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -146,7 +146,7 @@ struct nfs_server { | |||
146 | u32 attr_bitmask[3];/* V4 bitmask representing the set | 146 | u32 attr_bitmask[3];/* V4 bitmask representing the set |
147 | of attributes supported on this | 147 | of attributes supported on this |
148 | filesystem */ | 148 | filesystem */ |
149 | u32 cache_consistency_bitmask[2]; | 149 | u32 cache_consistency_bitmask[3]; |
150 | /* V4 bitmask representing the subset | 150 | /* V4 bitmask representing the subset |
151 | of change attribute, size, ctime | 151 | of change attribute, size, ctime |
152 | and mtime attributes supported by | 152 | and mtime attributes supported by |