From patchwork Fri Dec 10 01:22:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fred Isaman X-Patchwork-Id: 397492 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBA68gGJ018031 for ; Fri, 10 Dec 2010 06:08:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751895Ab0LJGIy (ORCPT ); Fri, 10 Dec 2010 01:08:54 -0500 Received: from mx2.netapp.com ([216.240.18.37]:42664 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751514Ab0LJGIx (ORCPT ); Fri, 10 Dec 2010 01:08:53 -0500 X-IronPort-AV: E=Sophos;i="4.59,323,1288594800"; d="scan'208";a="493205471" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 09 Dec 2010 22:08:53 -0800 Received: from localhost.localdomain (kozen-lxp.hq.netapp.com [10.58.53.114] (may be forged)) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id oBA68VLs023313 for ; Thu, 9 Dec 2010 22:08:52 -0800 (PST) From: Fred Isaman To: linux-nfs@vger.kernel.org Subject: [PATCH 17/22] pnfs-submit: wave2: change plh_outstanding to atomic_t Date: Thu, 9 Dec 2010 20:22:52 -0500 Message-Id: <1291944177-7819-18-git-send-email-iisaman@netapp.com> X-Mailer: git-send-email 1.7.2.1 In-Reply-To: <1291944177-7819-1-git-send-email-iisaman@netapp.com> References: <1291944177-7819-1-git-send-email-iisaman@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 10 Dec 2010 06:08:55 +0000 (UTC) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index adcab30..c4dc5b1 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -5607,7 +5607,7 @@ static void nfs4_layoutreturn_release(void *calldata) spin_lock(&ino->i_lock); lo->plh_block_lgets--; - lo->plh_outstanding--; + atomic_dec(&lo->plh_outstanding); spin_unlock(&ino->i_lock); put_layout_hdr(ino); } @@ -5644,7 +5644,7 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool issync) /* FIXME we should test for BULK here */ spin_lock(&lo->inode->i_lock); BUG_ON(lo->plh_block_lgets == 0); - lo->plh_outstanding++; + atomic_inc(&lo->plh_outstanding); spin_unlock(&lo->inode->i_lock); } task = rpc_run_task(&task_setup_data); diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index f9757ff..27a1973 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -505,7 +505,8 @@ pnfs_layoutgets_blocked(struct pnfs_layout_hdr *lo, nfs4_stateid *stateid, return true; return lo->plh_block_lgets || test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) || - (list_empty(&lo->segs) && (lo->plh_outstanding > lget)); + (list_empty(&lo->segs) && + (atomic_read(&lo->plh_outstanding) > lget)); } int @@ -868,7 +869,7 @@ pnfs_update_layout(struct inode *ino, if (pnfs_layoutgets_blocked(lo, NULL, 0)) goto out_unlock; - lo->plh_outstanding++; + atomic_inc(&lo->plh_outstanding); get_layout_hdr(lo); /* Matched in pnfs_layoutget_release */ if (list_empty(&lo->segs)) { @@ -883,18 +884,18 @@ pnfs_update_layout(struct inode *ino, spin_unlock(&ino->i_lock); lseg = send_layoutget(lo, ctx, &arg); - spin_lock(&ino->i_lock); if (!lseg) { + spin_lock(&ino->i_lock); if (list_empty(&lo->segs)) { spin_lock(&clp->cl_lock); list_del_init(&lo->layouts); spin_unlock(&clp->cl_lock); clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); } + spin_unlock(&ino->i_lock); } - lo->plh_outstanding--; + atomic_dec(&lo->plh_outstanding); put_layout_hdr(ino); - spin_unlock(&ino->i_lock); out: dprintk("%s end, state 0x%lx lseg %p\n", __func__, nfsi->layout->plh_flags, lseg); diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 1ccc35d..b5a30b8 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -100,7 +100,7 @@ struct pnfs_layout_hdr { struct list_head segs; /* layout segments list */ int roc_iomode;/* return on close iomode, 0=none */ nfs4_stateid stateid; - unsigned long plh_outstanding; /* number of RPCs out */ + atomic_t plh_outstanding; /* number of RPCs out */ unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */ u32 plh_barrier; /* ignore lower seqids */ unsigned long plh_flags;