From patchwork Fri Jul 11 14:20:45 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: 4534911 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1A533BEEAA for ; Fri, 11 Jul 2014 14:20:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CA8020158 for ; Fri, 11 Jul 2014 14:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6CA7320176 for ; Fri, 11 Jul 2014 14:20:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752048AbaGKOUz (ORCPT ); Fri, 11 Jul 2014 10:20:55 -0400 Received: from mail-ie0-f170.google.com ([209.85.223.170]:51172 "EHLO mail-ie0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754113AbaGKOUx (ORCPT ); Fri, 11 Jul 2014 10:20:53 -0400 Received: by mail-ie0-f170.google.com with SMTP id lx4so956780iec.1 for ; Fri, 11 Jul 2014 07:20:53 -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=5YjfTRoCyqLGLUaauuwL24BKvnic9nkHKKkfg0F2gNU=; b=PMO97E64Vm8EzNL1lSOkLCwSmzQ181yDvZkZ/KIYpU1GzJ3+6YtrOU4s2tdP+lYW1Z njgGs3L5QeT+T3SzGd6oYU3H0FwefBbPwE1d5DzefOkJddiRvL3r5Cz21P0cpKooFbhO 39jrwvI7rzfHcaJ9yAUP5kjxDmOIi2mCPJwGtlrQGO3Z/ElOwHuHEAspMF5Xbdu2kgEN jmEOZnihg2em38dgWG+waAu3qaSjFyMBo5ED268912osYufVAKRU5r3m03/kKvrWlnzW zKxktQSF4XThN7Dd+Nfz8euCHU+rStxSKXbVwZSveLSPkoLLhpENCjN+QJt+Dt/uC3ez tqTw== X-Gm-Message-State: ALoCoQklahZ+SauX1ECK/CH9vyPoVfeYLfP+SDtbDtQXtdB87Hl0rkit6V1Ki6GMD/A4zGc52gIa X-Received: by 10.50.176.194 with SMTP id ck2mr4833358igc.44.1405088453137; Fri, 11 Jul 2014 07:20:53 -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 v6sm6334244igz.21.2014.07.11.07.20.52 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 11 Jul 2014 07:20:52 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 1/5] nfs: mark nfs_page reqs with flag for extra ref Date: Fri, 11 Jul 2014 10:20:45 -0400 Message-Id: <1405088449-11268-2-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 1.8.5.2 (Apple Git-48) In-Reply-To: <1405088449-11268-1-git-send-email-dros@primarydata.com> References: <1405088449-11268-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.5 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 Change the use of PG_INODE_REF - set it when taking extra reference on subrequests and take care to only release once for each request. Signed-off-by: Weston Andros Adamson --- fs/nfs/pagelist.c | 4 +++- fs/nfs/write.c | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 6e2c0bc..50e10bb 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -251,8 +251,10 @@ nfs_page_group_init(struct nfs_page *req, struct nfs_page *prev) /* grab extra ref if head request has extra ref from * the write/commit path to handle handoff between write * and commit lists */ - if (test_bit(PG_INODE_REF, &prev->wb_head->wb_flags)) + if (test_bit(PG_INODE_REF, &prev->wb_head->wb_flags)) { + set_bit(PG_INODE_REF, &req->wb_flags); kref_get(&req->wb_kref); + } } } diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 8534ee5..827b57b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -448,7 +448,9 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req) set_page_private(req->wb_page, (unsigned long)req); } nfsi->npages++; - set_bit(PG_INODE_REF, &req->wb_flags); + /* this a head request for a page group - mark it as having an + * extra reference so sub groups can follow suit */ + WARN_ON(test_and_set_bit(PG_INODE_REF, &req->wb_flags)); kref_get(&req->wb_kref); spin_unlock(&inode->i_lock); } @@ -474,7 +476,9 @@ static void nfs_inode_remove_request(struct nfs_page *req) nfsi->npages--; spin_unlock(&inode->i_lock); } - nfs_release_request(req); + + if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) + nfs_release_request(req); } static void