Skip to content

Commit 830b8e3

Browse files
Manoj NaikTrond Myklebust
authored andcommitted
NFSv4: Define an fs_locations bitmap
This is (similar to getattr bitmap) but includes fs_locations and mounted_on_fileid attributes. Use this bitmap for encoding in fs_locations requests. Note: We can probably do better by requesting locations as part of fsinfo itself. Signed-off-by: Manoj Naik <manoj@almaden.ibm.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 361e624 commit 830b8e3

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

fs/nfs/nfs4_fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ extern const u32 nfs4_fattr_bitmap[2];
228228
extern const u32 nfs4_statfs_bitmap[2];
229229
extern const u32 nfs4_pathconf_bitmap[2];
230230
extern const u32 nfs4_fsinfo_bitmap[2];
231+
extern const u32 nfs4_fs_locations_bitmap[2];
231232

232233
/* nfs4renewd.c */
233234
extern void nfs4_schedule_state_renewal(struct nfs4_client *);

fs/nfs/nfs4proc.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,25 @@ const u32 nfs4_fsinfo_bitmap[2] = { FATTR4_WORD0_MAXFILESIZE
121121
0
122122
};
123123

124+
const u32 nfs4_fs_locations_bitmap[2] = {
125+
FATTR4_WORD0_TYPE
126+
| FATTR4_WORD0_CHANGE
127+
| FATTR4_WORD0_SIZE
128+
| FATTR4_WORD0_FSID
129+
| FATTR4_WORD0_FILEID
130+
| FATTR4_WORD0_FS_LOCATIONS,
131+
FATTR4_WORD1_MODE
132+
| FATTR4_WORD1_NUMLINKS
133+
| FATTR4_WORD1_OWNER
134+
| FATTR4_WORD1_OWNER_GROUP
135+
| FATTR4_WORD1_RAWDEV
136+
| FATTR4_WORD1_SPACE_USED
137+
| FATTR4_WORD1_TIME_ACCESS
138+
| FATTR4_WORD1_TIME_METADATA
139+
| FATTR4_WORD1_TIME_MODIFY
140+
| FATTR4_WORD1_MOUNTED_ON_FILEID
141+
};
142+
124143
static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry,
125144
struct nfs4_readdir_arg *readdir)
126145
{
@@ -3594,6 +3613,7 @@ int nfs4_proc_fs_locations(struct inode *dir, struct dentry *dentry,
35943613
dprintk("%s: start\n", __FUNCTION__);
35953614
fs_locations->fattr.valid = 0;
35963615
fs_locations->server = server;
3616+
fs_locations->nlocations = 0;
35973617
status = rpc_call_sync(server->client, &msg, 0);
35983618
dprintk("%s: returned status = %d\n", __FUNCTION__, status);
35993619
return status;

fs/nfs/nfs4xdr.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,13 @@ static int encode_fsinfo(struct xdr_stream *xdr, const u32* bitmask)
731731
bitmask[1] & nfs4_fsinfo_bitmap[1]);
732732
}
733733

734+
static int encode_fs_locations(struct xdr_stream *xdr, const u32* bitmask)
735+
{
736+
return encode_getattr_two(xdr,
737+
bitmask[0] & nfs4_fs_locations_bitmap[0],
738+
bitmask[1] & nfs4_fs_locations_bitmap[1]);
739+
}
740+
734741
static int encode_getfh(struct xdr_stream *xdr)
735742
{
736743
uint32_t *p;
@@ -2030,10 +2037,10 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, uint32_t *p, struct n
20302037
goto out;
20312038
if ((status = encode_lookup(&xdr, args->name)) != 0)
20322039
goto out;
2033-
if ((status = encode_getfattr(&xdr, args->bitmask)) != 0)
2040+
if ((status = encode_fs_locations(&xdr, args->bitmask)) != 0)
20342041
goto out;
20352042
/* set up reply
2036-
* toplevel_status + taglen + rescount + OP_PUTFH + status
2043+
* toplevel_status + OP_PUTFH + status
20372044
* + OP_LOOKUP + status + OP_GETATTR + status = 7
20382045
*/
20392046
replen = (RPC_REPHDRSIZE + auth->au_rslack + 7) << 2;

0 commit comments

Comments
 (0)