From patchwork Tue Nov 3 15:33:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11878183 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 783C992C for ; Tue, 3 Nov 2020 15:43:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A71A22264 for ; Tue, 3 Nov 2020 15:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604418226; bh=d8g1ssvMEKbn5ctcVSH4O7QGnvonC32nfZcKNfIGUiE=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=Z07QKgckxtIYOsswJLs0MqTsH5CysxWesGJoT+L/aiyBqUdcb7aglnuwnroYFHeFh NOi32siDVg/j0E9zlnU9WBiC24s0YnPkyjMfcP4vDogmV4WB94G1S9wg8iNjXRiJGw MO5U/FJrkinW7q3Sdla3ck922OSwUDoCPo9cqKfU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728312AbgKCPnp (ORCPT ); Tue, 3 Nov 2020 10:43:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:39144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728299AbgKCPnn (ORCPT ); Tue, 3 Nov 2020 10:43:43 -0500 Received: from localhost.localdomain (c-68-36-133-222.hsd1.mi.comcast.net [68.36.133.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 48DE5221FB for ; Tue, 3 Nov 2020 15:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604418223; bh=d8g1ssvMEKbn5ctcVSH4O7QGnvonC32nfZcKNfIGUiE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=c5xTiwEvquXpAxIvn5zWtshR77wWTyOhlt9qkK+bqwAJiJ2ec9cQmvAjtZxGK3ZCl 46RP9ON8a9tLo9/vMr9rv/+FPZmaKg0o+u8LDYrWmIlkvKnEGsHrYlSNEgDL8/DtMf uapV73r0hta63HGZl4i0KOnDM3wFHjLj5PcCODwk= From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v2 06/16] NFS: Remove unnecessary kmap in nfs_readdir_xdr_to_array() Date: Tue, 3 Nov 2020 10:33:19 -0500 Message-Id: <20201103153329.531942-7-trondmy@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103153329.531942-6-trondmy@kernel.org> References: <20201103153329.531942-1-trondmy@kernel.org> <20201103153329.531942-2-trondmy@kernel.org> <20201103153329.531942-3-trondmy@kernel.org> <20201103153329.531942-4-trondmy@kernel.org> <20201103153329.531942-5-trondmy@kernel.org> <20201103153329.531942-6-trondmy@kernel.org> MIME-Version: 1.0 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 788c2a2eeaa3..ba3521dcd0c8 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -760,7 +760,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); @@ -779,11 +778,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); @@ -798,11 +795,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);