Commit 1bba38b2 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Clean up nfs_delegation_reap_unclaimed()

Convert nfs_delegation_reap_unclaimed() to use nfs_client_for_each_server()
for efficiency.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent af3b61bf
...@@ -1092,22 +1092,15 @@ void nfs_delegation_mark_reclaim(struct nfs_client *clp) ...@@ -1092,22 +1092,15 @@ void nfs_delegation_mark_reclaim(struct nfs_client *clp)
rcu_read_unlock(); rcu_read_unlock();
} }
/** static int nfs_server_reap_unclaimed_delegations(struct nfs_server *server,
* nfs_delegation_reap_unclaimed - reap unclaimed delegations after reboot recovery is done void __always_unused *data)
* @clp: nfs_client to process
*
*/
void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
{ {
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
struct nfs_server *server;
struct inode *inode; struct inode *inode;
restart: restart:
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { restart_locked:
list_for_each_entry_rcu(delegation, &server->delegations, list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
super_list) {
if (test_bit(NFS_DELEGATION_INODE_FREEING, if (test_bit(NFS_DELEGATION_INODE_FREEING,
&delegation->flags) || &delegation->flags) ||
test_bit(NFS_DELEGATION_RETURNING, test_bit(NFS_DELEGATION_RETURNING,
...@@ -1115,14 +1108,9 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp) ...@@ -1115,14 +1108,9 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
test_bit(NFS_DELEGATION_NEED_RECLAIM, test_bit(NFS_DELEGATION_NEED_RECLAIM,
&delegation->flags) == 0) &delegation->flags) == 0)
continue; continue;
if (!nfs_sb_active(server->super))
break; /* continue in outer loop */
inode = nfs_delegation_grab_inode(delegation); inode = nfs_delegation_grab_inode(delegation);
if (inode == NULL) { if (inode == NULL)
rcu_read_unlock(); goto restart_locked;
nfs_sb_deactive(server->super);
goto restart;
}
delegation = nfs_start_delegation_return_locked(NFS_I(inode)); delegation = nfs_start_delegation_return_locked(NFS_I(inode));
rcu_read_unlock(); rcu_read_unlock();
if (delegation != NULL) { if (delegation != NULL) {
...@@ -1133,12 +1121,22 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp) ...@@ -1133,12 +1121,22 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
nfs_put_delegation(delegation); nfs_put_delegation(delegation);
} }
iput(inode); iput(inode);
nfs_sb_deactive(server->super);
cond_resched(); cond_resched();
goto restart; goto restart;
} }
}
rcu_read_unlock(); rcu_read_unlock();
return 0;
}
/**
* nfs_delegation_reap_unclaimed - reap unclaimed delegations after reboot recovery is done
* @clp: nfs_client to process
*
*/
void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
{
nfs_client_for_each_server(clp, nfs_server_reap_unclaimed_delegations,
NULL);
} }
static inline bool nfs4_server_rebooted(const struct nfs_client *clp) static inline bool nfs4_server_rebooted(const struct nfs_client *clp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment