Skip to content

Commit 35a6160

Browse files
amschuma-ntapTrond Myklebust
authored andcommitted
NFS: Reduce indentation of the switch statement in nfs4_reclaim_open_state()
Most places in the kernel tend to line up cases with the switch to reduce indentation, so move this over to match that style. Additionally, I handle the (status >= 0) case in the switch so that we only "goto restart" from a single place after error handling. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent cb7a838 commit 35a6160

File tree

1 file changed

+33
-37
lines changed

1 file changed

+33
-37
lines changed

fs/nfs/nfs4state.c

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,46 +1617,42 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs
16171617
refcount_inc(&state->count);
16181618
spin_unlock(&sp->so_lock);
16191619
status = __nfs4_reclaim_open_state(sp, state, ops);
1620-
if (status >= 0) {
1621-
nfs4_put_open_state(state);
1622-
spin_lock(&sp->so_lock);
1623-
goto restart;
1624-
}
16251620

16261621
switch (status) {
1627-
default:
1628-
printk(KERN_ERR "NFS: %s: unhandled error %d\n",
1629-
__func__, status);
1630-
/* Fall through */
1631-
case -ENOENT:
1632-
case -ENOMEM:
1633-
case -EACCES:
1634-
case -EROFS:
1635-
case -EIO:
1636-
case -ESTALE:
1637-
/* Open state on this file cannot be recovered */
1638-
nfs4_state_mark_recovery_failed(state, status);
1639-
break;
1640-
case -EAGAIN:
1641-
ssleep(1);
1642-
/* Fall through */
1643-
case -NFS4ERR_ADMIN_REVOKED:
1644-
case -NFS4ERR_STALE_STATEID:
1645-
case -NFS4ERR_OLD_STATEID:
1646-
case -NFS4ERR_BAD_STATEID:
1647-
case -NFS4ERR_RECLAIM_BAD:
1648-
case -NFS4ERR_RECLAIM_CONFLICT:
1649-
nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state);
1622+
default:
1623+
if (status >= 0)
16501624
break;
1651-
case -NFS4ERR_EXPIRED:
1652-
case -NFS4ERR_NO_GRACE:
1653-
nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state);
1654-
case -NFS4ERR_STALE_CLIENTID:
1655-
case -NFS4ERR_BADSESSION:
1656-
case -NFS4ERR_BADSLOT:
1657-
case -NFS4ERR_BAD_HIGH_SLOT:
1658-
case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
1659-
goto out_err;
1625+
printk(KERN_ERR "NFS: %s: unhandled error %d\n", __func__, status);
1626+
/* Fall through */
1627+
case -ENOENT:
1628+
case -ENOMEM:
1629+
case -EACCES:
1630+
case -EROFS:
1631+
case -EIO:
1632+
case -ESTALE:
1633+
/* Open state on this file cannot be recovered */
1634+
nfs4_state_mark_recovery_failed(state, status);
1635+
break;
1636+
case -EAGAIN:
1637+
ssleep(1);
1638+
/* Fall through */
1639+
case -NFS4ERR_ADMIN_REVOKED:
1640+
case -NFS4ERR_STALE_STATEID:
1641+
case -NFS4ERR_OLD_STATEID:
1642+
case -NFS4ERR_BAD_STATEID:
1643+
case -NFS4ERR_RECLAIM_BAD:
1644+
case -NFS4ERR_RECLAIM_CONFLICT:
1645+
nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state);
1646+
break;
1647+
case -NFS4ERR_EXPIRED:
1648+
case -NFS4ERR_NO_GRACE:
1649+
nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state);
1650+
case -NFS4ERR_STALE_CLIENTID:
1651+
case -NFS4ERR_BADSESSION:
1652+
case -NFS4ERR_BADSLOT:
1653+
case -NFS4ERR_BAD_HIGH_SLOT:
1654+
case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
1655+
goto out_err;
16601656
}
16611657
nfs4_put_open_state(state);
16621658
spin_lock(&sp->so_lock);

0 commit comments

Comments
 (0)