Skip to content

Commit 80f4236

Browse files
amschuma-ntapTrond Myklebust
authored andcommitted
NFSv4: Split out NFS v4.2 copy completion functions
The convention in the rest of the code is to have a separate function for anything that might be ifdef-ed out. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 000d3f9 commit 80f4236

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

fs/nfs/nfs4state.c

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,31 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_
15491549
return status;
15501550
}
15511551

1552+
#ifdef CONFIG_NFS_V4_2
1553+
static void nfs42_complete_copies(struct nfs4_state_owner *sp, struct nfs4_state *state)
1554+
{
1555+
struct nfs4_copy_state *copy;
1556+
1557+
if (!test_bit(NFS_CLNT_DST_SSC_COPY_STATE, &state->flags))
1558+
return;
1559+
1560+
spin_lock(&sp->so_server->nfs_client->cl_lock);
1561+
list_for_each_entry(copy, &sp->so_server->ss_copies, copies) {
1562+
if (nfs4_stateid_match_other(&state->stateid, &copy->parent_state->stateid))
1563+
continue;
1564+
copy->flags = 1;
1565+
complete(&copy->completion);
1566+
break;
1567+
}
1568+
spin_unlock(&sp->so_server->nfs_client->cl_lock);
1569+
}
1570+
#else /* !CONFIG_NFS_V4_2 */
1571+
static inline void nfs42_complete_copies(struct nfs4_state_owner *sp,
1572+
struct nfs4_state *state)
1573+
{
1574+
}
1575+
#endif /* CONFIG_NFS_V4_2 */
1576+
15521577
static int __nfs4_reclaim_open_state(struct nfs4_state_owner *sp, struct nfs4_state *state,
15531578
const struct nfs4_state_recovery_ops *ops)
15541579
{
@@ -1572,21 +1597,7 @@ static int __nfs4_reclaim_open_state(struct nfs4_state_owner *sp, struct nfs4_st
15721597
spin_unlock(&state->state_lock);
15731598
}
15741599

1575-
#ifdef CONFIG_NFS_V4_2
1576-
if (test_bit(NFS_CLNT_DST_SSC_COPY_STATE, &state->flags)) {
1577-
struct nfs4_copy_state *copy;
1578-
spin_lock(&sp->so_server->nfs_client->cl_lock);
1579-
list_for_each_entry(copy, &sp->so_server->ss_copies, copies) {
1580-
if (nfs4_stateid_match_other(&state->stateid, &copy->parent_state->stateid))
1581-
continue;
1582-
copy->flags = 1;
1583-
complete(&copy->completion);
1584-
break;
1585-
}
1586-
spin_unlock(&sp->so_server->nfs_client->cl_lock);
1587-
}
1588-
#endif /* CONFIG_NFS_V4_2 */
1589-
1600+
nfs42_complete_copies(sp, state);
15901601
clear_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags);
15911602
return status;
15921603
}

0 commit comments

Comments
 (0)