diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-06-24 01:02:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:06:27 -0400 |
commit | 52f4fb43063c182f3ef7e257ab336a8be8066bb0 (patch) | |
tree | f7e551168995e5210a0706fb273f6c54ba6bffef | |
parent | 0c0a400d1debb172c596b24ab82efab4975990a9 (diff) |
[PATCH] nfsd4: find_delegation_file()
Factor out a bit of common code that will be useful elsewhere.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/nfsd/nfs4state.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 75e8b137580c..bb95275e7bae 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1526,6 +1526,18 @@ out: | |||
1526 | return status; | 1526 | return status; |
1527 | } | 1527 | } |
1528 | 1528 | ||
1529 | static struct nfs4_delegation * | ||
1530 | find_delegation_file(struct nfs4_file *fp, stateid_t *stid) | ||
1531 | { | ||
1532 | struct nfs4_delegation *dp; | ||
1533 | |||
1534 | list_for_each_entry(dp, &fp->fi_del_perfile, dl_del_perfile) { | ||
1535 | if (dp->dl_stateid.si_stateownerid == stid->si_stateownerid) | ||
1536 | return dp; | ||
1537 | } | ||
1538 | return NULL; | ||
1539 | } | ||
1540 | |||
1529 | static int | 1541 | static int |
1530 | nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp) | 1542 | nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp) |
1531 | { | 1543 | { |
@@ -2419,24 +2431,15 @@ find_stateid(stateid_t *stid, int flags) | |||
2419 | static struct nfs4_delegation * | 2431 | static struct nfs4_delegation * |
2420 | find_delegation_stateid(struct inode *ino, stateid_t *stid) | 2432 | find_delegation_stateid(struct inode *ino, stateid_t *stid) |
2421 | { | 2433 | { |
2422 | struct nfs4_delegation *dp = NULL; | ||
2423 | struct nfs4_file *fp = NULL; | 2434 | struct nfs4_file *fp = NULL; |
2424 | u32 st_id; | ||
2425 | 2435 | ||
2426 | dprintk("NFSD:find_delegation_stateid stateid=(%08x/%08x/%08x/%08x)\n", | 2436 | dprintk("NFSD:find_delegation_stateid stateid=(%08x/%08x/%08x/%08x)\n", |
2427 | stid->si_boot, stid->si_stateownerid, | 2437 | stid->si_boot, stid->si_stateownerid, |
2428 | stid->si_fileid, stid->si_generation); | 2438 | stid->si_fileid, stid->si_generation); |
2429 | 2439 | ||
2430 | st_id = stid->si_stateownerid; | ||
2431 | fp = find_file(ino); | 2440 | fp = find_file(ino); |
2432 | if (fp) { | 2441 | if (fp) |
2433 | list_for_each_entry(dp, &fp->fi_del_perfile, dl_del_perfile) { | 2442 | return find_delegation_file(fp, stid); |
2434 | if(dp->dl_stateid.si_stateownerid == st_id) { | ||
2435 | dprintk("NFSD: find_delegation dp %p\n",dp); | ||
2436 | return dp; | ||
2437 | } | ||
2438 | } | ||
2439 | } | ||
2440 | return NULL; | 2443 | return NULL; |
2441 | } | 2444 | } |
2442 | 2445 | ||