From: Ira Weiny <ira.weiny@intel.com>
To: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
Tyler Hicks <code@tyhicks.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Christian Brauner <brauner@kernel.org>,
Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Muchun Song <muchun.song@linux.dev>,
ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Ira Weiny <ira.weiny@intel.com>
Subject: Re: [PATCH] fs/ecryptfs: Replace kmap_atomic() with kmap_local_page()
Date: Tue, 14 Feb 2023 20:42:33 -0800 [thread overview]
Message-ID: <63ec62b9a1285_18bf5929449@iweiny-mobl.notmuch> (raw)
In-Reply-To: <20230103190259.30944-1-fmdefrancesco@gmail.com>
Fabio M. De Francesco wrote:
> kmap_atomic() is deprecated in favor of kmap_local_page(). Therefore,
> replace kmap_atomic() with kmap_local_page() in ecryptfs_write().
>
> kmap_atomic() is implemented like a kmap_local_page() which also disables
> page-faults and preemption (the latter only for !PREEMPT_RT kernels).
>
> The code within the mapping/un-mapping in ecryptfs_write() does not
> depend on the above-mentioned side effects.
>
> Therefore, a mere replacement of the old API with the new one is all that
> is required (i.e., there is no need to explicitly add any calls to
> pagefault_disable() and/or preempt_disable()).
>
> Suggested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> ---
> fs/ecryptfs/read_write.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
> index 5edf027c8359..3458f153a588 100644
> --- a/fs/ecryptfs/read_write.c
> +++ b/fs/ecryptfs/read_write.c
> @@ -140,7 +140,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
> ecryptfs_page_idx, rc);
> goto out;
> }
> - ecryptfs_page_virt = kmap_atomic(ecryptfs_page);
> + ecryptfs_page_virt = kmap_local_page(ecryptfs_page);
>
> /*
> * pos: where we're now writing, offset: where the request was
> @@ -163,7 +163,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
> (data + data_offset), num_bytes);
> data_offset += num_bytes;
> }
> - kunmap_atomic(ecryptfs_page_virt);
> + kunmap_local(ecryptfs_page_virt);
> flush_dcache_page(ecryptfs_page);
> SetPageUptodate(ecryptfs_page);
> unlock_page(ecryptfs_page);
> --
> 2.39.0
>
prev parent reply other threads:[~2023-02-15 4:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 19:02 [PATCH] fs/ecryptfs: Replace kmap_atomic() with kmap_local_page() Fabio M. De Francesco
2023-02-15 4:42 ` Ira Weiny [this message]
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=63ec62b9a1285_18bf5929449@iweiny-mobl.notmuch \
--to=ira.weiny@intel.com \
--cc=brauner@kernel.org \
--cc=code@tyhicks.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=ecryptfs@vger.kernel.org \
--cc=fmdefrancesco@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox