Received: by 10.192.165.148 with SMTP id m20csp3364834imm; Sun, 29 Apr 2018 21:32:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoJDZw64HmlRWOwYY2ifT5X6tRphPJjV36zAwBMNLgC+i4z+klyAIm6t21Bacj6JjacstGs X-Received: by 2002:a65:55ca:: with SMTP id k10-v6mr9217105pgs.422.1525062758335; Sun, 29 Apr 2018 21:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525062758; cv=none; d=google.com; s=arc-20160816; b=chOWxD8azzYJW+VrCGO12iotinCRQYgD/PBilk5RwGRivfj4E3K2l3+FXauLaKaXME SfIf/FtRFGW1fh1MDv6Aq+1DPlX9OuUT8PM+Sgrxh6jPXFn1AAOn0Xpcy8reiMacMMdR reAGweTqRRWYej04NgoLcZCfns8iegaGblxknnBwWPHxPN6T6wZdtO4uGULyJxH2lafV sMtTnt9R6qh+jwmdvKhC4fvPUAKPPX39QLsv+2oi1+xtM66D/X7UAPqg/GoiNlOMNWJm Wikmzh0NeIZ7da4h6LqdaECvhb5k1XtDL40uek955D+/K+nlLNVe6d/GNXq4vGdvfhRA gLBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:cc:subject:date:to :from:arc-authentication-results; bh=gh/+Tioq4sBU+Q9q4UEGZ0bGCuIr9r1i2G71ScKddRo=; b=cZS9qAy9PyP3E7ZvyuHfFatAwuHWFQyjOdC/V1pUAVobLvJ1pqIkzIBYL5xpFI1KE1 GKzwITgVhfiynoHbZ1gDPXgpE7czpmAfEeFrawcHwujNkxiRf7e5jVROcYB/VboAjEi0 +JEJRCQQGEsYtGodw5R+ar51rC27iW1Dxe/5/TaOpM8NyT69UnWYddpBYPwe04KNjgdP +b7YzIlw35H2WWWdlYoZ13MNoEbmeWNZ/sAAN9LOf1POz3evVdwJ1dspgn2sEjiOO1RS avFaVD3eVdH1lCd4sJWaN1LinHbruOt3B/VmjfoMqzKbzE01jBpP89SciHNo5ayE6KKx pQRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12-v6si6959720plr.467.2018.04.29.21.32.23; Sun, 29 Apr 2018 21:32:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751560AbeD3EcH (ORCPT + 99 others); Mon, 30 Apr 2018 00:32:07 -0400 Received: from mx2.suse.de ([195.135.220.15]:38731 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771AbeD3EcE (ORCPT ); Mon, 30 Apr 2018 00:32:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 70E8AAD0B; Mon, 30 Apr 2018 04:32:03 +0000 (UTC) From: NeilBrown To: "Paul E. McKenney" , Trond Myklebust , Mathieu Desnoyers , Anna Schumaker Date: Mon, 30 Apr 2018 14:31:30 +1000 Subject: [PATCH 1/4] NFS: slight optimization for walking list for delegations Cc: linux-nfs@vger.kernel.org, Lai Jiangshan , Josh Triplett , Steven Rostedt , linux-kernel@vger.kernel.org Message-ID: <152506269054.7246.3941740801391514623.stgit@noble> In-Reply-To: <152506256513.7246.13171564155614823841.stgit@noble> References: <152506256513.7246.13171564155614823841.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are 3 places where we walk the list of delegations for an nfs_client. In each case there are two nested loops, one for nfs_servers and one for nfs_delegations. When we find an interesting delegation we try to get an active reference to the server. If that fails, it is pointless to continue to look at the other delegation for the server as we will never be able to get an active reference. So instead of continuing in the inner loop, break out and continue in the outer loop. --- fs/nfs/delegation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 1819d0d0ba4b..af32365894c8 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -495,7 +495,7 @@ int nfs_client_return_marked_delegations(struct nfs_client *clp) if (!nfs_delegation_need_return(delegation)) continue; if (!nfs_sb_active(server->super)) - continue; + break; inode = nfs_delegation_grab_inode(delegation); if (inode == NULL) { rcu_read_unlock(); @@ -887,7 +887,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp) &delegation->flags) == 0) continue; if (!nfs_sb_active(server->super)) - continue; + break; inode = nfs_delegation_grab_inode(delegation); if (inode == NULL) { rcu_read_unlock(); @@ -995,7 +995,7 @@ void nfs_reap_expired_delegations(struct nfs_client *clp) &delegation->flags) == 0) continue; if (!nfs_sb_active(server->super)) - continue; + break; inode = nfs_delegation_grab_inode(delegation); if (inode == NULL) { rcu_read_unlock();