linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vboxsf: Convert vboxsf_write_end() to use kmap_local_folio()
@ 2025-08-11 21:42 Tal Zussman
  2025-08-11 22:12 ` Matthew Wilcox
  2025-08-11 22:23 ` Matthew Wilcox
  0 siblings, 2 replies; 4+ messages in thread
From: Tal Zussman @ 2025-08-11 21:42 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Matthew Wilcox, linux-fsdevel, linux-kernel, Tal Zussman

Now that vboxsf_write_end() takes a folio, convert the kmap() call to
kmap_local_folio(). This removes two instances of &folio->page as
well.

Compile-tested only.

Signed-off-by: Tal Zussman <tz2294@columbia.edu>
---
 fs/vboxsf/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/vboxsf/file.c b/fs/vboxsf/file.c
index 4bebd947314a..178fc74e399f 100644
--- a/fs/vboxsf/file.c
+++ b/fs/vboxsf/file.c
@@ -316,10 +316,10 @@ static int vboxsf_write_end(const struct kiocb *iocb,
 	if (!folio_test_uptodate(folio) && copied < len)
 		folio_zero_range(folio, from + copied, len - copied);
 
-	buf = kmap(&folio->page);
+	buf = kmap_local_folio(folio, 0);
 	err = vboxsf_write(sf_handle->root, sf_handle->handle,
 			   pos, &nwritten, buf + from);
-	kunmap(&folio->page);
+	kunmap_local(buf);
 
 	if (err) {
 		nwritten = 0;

---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250811-vboxsf_folio-343a7cd9e9b2

Best regards,
-- 
Tal Zussman <tz2294@columbia.edu>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vboxsf: Convert vboxsf_write_end() to use kmap_local_folio()
  2025-08-11 21:42 [PATCH] vboxsf: Convert vboxsf_write_end() to use kmap_local_folio() Tal Zussman
@ 2025-08-11 22:12 ` Matthew Wilcox
  2025-08-11 22:29   ` Tal Zussman
  2025-08-11 22:23 ` Matthew Wilcox
  1 sibling, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2025-08-11 22:12 UTC (permalink / raw)
  To: Tal Zussman; +Cc: Hans de Goede, linux-fsdevel, linux-kernel

On Mon, Aug 11, 2025 at 05:42:00PM -0400, Tal Zussman wrote:
> Now that vboxsf_write_end() takes a folio, convert the kmap() call to
> kmap_local_folio(). This removes two instances of &folio->page as
> well.
> 
> Compile-tested only.

Yeah ... I don't know if this is safe or not.  Needs actual testing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vboxsf: Convert vboxsf_write_end() to use kmap_local_folio()
  2025-08-11 21:42 [PATCH] vboxsf: Convert vboxsf_write_end() to use kmap_local_folio() Tal Zussman
  2025-08-11 22:12 ` Matthew Wilcox
@ 2025-08-11 22:23 ` Matthew Wilcox
  1 sibling, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2025-08-11 22:23 UTC (permalink / raw)
  To: Tal Zussman; +Cc: Hans de Goede, linux-fsdevel, linux-kernel

On Mon, Aug 11, 2025 at 05:42:00PM -0400, Tal Zussman wrote:
> Now that vboxsf_write_end() takes a folio, convert the kmap() call to
> kmap_local_folio(). This removes two instances of &folio->page as
> well.

Oh; something I should have said.  If you have an interest in vboxsf,
it looks like there's a communication protocol that lets you pass in a
physical address and length rather than a virtual address and length.
Redesigning the Linux driver to use that would be a big win and we could
drop the kmap calls entirely.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vboxsf: Convert vboxsf_write_end() to use kmap_local_folio()
  2025-08-11 22:12 ` Matthew Wilcox
@ 2025-08-11 22:29   ` Tal Zussman
  0 siblings, 0 replies; 4+ messages in thread
From: Tal Zussman @ 2025-08-11 22:29 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Hans de Goede, linux-fsdevel, linux-kernel

On Tue, Aug 12, 2025 at 1:12 AM Matthew Wilcox <willy@infradead.org> wrote:
> On Mon, Aug 11, 2025 at 05:42:00PM -0400, Tal Zussman wrote:
> > Now that vboxsf_write_end() takes a folio, convert the kmap() call to
> > kmap_local_folio(). This removes two instances of &folio->page as
> > well.
> >
> > Compile-tested only.
>
> Yeah ... I don't know if this is safe or not.  Needs actual testing.

Could you elaborate on why this might be unsafe? I assumed that (1) this is
similar to the conversion done in vboxsf_writepages() and (2) that the
kmap() call here could be simply converted to kmap_local_page() and then to
kmap_local_folio(), but clearly I'm missing something...

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-11 22:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 21:42 [PATCH] vboxsf: Convert vboxsf_write_end() to use kmap_local_folio() Tal Zussman
2025-08-11 22:12 ` Matthew Wilcox
2025-08-11 22:29   ` Tal Zussman
2025-08-11 22:23 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).