* [PATCH v2] fuse: Use kmap_local_page()
@ 2021-09-08 2:03 Hao Peng
2021-09-08 6:03 ` Miklos Szeredi
0 siblings, 1 reply; 2+ messages in thread
From: Hao Peng @ 2021-09-08 2:03 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: linux-fsdevel
From : Peng Hao <flyingpeng@tencent.com>
Due to the introduction of kmap_local_*, the storage of slots
used for short-term mapping has changed from per-CPU to per-thread.
kmap_atomic() disable preemption, while kmap_local_*() only disable
migration.
There is no need to disable preemption in several kamp_atomic
places used in fuse.
The detailed introduction of kmap_local_*d can be found here:
https://lwn.net/Articles/836144/
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
fs/fuse/dev.c | 8 ++++----
fs/fuse/ioctl.c | 4 ++--
fs/fuse/readdir.c | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index dde341a6388a..491c092d427b 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -756,7 +756,7 @@ static int fuse_copy_do(struct fuse_copy_state
*cs, void **val, unsigned *size)
{
unsigned ncpy = min(*size, cs->len);
if (val) {
- void *pgaddr = kmap_atomic(cs->pg);
+ void *pgaddr = kmap_local_page(cs->pg);
void *buf = pgaddr + cs->offset;
if (cs->write)
@@ -764,7 +764,7 @@ static int fuse_copy_do(struct fuse_copy_state
*cs, void **val, unsigned *size)
else
memcpy(*val, buf, ncpy);
- kunmap_atomic(pgaddr);
+ kunmap_local(pgaddr);
*val += ncpy;
}
*size -= ncpy;
@@ -949,10 +949,10 @@ static int fuse_copy_page(struct fuse_copy_state
*cs, struct page **pagep,
}
}
if (page) {
- void *mapaddr = kmap_atomic(page);
+ void *mapaddr = kmap_local_page(page);
void *buf = mapaddr + offset;
offset += fuse_copy_do(cs, &buf, &count);
- kunmap_atomic(mapaddr);
+ kunmap_local(mapaddr);
} else
offset += fuse_copy_do(cs, NULL, &count);
}
diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index 546ea3d58fb4..fbc09dab1f85 100644
--- a/fs/fuse/ioctl.c
+++ b/fs/fuse/ioctl.c
@@ -286,11 +286,11 @@ long fuse_do_ioctl(struct file *file, unsigned
int cmd, unsigned long arg,
in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV)
goto out;
- vaddr = kmap_atomic(ap.pages[0]);
+ vaddr = kmap_local_page(ap.pages[0]);
err = fuse_copy_ioctl_iovec(fm->fc, iov_page, vaddr,
transferred, in_iovs + out_iovs,
(flags & FUSE_IOCTL_COMPAT) != 0);
- kunmap_atomic(vaddr);
+ kunmap_local(vaddr);
if (err)
goto out;
diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c
index bc267832310c..e38ac983435a 100644
--- a/fs/fuse/readdir.c
+++ b/fs/fuse/readdir.c
@@ -76,11 +76,11 @@ static void fuse_add_dirent_to_cache(struct file *file,
WARN_ON(fi->rdc.pos != pos))
goto unlock;
- addr = kmap_atomic(page);
+ addr = kmap_local_page(page);
if (!offset)
clear_page(addr);
memcpy(addr + offset, dirent, reclen);
- kunmap_atomic(addr);
+ kunmap_local(addr);
fi->rdc.size = (index << PAGE_SHIFT) + offset + reclen;
fi->rdc.pos = dirent->off;
unlock:
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] fuse: Use kmap_local_page()
2021-09-08 2:03 [PATCH v2] fuse: Use kmap_local_page() Hao Peng
@ 2021-09-08 6:03 ` Miklos Szeredi
0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2021-09-08 6:03 UTC (permalink / raw)
To: Hao Peng; +Cc: linux-fsdevel
On Wed, 8 Sept 2021 at 04:03, Hao Peng <flyingpenghao@gmail.com> wrote:
>
> From : Peng Hao <flyingpeng@tencent.com>
>
> Due to the introduction of kmap_local_*, the storage of slots
> used for short-term mapping has changed from per-CPU to per-thread.
> kmap_atomic() disable preemption, while kmap_local_*() only disable
> migration.
> There is no need to disable preemption in several kamp_atomic
> places used in fuse.
> The detailed introduction of kmap_local_*d can be found here:
> https://lwn.net/Articles/836144/
Okay. The patch is still garbled. Please use git-send-email or some
other mail client.
Thanks,
Miklos
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-08 6:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 2:03 [PATCH v2] fuse: Use kmap_local_page() Hao Peng
2021-09-08 6:03 ` Miklos Szeredi
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).