Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1420547pxb; Wed, 4 Nov 2020 08:28:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDN64Ukd7eP9KXSlahBz4XEMLFBdgvbWga8NwTkQ37ChAVd38qb7Ye6Wwwa298ZsiZ3bRw X-Received: by 2002:a17:906:ca93:: with SMTP id js19mr12579977ejb.124.1604507302902; Wed, 04 Nov 2020 08:28:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604507302; cv=none; d=google.com; s=arc-20160816; b=s1wNQyN9e3dkfG89RmGqqmNMe24zjOUJrCAXgE/BGrZ4QMT11x2ymsJZ1NrAPMBe55 aGQjV7ar8N46y/ZnvnmdpataEqePYqdvH0dPT9Aolq6n1xpF9mH0REFs86UPeqV2KyDK uqxohbSRca8D/Uj50THtma7PuzDQayEfnjtbPaw7XHImAP0cJABwZZwu8dONuuaxaUcx XWbP1QHyR632x8nLPGlibSV/YAR640ZAaiQQ5gCM+08j9CWnhrN8YVenE+2dtwzsMQDo 8mikgOTJhOskKUIkSQYT/emqUo2lW9BeVl4rzw3ztaIVsIM0UgxUPifoqPOY4wYfdIYF qGRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=d4SBKQY4D3SrCP5hjy6CzKLVkGZfG5JmNrqa2naVuXg=; b=Z9DjXYirO8DTHdeo8eSdMi7lRG9B7gFhneyXXhQV9ijDZ2zDiU0fSwTIpHpwqVPyC0 1jo19nBNx1OcSDZs6oZ4Ydv2VPceHmFSSO3GRj7suAVL8hodr14qOsE/kqOMGBCbpuNN pAuYpFD1W7/0hEcsDjQw6SmFzaUHc7IA07DH0hihXAJCIhsiBz+USzclFWqd9QyzTTDO HHiRwVjTf+P0KFAq89rAIaIWHlu1Ouo/kwnkCKCLlHI1S8Ksn8LiFJ/ImmAtn3sq3ryG bTn+VD8X8Na4QMT489jmD2MDWuPP36hcmoyLUVUYv6LUQzlo3lzc9D6HvhsN99UJPWNW wGdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZGdxe8CO; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si1741268ejk.655.2020.11.04.08.27.59; Wed, 04 Nov 2020 08:28:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZGdxe8CO; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731180AbgKDQ1J (ORCPT + 99 others); Wed, 4 Nov 2020 11:27:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728999AbgKDQ1J (ORCPT ); Wed, 4 Nov 2020 11:27:09 -0500 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2366AC0613D3 for ; Wed, 4 Nov 2020 08:27:09 -0800 (PST) Received: by mail-qk1-x743.google.com with SMTP id 11so233638qkd.5 for ; Wed, 04 Nov 2020 08:27:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=d4SBKQY4D3SrCP5hjy6CzKLVkGZfG5JmNrqa2naVuXg=; b=ZGdxe8CO4I9std1kg2XmPfD0kVU1rgdXYrIYkg5HyResRYNkmIEBPJH0HvdkwBxPit MGuF3AhoiqY3GiMswMLqOpXxNtiW2eUbPLK1FZUSZ8zjXr5R01wraCl85FYXWy/Kvd8T HfQa4znxVYSuESy4mi9juViPBN+5+Gu97BscR55mlSXiFZlgOeNQQKhejn1WtjETFC42 7w7vpAm79cpDJdwx+DH0P4l+6btXxUB34ORA9CKoAU0w7ZFyr9xbrZ8GlnIboNyB9zE/ e1ddXzymyhAQF2Z0HKECkNecfSZfftxM7JGfSbBSlL4scdNvFQOPsl7CbJ/8P6rhyxy3 tfhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d4SBKQY4D3SrCP5hjy6CzKLVkGZfG5JmNrqa2naVuXg=; b=dKztAJp8+2BXEu/h5NargafUj7c2w5pafDKnul63fVbBClgxKZmTB2ETya4+C0i8AK rzG1cC3zACGAbA2M864gj60X0ijz73uB7ZKgbhfipDIYw87+eD3jgb+B5BZc9ShBXFdn q7+Rx0wZyPLOUKRtHEOYZ2skp5OEdobmTrzeVJGji5z7Qy2AIfhiUONFnoz22bvUEkAi idTcLSwUa9V1qhQsj5ca+zWkbVN9x+T6tRtNcWAk1Ltc9GTGk7bFPjJUVd0CKaf9Dyp+ KfRiLxVxeSXhAx9t9dGfQ5AncjkFRJvmWeFc6mVUOCeBqAxmVeQdzSUlAbIJI0EQj03i 3VWQ== X-Gm-Message-State: AOAM533xa9e3uwHpzpTfGPaqC7tvJ9FfX/iTYB0ACMrZVBc/6PhzyFsx Tbupt5/m3gBe7+bBYtDTLKVe3Rp1c4I4 X-Received: by 2002:ae9:ee15:: with SMTP id i21mr24394904qkg.76.1604507228067; Wed, 04 Nov 2020 08:27:08 -0800 (PST) Received: from localhost.localdomain (c-68-36-133-222.hsd1.mi.comcast.net. [68.36.133.222]) by smtp.gmail.com with ESMTPSA id g78sm2896924qke.88.2020.11.04.08.27.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2020 08:27:07 -0800 (PST) From: trondmy@gmail.com X-Google-Original-From: trond.myklebust@hammerspace.com To: linux-nfs@vger.kernel.org Subject: [PATCH v3 06/17] NFS: Remove unnecessary kmap in nfs_readdir_xdr_to_array() Date: Wed, 4 Nov 2020 11:16:27 -0500 Message-Id: <20201104161638.300324-7-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201104161638.300324-6-trond.myklebust@hammerspace.com> References: <20201104161638.300324-1-trond.myklebust@hammerspace.com> <20201104161638.300324-2-trond.myklebust@hammerspace.com> <20201104161638.300324-3-trond.myklebust@hammerspace.com> <20201104161638.300324-4-trond.myklebust@hammerspace.com> <20201104161638.300324-5-trond.myklebust@hammerspace.com> <20201104161638.300324-6-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust The kmapped pointer is only used once per loop to check if we need to exit. Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index f7248145c333..e8b0fcc1bc9e 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -759,7 +759,6 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, struct page *pages[NFS_MAX_READDIR_PAGES]; struct nfs_entry entry; struct file *file = desc->file; - struct nfs_cache_array *array; int status = -ENOMEM; unsigned int array_size = ARRAY_SIZE(pages); @@ -778,11 +777,9 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, goto out; } - array = kmap(page); - status = nfs_readdir_alloc_pages(pages, array_size); if (status < 0) - goto out_release_array; + goto out_release_label; do { unsigned int pglen; status = nfs_readdir_xdr_filler(pages, desc, &entry, file, inode); @@ -797,11 +794,10 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, } status = nfs_readdir_page_filler(desc, &entry, pages, page, pglen); - } while (!status && !nfs_readdir_array_is_full(array)); + } while (!status && nfs_readdir_page_needs_filling(page)); nfs_readdir_free_pages(pages, array_size); -out_release_array: - kunmap(page); +out_release_label: nfs4_label_free(entry.label); out: nfs_free_fattr(entry.fattr); -- 2.28.0