Commit 5fe0fc9f authored by Peng Hao's avatar Peng Hao Committed by Miklos Szeredi

fuse: use kmap_local_page()

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.

Link: https://lwn.net/Articles/836144/Signed-off-by: default avatarPeng Hao <flyingpeng@tencent.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent bda9a719
...@@ -756,7 +756,7 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size) ...@@ -756,7 +756,7 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
{ {
unsigned ncpy = min(*size, cs->len); unsigned ncpy = min(*size, cs->len);
if (val) { if (val) {
void *pgaddr = kmap_atomic(cs->pg); void *pgaddr = kmap_local_page(cs->pg);
void *buf = pgaddr + cs->offset; void *buf = pgaddr + cs->offset;
if (cs->write) if (cs->write)
...@@ -764,7 +764,7 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size) ...@@ -764,7 +764,7 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
else else
memcpy(*val, buf, ncpy); memcpy(*val, buf, ncpy);
kunmap_atomic(pgaddr); kunmap_local(pgaddr);
*val += ncpy; *val += ncpy;
} }
*size -= ncpy; *size -= ncpy;
...@@ -949,10 +949,10 @@ static int fuse_copy_page(struct fuse_copy_state *cs, struct page **pagep, ...@@ -949,10 +949,10 @@ static int fuse_copy_page(struct fuse_copy_state *cs, struct page **pagep,
} }
} }
if (page) { if (page) {
void *mapaddr = kmap_atomic(page); void *mapaddr = kmap_local_page(page);
void *buf = mapaddr + offset; void *buf = mapaddr + offset;
offset += fuse_copy_do(cs, &buf, &count); offset += fuse_copy_do(cs, &buf, &count);
kunmap_atomic(mapaddr); kunmap_local(mapaddr);
} else } else
offset += fuse_copy_do(cs, NULL, &count); offset += fuse_copy_do(cs, NULL, &count);
} }
......
...@@ -286,11 +286,11 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, ...@@ -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) in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV)
goto out; 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, err = fuse_copy_ioctl_iovec(fm->fc, iov_page, vaddr,
transferred, in_iovs + out_iovs, transferred, in_iovs + out_iovs,
(flags & FUSE_IOCTL_COMPAT) != 0); (flags & FUSE_IOCTL_COMPAT) != 0);
kunmap_atomic(vaddr); kunmap_local(vaddr);
if (err) if (err)
goto out; goto out;
......
...@@ -76,11 +76,11 @@ static void fuse_add_dirent_to_cache(struct file *file, ...@@ -76,11 +76,11 @@ static void fuse_add_dirent_to_cache(struct file *file,
WARN_ON(fi->rdc.pos != pos)) WARN_ON(fi->rdc.pos != pos))
goto unlock; goto unlock;
addr = kmap_atomic(page); addr = kmap_local_page(page);
if (!offset) if (!offset)
clear_page(addr); clear_page(addr);
memcpy(addr + offset, dirent, reclen); memcpy(addr + offset, dirent, reclen);
kunmap_atomic(addr); kunmap_local(addr);
fi->rdc.size = (index << PAGE_SHIFT) + offset + reclen; fi->rdc.size = (index << PAGE_SHIFT) + offset + reclen;
fi->rdc.pos = dirent->off; fi->rdc.pos = dirent->off;
unlock: unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment