From patchwork Fri Aug 8 15:13:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weston Andros Adamson X-Patchwork-Id: 4696771 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4072F9F377 for ; Fri, 8 Aug 2014 15:15:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C2E2201C0 for ; Fri, 8 Aug 2014 15:15:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E29E201BB for ; Fri, 8 Aug 2014 15:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756256AbaHHPPD (ORCPT ); Fri, 8 Aug 2014 11:15:03 -0400 Received: from mail-ie0-f173.google.com ([209.85.223.173]:33030 "EHLO mail-ie0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752821AbaHHPPB (ORCPT ); Fri, 8 Aug 2014 11:15:01 -0400 Received: by mail-ie0-f173.google.com with SMTP id tr6so6554560ieb.4 for ; Fri, 08 Aug 2014 08:15:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=86/y6SrDuCdETdrCfFcaUMwI7LWSUnGlL8qNFus1+Lo=; b=LZnxfQslGmwrPAteGgOCepjORWksDPHCHE3u97lrytdym6ij3YlPigxN85ksiFKP9g xEuvQxwWmPSt+6QOzrpuxKz3tcTYAZAgPQipYftDme7naB1JvCmZYMFxYiO11IZH8ybB HY0W+VNsM6g2Vwe7kQRQzfghPrvf5Bim1nbZemm2cO1rMHVQcO7nNJXWAqsyR2Fh1Ig9 3kwin94WEkMjbWyb3waXf7aL01In0tXYKnNBaCM43zpazYg+v7BLZ1yrHnMhCsJOlysJ yCntZIgUQSNHksJIcUBbMO8cKJqJhso6DnJp6M0kmnvcuBCtiiS/LuRj/tHZI+gQ3aHy iM8A== X-Gm-Message-State: ALoCoQniwR6t4sS45A5mXuoLe9wmVfMxgLgLyzJadIcbY5Q2I6ZdGgup3j62JURn+JYRtX9Dnnw4 X-Received: by 10.43.150.193 with SMTP id kp1mr12895137icc.33.1407510900909; Fri, 08 Aug 2014 08:15:00 -0700 (PDT) Received: from gavrio-wifi.robotsandstuff.fake (c-98-209-19-144.hsd1.mi.comcast.net. [98.209.19.144]) by mx.google.com with ESMTPSA id lb2sm10093951igb.6.2014.08.08.08.15.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 Aug 2014 08:15:00 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 4/5] pnfs: add pnfs_put_lseg_async Date: Fri, 8 Aug 2014 11:13:35 -0400 Message-Id: <1407510816-7002-5-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 1.8.5.2 (Apple Git-48) In-Reply-To: <1407510816-7002-1-git-send-email-dros@primarydata.com> References: <1407510816-7002-1-git-send-email-dros@primarydata.com> 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 This is useful when lsegs need to be released while holding locks. Signed-off-by: Weston Andros Adamson Signed-off-by: Trond Myklebust --- fs/nfs/pnfs.c | 17 +++++++++++++++++ fs/nfs/pnfs.h | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 83ff8a0..4e85315 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -361,6 +361,23 @@ pnfs_put_lseg(struct pnfs_layout_segment *lseg) } EXPORT_SYMBOL_GPL(pnfs_put_lseg); +static void pnfs_put_lseg_async_work(struct work_struct *work) +{ + struct pnfs_layout_segment *lseg; + + lseg = container_of(work, struct pnfs_layout_segment, pls_work); + + pnfs_put_lseg(lseg); +} + +void +pnfs_put_lseg_async(struct pnfs_layout_segment *lseg) +{ + INIT_WORK(&lseg->pls_work, pnfs_put_lseg_async_work); + schedule_work(&lseg->pls_work); +} +EXPORT_SYMBOL_GPL(pnfs_put_lseg_async); + static u64 end_offset(u64 start, u64 len) { diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 203b6c9..aca3dff 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -32,6 +32,7 @@ #include #include +#include enum { NFS_LSEG_VALID = 0, /* cleared when lseg is recalled/returned */ @@ -46,6 +47,7 @@ struct pnfs_layout_segment { atomic_t pls_refcount; unsigned long pls_flags; struct pnfs_layout_hdr *pls_layout; + struct work_struct pls_work; }; enum pnfs_try_status { @@ -181,6 +183,7 @@ extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp); /* pnfs.c */ void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo); void pnfs_put_lseg(struct pnfs_layout_segment *lseg); +void pnfs_put_lseg_async(struct pnfs_layout_segment *lseg); void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); void unset_pnfs_layoutdriver(struct nfs_server *); @@ -419,6 +422,10 @@ static inline void pnfs_put_lseg(struct pnfs_layout_segment *lseg) { } +static inline void pnfs_put_lseg_async(struct pnfs_layout_segment *lseg) +{ +} + static inline int pnfs_return_layout(struct inode *ino) { return 0;