diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-11-03 08:00:14 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2017-11-27 16:45:10 -0500 |
commit | fd1fd685b30867122aafbe2998ce4065c8c87e8f (patch) | |
tree | 3a4b3c3f4a3187aeadf3553244284382aec323d2 /fs/nfsd | |
parent | 659aefb68eca28ba9aa482a9fc64de107332e256 (diff) |
nfsd4: move find_lock_stateid
Trivial cleanup to simplify following patch.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 6542b57ecc86..49a9741fa132 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -5703,6 +5703,25 @@ alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, | |||
5703 | return ret; | 5703 | return ret; |
5704 | } | 5704 | } |
5705 | 5705 | ||
5706 | static struct nfs4_ol_stateid * | ||
5707 | find_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp) | ||
5708 | { | ||
5709 | struct nfs4_ol_stateid *lst; | ||
5710 | struct nfs4_client *clp = lo->lo_owner.so_client; | ||
5711 | |||
5712 | lockdep_assert_held(&clp->cl_lock); | ||
5713 | |||
5714 | list_for_each_entry(lst, &lo->lo_owner.so_stateids, st_perstateowner) { | ||
5715 | if (lst->st_stid.sc_type != NFS4_LOCK_STID) | ||
5716 | continue; | ||
5717 | if (lst->st_stid.sc_file == fp) { | ||
5718 | refcount_inc(&lst->st_stid.sc_count); | ||
5719 | return lst; | ||
5720 | } | ||
5721 | } | ||
5722 | return NULL; | ||
5723 | } | ||
5724 | |||
5706 | static void | 5725 | static void |
5707 | init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, | 5726 | init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, |
5708 | struct nfs4_file *fp, struct inode *inode, | 5727 | struct nfs4_file *fp, struct inode *inode, |
@@ -5729,25 +5748,6 @@ init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, | |||
5729 | } | 5748 | } |
5730 | 5749 | ||
5731 | static struct nfs4_ol_stateid * | 5750 | static struct nfs4_ol_stateid * |
5732 | find_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp) | ||
5733 | { | ||
5734 | struct nfs4_ol_stateid *lst; | ||
5735 | struct nfs4_client *clp = lo->lo_owner.so_client; | ||
5736 | |||
5737 | lockdep_assert_held(&clp->cl_lock); | ||
5738 | |||
5739 | list_for_each_entry(lst, &lo->lo_owner.so_stateids, st_perstateowner) { | ||
5740 | if (lst->st_stid.sc_type != NFS4_LOCK_STID) | ||
5741 | continue; | ||
5742 | if (lst->st_stid.sc_file == fp) { | ||
5743 | refcount_inc(&lst->st_stid.sc_count); | ||
5744 | return lst; | ||
5745 | } | ||
5746 | } | ||
5747 | return NULL; | ||
5748 | } | ||
5749 | |||
5750 | static struct nfs4_ol_stateid * | ||
5751 | find_or_create_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fi, | 5751 | find_or_create_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fi, |
5752 | struct inode *inode, struct nfs4_ol_stateid *ost, | 5752 | struct inode *inode, struct nfs4_ol_stateid *ost, |
5753 | bool *new) | 5753 | bool *new) |