qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org, virtio-fs@redhat.com
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 3/3] virtiofsd: implement FUSE_INIT map_alignment field
Date: Fri, 26 Jul 2019 09:33:22 +0100	[thread overview]
Message-ID: <20190726083322.13637-4-stefanha@redhat.com> (raw)
In-Reply-To: <20190726083322.13637-1-stefanha@redhat.com>

Communicate the host page size to the FUSE client so that
FUSE_SETUPMAPPING/FUSE_REMOVEMAPPING requests are aware of our alignment
constraints.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 contrib/virtiofsd/fuse_lowlevel.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/contrib/virtiofsd/fuse_lowlevel.c b/contrib/virtiofsd/fuse_lowlevel.c
index dbbfda78bf..452dd6b2b0 100644
--- a/contrib/virtiofsd/fuse_lowlevel.c
+++ b/contrib/virtiofsd/fuse_lowlevel.c
@@ -2131,6 +2131,12 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,
 	}
 	if (se->conn.proto_minor >= 23)
 		outarg.time_gran = se->conn.time_gran;
+	if (arg->flags & FUSE_MAP_ALIGNMENT) {
+		outarg.flags |= FUSE_MAP_ALIGNMENT;
+
+		/* This constraint comes from mmap(2) and munmap(2) */
+		outarg.map_alignment = sysconf(_SC_PAGE_SIZE);
+	}
 
 	if (se->debug) {
 		fuse_debug("   INIT: %u.%u\n", outarg.major, outarg.minor);
@@ -2144,6 +2150,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,
 			   outarg.congestion_threshold);
 		fuse_debug("   time_gran=%u\n",
 			   outarg.time_gran);
+		fuse_debug("   map_alignment=%u\n",
+			   outarg.map_alignment);
 	}
 	if (arg->minor < 5)
 		outargsize = FUSE_COMPAT_INIT_OUT_SIZE;
-- 
2.21.0



  parent reply	other threads:[~2019-07-26  8:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26  8:33 [Qemu-devel] [PATCH 0/3] virtiofsd: add FUSE_INIT map_alignment field Stefan Hajnoczi
2019-07-26  8:33 ` [Qemu-devel] [PATCH 1/3] virtiofsd: sync up fuse.h Linux 5.1 header Stefan Hajnoczi
2019-07-26  8:33 ` [Qemu-devel] [PATCH 2/3] virtiofsd: add map_alignment to fuse_kernel.h Stefan Hajnoczi
2019-07-26  8:33 ` Stefan Hajnoczi [this message]
2019-07-29  9:25 ` [Qemu-devel] [PATCH 0/3] virtiofsd: add FUSE_INIT map_alignment field Dr. David Alan Gilbert

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=20190726083322.13637-4-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --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 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).