[Devel] [PATCH RHEL7 COMMIT] fuse: remove direct_IO_page

Konstantin Khorenko khorenko at virtuozzo.com
Mon Feb 19 14:02:59 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.43.7
------>
commit 4e8562d7404eae467b76105797e5252209df2e69
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Mon Feb 19 14:02:59 2018 +0300

    fuse: remove direct_IO_page
    
    direct_IO_page is redundant interface which is used only by ploop,
    
    In fact implementation is broken because it is bad to relay on kmap/kunmap
    for async requests.
    
    https://jira.sw.ru/browse/PSBM-80680
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 fs/fuse/file.c | 44 +-------------------------------------------
 1 file changed, 1 insertion(+), 43 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index ab1e6a7d33c6..d2911703051f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1685,21 +1685,6 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,
 {
 	size_t nbytes = 0;  /* # bytes already packed in req */
 
-	/* Special case for kernel I/O: can copy directly into the buffer */
-	if (segment_eq(get_fs(), KERNEL_DS)) {
-		unsigned long user_addr = fuse_get_user_addr(ii);
-		size_t frag_size = fuse_get_frag_size(ii, *nbytesp);
-
-		if (write)
-			req->in.args[1].value = (void *) user_addr;
-		else
-			req->out.args[0].value = (void *) user_addr;
-
-		iov_iter_advance(ii, frag_size);
-		*nbytesp = frag_size;
-		return 0;
-	}
-
 	while (nbytes < *nbytesp && req->num_pages < req->max_pages) {
 		unsigned npages;
 		unsigned long user_addr = fuse_get_user_addr(ii);
@@ -3640,32 +3625,6 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
 	return ret;
 }
 
-static ssize_t fuse_direct_IO_page(int rw, struct kiocb *iocb,
-	struct page *page, loff_t offset)
-{
-	struct iovec iov;
-	mm_segment_t oldfs;
-	ssize_t ret;
-
-	iov.iov_base = kmap(page);
-	iov.iov_len = PAGE_SIZE;
-
-	oldfs = get_fs();
-	set_fs(KERNEL_DS);
-
-	ret = fuse_direct_IO(rw, iocb, &iov, offset, 1);
-	if (ret != -EIOCBQUEUED && ret != PAGE_SIZE)
-		printk("fuse_direct_IO_page: io failed with err=%ld "
-		       "(rw=%s fh=0x%llx pos=%lld)\n",
-		       ret, rw == WRITE ? "WRITE" : "READ",
-		       ((struct fuse_file *)iocb->ki_filp->private_data)->fh,
-		       offset);
-
-	set_fs(oldfs);
-	kunmap(page);
-	return ret;
-}
-
 static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
 				loff_t length)
 {
@@ -3839,7 +3798,7 @@ static int fuse_request_fiemap(struct inode *inode, u32 cur_max,
 
 		err = -ENOMEM;
 		for (allocated = 0; allocated < npages; allocated++) {
-			req->pages[allocated] = alloc_page(GFP_KERNEL | __GFP_HIGHMEM);
+			req->pages[allocated] = alloc_page(GFP_KERNEL| __GFP_HIGHMEM);
 			if (!req->pages[allocated])
 				goto out;
 			req->page_descs[allocated].length = PAGE_SIZE;
@@ -4025,7 +3984,6 @@ static const struct address_space_operations fuse_file_aops  = {
 	.bmap		= fuse_bmap,
 	.direct_IO	= fuse_direct_IO,
 	.direct_IO_bvec	= fuse_direct_IO_bvec,
-	.direct_IO_page	= fuse_direct_IO_page,
 	.write_begin	= fuse_write_begin,
 	.write_end	= fuse_write_end,
 };


More information about the Devel mailing list