From patchwork Tue Sep 11 20:23:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 10596267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 974D6112B for ; Tue, 11 Sep 2018 20:23:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8360D29A2B for ; Tue, 11 Sep 2018 20:23:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7785A29E2B; Tue, 11 Sep 2018 20:23:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B2F329A2B for ; Tue, 11 Sep 2018 20:23:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbeILBYt (ORCPT ); Tue, 11 Sep 2018 21:24:49 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:36562 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbeILBYt (ORCPT ); Tue, 11 Sep 2018 21:24:49 -0400 Received: by mail-qt0-f193.google.com with SMTP id t5-v6so29734982qtn.3 for ; Tue, 11 Sep 2018 13:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=h+jTRt/zyMpNHS1ZDPV5AqXfP5AjD+qruT9vMsVPd7M=; b=UFDkjz7gZBauFm4/cj1RHaIAJYfHld7ektxBqet0tWMvEw5m+/o4zCEFTTOJe43pT+ eKXR1mLKuLq7FXhGVPGeGpP/my0p7fxcIw7XkIhvTQXNjJdxUQm7oKdBF4PQSQf/B69a 0PKdWAqK0qjjoHHImT58kY6fUpvDToPpJJhhiOsy4a929jkPE6yWJGMMeBdKIIl//+sC O5+9px3OhASg+9OVNFMfAxNnLMELSns1ks9E/Ybp1BmE2nMmbGIqpAWdyQuKjFRLfMQ2 PrfyEwQHjcGfaI/jhlv4NZwKLWt+4gDiU7V1lNpp/Z/OwEd/coXdmEq0W7SB1YMn7v/P IUHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=h+jTRt/zyMpNHS1ZDPV5AqXfP5AjD+qruT9vMsVPd7M=; b=j2piBNeIiF63eAXj2nEok6H9CpQGBF66HIlrD8Tys+/pih3zME383YCDx3XFw2UGXC +x6VLhZpEghKChS+5jPG7Nkz25gMwqEK/MPbR7HYjofT7L2mm/kAtG23bMlls8c7qnKa ttdXpRyaKiZZcq09dMxE4M+039B4YBsCEWs1mWlF9z7LUAUXKHqGWqbYgxTxvoBzXR0l jcG2wzcANyEiwbrL4SK5yDoHa9qkc5fuKqvj4yvv/cNXLtkgHIvT3zsV3Wr/h3frTNCc 4lhIDBWlySGrVojUS3teBPT1dVy8kE8Qtj9aIZnjiaLROUxvkI5JZdmJh9j2jneE1hFM THBw== X-Gm-Message-State: APzg51A4BWjcWUFZWcZpSvhV6NMrWKtwE8XgndkB+N/o9yQqB1JbNAj1 YEpUDcC4AR5TBlR77K7tc/EHwzczWeU= X-Google-Smtp-Source: ANB0VdZl/TjKs/LnLVbTb+VJR5t+yKpv/3NdZJ0z6R0kVBm7sxayeO4aM8lbNuVWGb5PnyOeH11j7Q== X-Received: by 2002:a0c:abca:: with SMTP id k10-v6mr19492128qvb.140.1536697431931; Tue, 11 Sep 2018 13:23:51 -0700 (PDT) Received: from gouda.nowheycreamery.com.local (c-68-40-188-1.hsd1.mi.comcast.net. [68.40.188.1]) by smtp.gmail.com with ESMTPSA id u129-v6sm11015517qkd.45.2018.09.11.13.23.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 13:23:50 -0700 (PDT) From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Subject: [PATCH 2/3] NFS: Reduce indentation of the switch statement in nfs4_reclaim_open_state() Date: Tue, 11 Sep 2018 16:23:47 -0400 Message-Id: <20180911202348.23160-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180911202348.23160-1-Anna.Schumaker@Netapp.com> References: <20180911202348.23160-1-Anna.Schumaker@Netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Anna Schumaker 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 --- fs/nfs/nfs4state.c | 70 ++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index aa46a3216d60..8a399dc17e19 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1615,46 +1615,42 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs atomic_inc(&state->count); spin_unlock(&sp->so_lock); status = __nfs4_reclaim_open_state(sp, state, ops); - if (status >= 0) { - nfs4_put_open_state(state); - spin_lock(&sp->so_lock); - goto restart; - } switch (status) { - default: - printk(KERN_ERR "NFS: %s: unhandled error %d\n", - __func__, status); - /* Fall through */ - case -ENOENT: - case -ENOMEM: - case -EACCES: - case -EROFS: - case -EIO: - case -ESTALE: - /* Open state on this file cannot be recovered */ - nfs4_state_mark_recovery_failed(state, status); - break; - case -EAGAIN: - ssleep(1); - /* Fall through */ - case -NFS4ERR_ADMIN_REVOKED: - case -NFS4ERR_STALE_STATEID: - case -NFS4ERR_OLD_STATEID: - case -NFS4ERR_BAD_STATEID: - case -NFS4ERR_RECLAIM_BAD: - case -NFS4ERR_RECLAIM_CONFLICT: - nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state); + default: + if (status >= 0) break; - case -NFS4ERR_EXPIRED: - case -NFS4ERR_NO_GRACE: - nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state); - case -NFS4ERR_STALE_CLIENTID: - case -NFS4ERR_BADSESSION: - case -NFS4ERR_BADSLOT: - case -NFS4ERR_BAD_HIGH_SLOT: - case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: - goto out_err; + printk(KERN_ERR "NFS: %s: unhandled error %d\n", __func__, status); + /* Fall through */ + case -ENOENT: + case -ENOMEM: + case -EACCES: + case -EROFS: + case -EIO: + case -ESTALE: + /* Open state on this file cannot be recovered */ + nfs4_state_mark_recovery_failed(state, status); + break; + case -EAGAIN: + ssleep(1); + /* Fall through */ + case -NFS4ERR_ADMIN_REVOKED: + case -NFS4ERR_STALE_STATEID: + case -NFS4ERR_OLD_STATEID: + case -NFS4ERR_BAD_STATEID: + case -NFS4ERR_RECLAIM_BAD: + case -NFS4ERR_RECLAIM_CONFLICT: + nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state); + break; + case -NFS4ERR_EXPIRED: + case -NFS4ERR_NO_GRACE: + nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state); + case -NFS4ERR_STALE_CLIENTID: + case -NFS4ERR_BADSESSION: + case -NFS4ERR_BADSLOT: + case -NFS4ERR_BAD_HIGH_SLOT: + case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: + goto out_err; } nfs4_put_open_state(state); spin_lock(&sp->so_lock);