From patchwork Wed Dec 24 07:13:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5537131 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 5B1ABBEEA8 for ; Wed, 24 Dec 2014 07:14:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73277200F0 for ; Wed, 24 Dec 2014 07:14:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E16A2201C8 for ; Wed, 24 Dec 2014 07:14:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751903AbaLXHOO (ORCPT ); Wed, 24 Dec 2014 02:14:14 -0500 Received: from mail-ie0-f177.google.com ([209.85.223.177]:47783 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889AbaLXHOM (ORCPT ); Wed, 24 Dec 2014 02:14:12 -0500 Received: by mail-ie0-f177.google.com with SMTP id rd18so7202490iec.36 for ; Tue, 23 Dec 2014 23:14:12 -0800 (PST) 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=rM6Rq4uycMh++UiOE1gFEEHMfmfkDRtPdyIgTFBWIQE=; b=kWaPd52LJg7oxopgZiL9iQeX1wYbibnVAI10koEPd3XuTqnIskCR6sZCvbaWbfP35Y ObOIswbzh7LM2KUj6Q7TQ1PhtgfJgggP+bHgdE6iu0wkLXaD4SyU/kZIZlI8FmZffbut AQLAHyTP4duDsvRIfpOtsJswJGhHCj5c/JQ2ko77KNI94pD7hg9YHArjFQkO7DvHvHHC xgupq9RjoGmrRUc8pneqUAw/YTK96mP6CUvoXzjonjt5Wo8AtQCqExnZ6plWzmqa1doQ R4g0PrAbUrpIxiaLNQGrcBK0tCRSZ/YAPams8XR7f1NKgslxEDx1YIgXJsripteT4kMy vVsw== X-Gm-Message-State: ALoCoQmTS5/fZMYVnMkjGCbSUjD0G5zbBNHfQhzKZWb8KC5wzfq1mbH3eMffk3xeDJXJALvu+Zlq X-Received: by 10.42.38.198 with SMTP id d6mr24963943ice.29.1419405252203; Tue, 23 Dec 2014 23:14:12 -0800 (PST) Received: from localhost.localdomain (c-68-40-185-14.hsd1.mi.comcast.net. [68.40.185.14]) by mx.google.com with ESMTPSA id 37sm8821410iog.39.2014.12.23.23.14.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Dec 2014 23:14:11 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing List Subject: [PATCH v2 39/49] nfs: only reset desc->pg_mirror_idx when mirroring is supported Date: Tue, 23 Dec 2014 23:13:18 -0800 Message-Id: <1419405208-25975-40-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1419405208-25975-1-git-send-email-loghyr@primarydata.com> References: <1419405208-25975-1-git-send-email-loghyr@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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 From: Peng Tao so that we don't reset desc->pg_mirror_idx for read unnecessarily. Remove WARN_ON_ONCE from __nfs_pageio_add_request to allow LD to set pg_mirror_idx for read where pg_mirror_count is always 1. Signed-off-by: Peng Tao Signed-off-by: Tom Haynes --- fs/nfs/internal.h | 7 +++++++ fs/nfs/pagelist.c | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index ef1c703..5be06bc 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -6,6 +6,7 @@ #include #include #include +#include #define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS) @@ -261,6 +262,12 @@ static inline void nfs_iocounter_init(struct nfs_io_counter *c) atomic_set(&c->io_count, 0); } +static inline bool nfs_pgio_has_mirroring(struct nfs_pageio_descriptor *desc) +{ + WARN_ON_ONCE(desc->pg_mirror_count < 1); + return desc->pg_mirror_count > 1; +} + /* nfs2xdr.c */ extern struct rpc_procinfo nfs_procedures[]; extern int nfs2_decode_dirent(struct xdr_stream *, diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index eec12b7..f9d8c46 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1021,8 +1021,6 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, unsigned int bytes_left = 0; unsigned int offset, pgbase; - WARN_ON_ONCE(desc->pg_mirror_idx >= desc->pg_mirror_count); - nfs_page_group_lock(req, false); subreq = req; @@ -1162,7 +1160,8 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, } else dupreq = req; - desc->pg_mirror_idx = midx; + if (nfs_pgio_has_mirroring(desc)) + desc->pg_mirror_idx = midx; if (!nfs_pageio_add_request_mirror(desc, dupreq)) return 0; } @@ -1181,7 +1180,8 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc, struct nfs_pgio_mirror *mirror = &desc->pg_mirrors[mirror_idx]; u32 restore_idx = desc->pg_mirror_idx; - desc->pg_mirror_idx = mirror_idx; + if (nfs_pgio_has_mirroring(desc)) + desc->pg_mirror_idx = mirror_idx; for (;;) { nfs_pageio_doio(desc); if (!mirror->pg_recoalesce)