All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: virtio-fs@redhat.com
Subject: [Virtio-fs] [PATCH 1/3] fuse: Get rid of file parameter from setup mapping
Date: Fri, 26 Jul 2019 11:49:46 -0400	[thread overview]
Message-ID: <20190726154948.28540-2-vgoyal@redhat.com> (raw)
In-Reply-To: <20190726154948.28540-1-vgoyal@redhat.com>

There is only one caller of fuse_setup_one_mapping() and that passes file
argument as NULL. So get rid of this parameter as there are no callers.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
 fs/fuse/file.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index fc40e0f44578..93f8e62e2b5b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -264,41 +264,26 @@ static void dmap_add_to_free_pool(struct fuse_conn *fc,
 }
 
 /* offset passed in should be aligned to FUSE_DAX_MEM_RANGE_SZ */
-static int fuse_setup_one_mapping(struct inode *inode,
-				struct file *file, loff_t offset,
-				struct fuse_dax_mapping *dmap)
+static int fuse_setup_one_mapping(struct inode *inode, loff_t offset,
+				  struct fuse_dax_mapping *dmap)
 {
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	struct fuse_inode *fi = get_fuse_inode(inode);
-	struct fuse_file *ff = NULL;
 	struct fuse_setupmapping_in inarg;
 	FUSE_ARGS(args);
 	ssize_t err;
 
-	if (file)
-		ff = file->private_data;
-
 	WARN_ON(offset % FUSE_DAX_MEM_RANGE_SZ);
 	WARN_ON(fc->nr_free_ranges < 0);
 
 	/* Ask fuse daemon to setup mapping */
 	memset(&inarg, 0, sizeof(inarg));
 	inarg.foffset = offset;
-	if (ff)
-		inarg.fh = ff->fh;
-	else
-		inarg.fh = -1;
+	inarg.fh = -1;
 	inarg.moffset = dmap->window_offset;
 	inarg.len = FUSE_DAX_MEM_RANGE_SZ;
-	if (file) {
-		inarg.flags |= (file->f_mode & FMODE_WRITE) ?
-				FUSE_SETUPMAPPING_FLAG_WRITE : 0;
-		inarg.flags |= (file->f_mode & FMODE_READ) ?
-				FUSE_SETUPMAPPING_FLAG_READ : 0;
-	} else {
-		inarg.flags |= FUSE_SETUPMAPPING_FLAG_READ;
-		inarg.flags |= FUSE_SETUPMAPPING_FLAG_WRITE;
-	}
+	inarg.flags |= FUSE_SETUPMAPPING_FLAG_READ;
+	inarg.flags |= FUSE_SETUPMAPPING_FLAG_WRITE;
 	args.in.h.opcode = FUSE_SETUPMAPPING;
 	args.in.h.nodeid = fi->nodeid;
 	args.in.numargs = 1;
@@ -1985,9 +1970,8 @@ static int fuse_iomap_begin(struct inode *inode, loff_t pos, loff_t length,
 		}
 
 		/* Setup one mapping */
-		ret = fuse_setup_one_mapping(inode, NULL,
-				ALIGN_DOWN(pos, FUSE_DAX_MEM_RANGE_SZ),
-				alloc_dmap);
+		ret = fuse_setup_one_mapping(inode,
+			ALIGN_DOWN(pos, FUSE_DAX_MEM_RANGE_SZ), alloc_dmap);
 		if (ret < 0) {
 			printk("fuse_setup_one_mapping() failed. err=%d"
 				" pos=0x%llx\n", ret, pos);
-- 
2.17.2


  reply	other threads:[~2019-07-26 15:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26 15:49 [Virtio-fs] [PATCH 0/3][V2] virtio-fs: Create a read-write mapping only if needed Vivek Goyal
2019-07-26 15:49 ` Vivek Goyal [this message]
2019-07-26 15:49 ` [Virtio-fs] [PATCH 2/3] fuse: Move new mapping setup code in a function Vivek Goyal
2019-07-26 15:49 ` [Virtio-fs] [PATCH 3/3] fuse: Add logic to upgrade a read-only mapping to read-write Vivek Goyal
2019-08-04  1:56   ` piaojun
2019-08-05 12:25     ` Vivek Goyal
2019-08-05 12:34       ` piaojun
  -- strict thread matches above, loose matches on Subject: below --
2019-07-24 21:07 [Virtio-fs] [PATCH 0/3] virtio-fs: Create a read-write mapping only if needed Vivek Goyal
2019-07-24 21:07 ` [Virtio-fs] [PATCH 1/3] fuse: Get rid of file parameter from setup mapping Vivek Goyal
2019-07-26  1:23   ` Liu Bo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190726154948.28540-2-vgoyal@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=virtio-fs@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.