From patchwork Tue May 3 18:29:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9007771 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 02DDC9F1D3 for ; Tue, 3 May 2016 18:29:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2275E2034E for ; Tue, 3 May 2016 18:29:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 37A1F2034B for ; Tue, 3 May 2016 18:29:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933978AbcECS3s (ORCPT ); Tue, 3 May 2016 14:29:48 -0400 Received: from mx144.netapp.com ([216.240.21.25]:37072 "EHLO mx144.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933947AbcECS3r (ORCPT ); Tue, 3 May 2016 14:29:47 -0400 X-IronPort-AV: E=Sophos;i="5.24,573,1455004800"; d="scan'208";a="114167333" Received: from vmwexchts04-prd.hq.netapp.com ([10.122.105.32]) by mx144-out.netapp.com with ESMTP; 03 May 2016 11:29:47 -0700 Received: from smtp1.corp.netapp.com (10.57.156.124) by VMWEXCHTS04-PRD.hq.netapp.com (10.122.105.32) with Microsoft SMTP Server id 15.0.1156.6; Tue, 3 May 2016 11:29:43 -0700 Received: from davros.com ([10.63.234.209]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id u43IThok016351; Tue, 3 May 2016 11:29:45 -0700 (PDT) From: Anna Schumaker To: , CC: Subject: [PATCH 2/2] NFS: Merge _nfs4_state_protect() and nfs4_state_protect() Date: Tue, 3 May 2016 14:29:42 -0400 Message-ID: <1462300182-24738-2-git-send-email-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1462300182-24738-1-git-send-email-Anna.Schumaker@Netapp.com> References: <1462300182-24738-1-git-send-email-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We can have nfs4_state_protect() do the work directly, rather than passing through the arguments without adding or modifying anything. Signed-off-by: Anna Schumaker --- fs/nfs/nfs4_fs.h | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 4afdee4..7eba033 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -290,9 +290,15 @@ is_ds_client(struct nfs_client *clp) return clp->cl_exchange_flags & EXCHGID4_FLAG_USE_PNFS_DS; } +/* + * Function responsible for determining if an rpc_message should use the + * machine cred under SP4_MACH_CRED and if so switching the credential and + * authflavor (using the nfs_client's rpc_clnt which will be krb5i/p). + * Should be called before rpc_call_sync/rpc_call_async. + */ static inline bool -_nfs4_state_protect(struct nfs_client *clp, unsigned long sp4_mode, - struct rpc_clnt **clntp, struct rpc_message *msg) +nfs4_state_protect(struct nfs_client *clp, unsigned long sp4_mode, + struct rpc_clnt **clntp, struct rpc_message *msg) { struct rpc_cred *newcred = NULL; rpc_authflavor_t flavor; @@ -317,19 +323,6 @@ _nfs4_state_protect(struct nfs_client *clp, unsigned long sp4_mode, } /* - * Function responsible for determining if an rpc_message should use the - * machine cred under SP4_MACH_CRED and if so switching the credential and - * authflavor (using the nfs_client's rpc_clnt which will be krb5i/p). - * Should be called before rpc_call_sync/rpc_call_async. - */ -static inline void -nfs4_state_protect(struct nfs_client *clp, unsigned long sp4_mode, - struct rpc_clnt **clntp, struct rpc_message *msg) -{ - _nfs4_state_protect(clp, sp4_mode, clntp, msg); -} - -/* * Special wrapper to nfs4_state_protect for write. * If WRITE can use machine cred but COMMIT cannot, make sure all writes * that use machine cred use NFS_FILE_SYNC. @@ -338,7 +331,7 @@ static inline void nfs4_state_protect_write(struct nfs_client *clp, struct rpc_clnt **clntp, struct rpc_message *msg, struct nfs_pgio_header *hdr) { - if (_nfs4_state_protect(clp, NFS_SP4_MACH_CRED_WRITE, clntp, msg) && + if (nfs4_state_protect(clp, NFS_SP4_MACH_CRED_WRITE, clntp, msg) && !test_bit(NFS_SP4_MACH_CRED_COMMIT, &clp->cl_sp4_flags)) hdr->args.stable = NFS_FILE_SYNC; }