[PATCH v2] fuse: Use kmap_local_page()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From : Peng Hao <flyingpeng@xxxxxxxxxxx>

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@xxxxxxxxxxx>
---
 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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux