diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-08-13 18:54:45 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-28 16:03:04 -0400 |
commit | 2a369153c82e0c83621b3e71d8f0c53394705bda (patch) | |
tree | bed0f7bfde6d8eac2b58bf0f7c452afb5f906b40 /fs/nfs/nfs4state.c | |
parent | b3c54de6f82d01637796bcc1f667a45f3b32e814 (diff) |
NFS: Clean up helper function nfs4_select_rw_stateid()
We want to be able to pass on the information that the page was not
dirtied under a lock. Instead of adding a flag parameter, do this
by passing a pointer to a 'struct nfs_lock_owner' that may be NULL.
Also reuse this structure in struct nfs_lock_context to carry the
fl_owner_t and pid_t.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 55148def5540..03a4e7825f3b 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -911,14 +911,22 @@ int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl) | |||
911 | } | 911 | } |
912 | 912 | ||
913 | static bool nfs4_copy_lock_stateid(nfs4_stateid *dst, struct nfs4_state *state, | 913 | static bool nfs4_copy_lock_stateid(nfs4_stateid *dst, struct nfs4_state *state, |
914 | fl_owner_t fl_owner, pid_t fl_pid) | 914 | const struct nfs_lockowner *lockowner) |
915 | { | 915 | { |
916 | struct nfs4_lock_state *lsp; | 916 | struct nfs4_lock_state *lsp; |
917 | fl_owner_t fl_owner; | ||
918 | pid_t fl_pid; | ||
917 | bool ret = false; | 919 | bool ret = false; |
918 | 920 | ||
921 | |||
922 | if (lockowner == NULL) | ||
923 | goto out; | ||
924 | |||
919 | if (test_bit(LK_STATE_IN_USE, &state->flags) == 0) | 925 | if (test_bit(LK_STATE_IN_USE, &state->flags) == 0) |
920 | goto out; | 926 | goto out; |
921 | 927 | ||
928 | fl_owner = lockowner->l_owner; | ||
929 | fl_pid = lockowner->l_pid; | ||
922 | spin_lock(&state->state_lock); | 930 | spin_lock(&state->state_lock); |
923 | lsp = __nfs4_find_lock_state(state, fl_owner, fl_pid, NFS4_ANY_LOCK_TYPE); | 931 | lsp = __nfs4_find_lock_state(state, fl_owner, fl_pid, NFS4_ANY_LOCK_TYPE); |
924 | if (lsp != NULL && (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0) { | 932 | if (lsp != NULL && (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0) { |
@@ -946,11 +954,11 @@ static void nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) | |||
946 | * requests. | 954 | * requests. |
947 | */ | 955 | */ |
948 | void nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, | 956 | void nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, |
949 | fmode_t fmode, fl_owner_t fl_owner, pid_t fl_pid) | 957 | fmode_t fmode, const struct nfs_lockowner *lockowner) |
950 | { | 958 | { |
951 | if (nfs4_copy_delegation_stateid(dst, state->inode, fmode)) | 959 | if (nfs4_copy_delegation_stateid(dst, state->inode, fmode)) |
952 | return; | 960 | return; |
953 | if (nfs4_copy_lock_stateid(dst, state, fl_owner, fl_pid)) | 961 | if (nfs4_copy_lock_stateid(dst, state, lockowner)) |
954 | return; | 962 | return; |
955 | nfs4_copy_open_stateid(dst, state); | 963 | nfs4_copy_open_stateid(dst, state); |
956 | } | 964 | } |