From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Chaitanya Kulkarni <kch@nvidia.com>,
Kees Cook <keescook@chromium.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Chuck Lever <chuck.lever@oracle.com>,
Baptiste Lepers <baptiste.lepers@gmail.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
Ira Weiny <ira.weiny@intel.com>
Subject: [PATCH] nfs: Replace kmap() with kmap_local_page()
Date: Tue, 28 Jun 2022 20:24:26 +0200 [thread overview]
Message-ID: <20220628182426.944-1-fmdefrancesco@gmail.com> (raw)
The use of kmap() is being deprecated in favor of kmap_local_page().
With kmap_local_page(), the mapping is per thread, CPU local and not
globally visible. Furthermore, the mapping can be acquired from any context
(including interrupts).
Therefore, use kmap_local_page() in nfs_do_filldir() because this mapping
is per thread, CPU local, and not globally visible.
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
I cannot test this patch for several reasons. While these changes seem safe
and trivial, I would feel better if people familiar with NFS could take the
time to properly test this patch. Thank you.
fs/nfs/dir.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 0c4e8dd6aa96..8b89f10d8899 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1084,7 +1084,7 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc,
struct nfs_cache_array *array;
unsigned int i;
- array = kmap(desc->page);
+ array = kmap_local_page(desc->page);
for (i = desc->cache_entry_index; i < array->size; i++) {
struct nfs_cache_array_entry *ent;
@@ -1110,7 +1110,7 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc,
if (array->page_is_eof)
desc->eof = !desc->eob;
- kunmap(desc->page);
+ kunmap_local(array);
dfprintk(DIRCACHE, "NFS: nfs_do_filldir() filling ended @ cookie %llu\n",
(unsigned long long)desc->dir_cookie);
}
--
2.36.1
next reply other threads:[~2022-06-28 18:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 18:24 Fabio M. De Francesco [this message]
2022-07-01 18:54 ` [PATCH] nfs: Replace kmap() with kmap_local_page() Ira Weiny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220628182426.944-1-fmdefrancesco@gmail.com \
--to=fmdefrancesco@gmail.com \
--cc=anna@kernel.org \
--cc=axboe@kernel.dk \
--cc=baptiste.lepers@gmail.com \
--cc=chuck.lever@oracle.com \
--cc=gustavoars@kernel.org \
--cc=ira.weiny@intel.com \
--cc=kch@nvidia.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.