From patchwork Fri Sep 21 20:50:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 1493411 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B391D3FE65 for ; Fri, 21 Sep 2012 20:52:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757991Ab2IUUwQ (ORCPT ); Fri, 21 Sep 2012 16:52:16 -0400 Received: from mx2.netapp.com ([216.240.18.37]:45426 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757872Ab2IUUwQ (ORCPT ); Fri, 21 Sep 2012 16:52:16 -0400 X-IronPort-AV: E=Sophos;i="4.80,464,1344236400"; d="scan'208";a="692516199" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 21 Sep 2012 13:52:15 -0700 Received: from lade.trondhjem.org.com (lade.trondhjem.org [10.63.228.34] (may be forged)) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q8LKoiBi029417; Fri, 21 Sep 2012 13:52:11 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v2 15/26] NFSv4.1: Rename the pnfs_put_lseg_common to pnfs_layout_remove_lseg Date: Fri, 21 Sep 2012 16:50:10 -0400 Message-Id: <1348260621-10294-15-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1348260621-10294-14-git-send-email-Trond.Myklebust@netapp.com> References: <1348260621-10294-1-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-2-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-3-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-4-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-5-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-6-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-7-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-8-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-9-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-10-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-11-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-12-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-13-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-14-git-send-email-Trond.Myklebust@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The latter name is more descriptive of the actual function. Also rename pnfs_insert_layout to pnfs_layout_insert_lseg. Signed-off-by: Trond Myklebust --- fs/nfs/pnfs.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 8633b78..142d0f4 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -294,21 +294,22 @@ static void free_lseg(struct pnfs_layout_segment *lseg) struct inode *ino = lseg->pls_layout->plh_inode; NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); - /* Matched by pnfs_get_layout_hdr in pnfs_insert_layout */ + /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */ pnfs_put_layout_hdr(NFS_I(ino)->layout); } static void -pnfs_put_lseg_common(struct pnfs_layout_segment *lseg) +pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo, + struct pnfs_layout_segment *lseg) { - struct inode *inode = lseg->pls_layout->plh_inode; + struct inode *inode = lo->plh_inode; WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); list_del_init(&lseg->pls_list); - if (list_empty(&lseg->pls_layout->plh_segs)) { - set_bit(NFS_LAYOUT_DESTROYED, &lseg->pls_layout->plh_flags); + if (list_empty(&lo->plh_segs)) { + set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags); /* Matched by initial refcount set in alloc_init_layout_hdr */ - pnfs_put_layout_hdr_locked(lseg->pls_layout); + pnfs_put_layout_hdr_locked(lo); } rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); } @@ -316,6 +317,7 @@ pnfs_put_lseg_common(struct pnfs_layout_segment *lseg) void pnfs_put_lseg(struct pnfs_layout_segment *lseg) { + struct pnfs_layout_hdr *lo; struct inode *inode; if (!lseg) @@ -324,13 +326,14 @@ pnfs_put_lseg(struct pnfs_layout_segment *lseg) dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg, atomic_read(&lseg->pls_refcount), test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); - inode = lseg->pls_layout->plh_inode; + lo = lseg->pls_layout; + inode = lo->plh_inode; if (atomic_dec_and_lock(&lseg->pls_refcount, &inode->i_lock)) { LIST_HEAD(free_me); - pnfs_put_lseg_common(lseg); - list_add(&lseg->pls_list, &free_me); + pnfs_layout_remove_lseg(lo, lseg); spin_unlock(&inode->i_lock); + list_add(&lseg->pls_list, &free_me); pnfs_free_lseg_list(&free_me); } } @@ -418,7 +421,7 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg, dprintk("%s: lseg %p ref %d\n", __func__, lseg, atomic_read(&lseg->pls_refcount)); if (atomic_dec_and_test(&lseg->pls_refcount)) { - pnfs_put_lseg_common(lseg); + pnfs_layout_remove_lseg(lseg->pls_layout, lseg); list_add(&lseg->pls_list, tmp_list); rv = 1; } @@ -831,7 +834,7 @@ cmp_layout(struct pnfs_layout_range *l1, } static void -pnfs_insert_layout(struct pnfs_layout_hdr *lo, +pnfs_layout_insert_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg) { struct pnfs_layout_segment *lp; @@ -1178,7 +1181,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) init_lseg(lo, lseg); lseg->pls_range = res->range; pnfs_get_lseg(lseg); - pnfs_insert_layout(lo, lseg); + pnfs_layout_insert_lseg(lo, lseg); if (res->return_on_close) { set_bit(NFS_LSEG_ROC, &lseg->pls_flags);