linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Fuse definitions for virtiofs
@ 2019-08-02 17:15 Dr. David Alan Gilbert (git)
  2019-08-02 17:15 ` [PATCH 1/3] fuse: Add 'setupmapping' Dr. David Alan Gilbert (git)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-08-02 17:15 UTC (permalink / raw)
  To: linux-fsdevel, miklos, Nikolaus; +Cc: stefanha, vgoyal, tao.peng

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Hi,
  Virtiofs is a fuse-over-virtio filesystem to allow
virtual machines to access a fileystem easily, it's
currently in development, and we'd like to try and
get some of our structures and commands stabilised.
Since it runs over virtio, a spec is currently running through
the virtio standardisation process, and they'd like to
see the additional Fuse commands nailed down.  Also we'd
like to stop chasing bit/command number allocation.

The additions included here provide a performance feature
that lets the daemon map files into the hypervisor and thus
guests address space, allowing a DAX like mapping.

Note:
  For you following these patches in virtiofs, I've
made three changes:
     a) Remove the unused 'fh' field from removemapping
     b) Change the 'map_alignment' field to be log2(size) and
        use up the current uint16_t padding rather than eating
        a fresh uint32_t
     c) Moved FUSE_MAP_ALIGNMENT along one bit since
        FUSE_EXPLICIT_INVAL_DATA used up bit 25.

References:
    virtiofs home page: https://virtio-fs.gitlab.io/
    virtio-fs specification patches: https://lists.oasis-open.org/archives/virtio-dev/201907/msg00052.html

Dave

Dr. David Alan Gilbert (3):
  fuse: Add 'setupmapping'
  fuse: add 'removemapping'
  fuse: Add map_alignment for setup/remove mapping

 include/uapi/linux/fuse.h | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] fuse: Add 'setupmapping'
  2019-08-02 17:15 [PATCH 0/3] Fuse definitions for virtiofs Dr. David Alan Gilbert (git)
@ 2019-08-02 17:15 ` Dr. David Alan Gilbert (git)
  2019-08-02 17:15 ` [PATCH 2/3] fuse: add 'removemapping' Dr. David Alan Gilbert (git)
  2019-08-02 17:15 ` [PATCH 3/3] fuse: Add map_alignment for setup/remove mapping Dr. David Alan Gilbert (git)
  2 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-08-02 17:15 UTC (permalink / raw)
  To: linux-fsdevel, miklos, Nikolaus; +Cc: stefanha, vgoyal, tao.peng

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

'setupmapping' is a command for use with 'virtiofsd', a fuse-over-virtio
implementation; it may find use in other fuse impelementations as well
in which the kernel does not have access to the address space of the
daemon directly.

A 'setupmapping' operation causes a section of a file to be mapped
into a memory window visible to the kernel.
The offsets in the file and the window are defined by the kernel performing
the operation.

The daemon may reject the request, for reasons including permissions and
limited resources.

When a request perfectly overlaps a previous mapping, the
previous mapping is replaced.  When a mapping partially overlaps a previous
mapping, the previous mapping is split into one or two smaller mappings.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 include/uapi/linux/fuse.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 2971d29a42e4..fb79d4d0b3a7 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -133,6 +133,7 @@
  *
  *  7.31
  *  - add FUSE_WRITE_KILL_PRIV flag
+ *  - add FUSE_SETUPMAPPING
  */
 
 #ifndef _LINUX_FUSE_H
@@ -422,6 +423,7 @@ enum fuse_opcode {
 	FUSE_RENAME2		= 45,
 	FUSE_LSEEK		= 46,
 	FUSE_COPY_FILE_RANGE	= 47,
+	FUSE_SETUPMAPPING	= 48,
 
 	/* CUSE specific operations */
 	CUSE_INIT		= 4096,
@@ -845,4 +847,19 @@ struct fuse_copy_file_range_in {
 	uint64_t	flags;
 };
 
+#define FUSE_SETUPMAPPING_FLAG_WRITE	(1ull << 0)
+#define FUSE_SETUPMAPPING_FLAG_READ	(1ull << 1)
+struct fuse_setupmapping_in {
+	/* An already open handle */
+	uint64_t	fh;
+	/* Offset into the file to start the mapping */
+	uint64_t	foffset;
+	/* Length of mapping required */
+	uint64_t	len;
+	/* Flags, FUSE_SETUPMAPPING_FLAG_* */
+	uint64_t	flags;
+	/* Offset in Memory Window */
+	uint64_t	moffset;
+};
+
 #endif /* _LINUX_FUSE_H */
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] fuse: add 'removemapping'
  2019-08-02 17:15 [PATCH 0/3] Fuse definitions for virtiofs Dr. David Alan Gilbert (git)
  2019-08-02 17:15 ` [PATCH 1/3] fuse: Add 'setupmapping' Dr. David Alan Gilbert (git)
@ 2019-08-02 17:15 ` Dr. David Alan Gilbert (git)
  2019-08-02 17:15 ` [PATCH 3/3] fuse: Add map_alignment for setup/remove mapping Dr. David Alan Gilbert (git)
  2 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-08-02 17:15 UTC (permalink / raw)
  To: linux-fsdevel, miklos, Nikolaus; +Cc: stefanha, vgoyal, tao.peng

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

'removemapping' is the complement to 'setupmapping', it unmaps
a range of mapped files from the window visible to the kernel.

A 'removemapping' call consists of 'count' regions to unmap,
each consisting of an offset and length.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Peng Tao <tao.peng@linux.alibaba.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/uapi/linux/fuse.h | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index fb79d4d0b3a7..f14eeb5cfc14 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -133,7 +133,7 @@
  *
  *  7.31
  *  - add FUSE_WRITE_KILL_PRIV flag
- *  - add FUSE_SETUPMAPPING
+ *  - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
  */
 
 #ifndef _LINUX_FUSE_H
@@ -424,6 +424,7 @@ enum fuse_opcode {
 	FUSE_LSEEK		= 46,
 	FUSE_COPY_FILE_RANGE	= 47,
 	FUSE_SETUPMAPPING	= 48,
+	FUSE_REMOVEMAPPING	= 49,
 
 	/* CUSE specific operations */
 	CUSE_INIT		= 4096,
@@ -862,4 +863,16 @@ struct fuse_setupmapping_in {
 	uint64_t	moffset;
 };
 
+struct fuse_removemapping_in {
+	/* number of fuse_removemapping_one following */
+	uint32_t	count;
+};
+
+struct fuse_removemapping_one {
+	/* Offset into the dax window at start of unmapping */
+	uint64_t	moffset;
+	/* Length of unmapping required */
+	uint64_t	len;
+};
+
 #endif /* _LINUX_FUSE_H */
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] fuse: Add map_alignment for setup/remove mapping
  2019-08-02 17:15 [PATCH 0/3] Fuse definitions for virtiofs Dr. David Alan Gilbert (git)
  2019-08-02 17:15 ` [PATCH 1/3] fuse: Add 'setupmapping' Dr. David Alan Gilbert (git)
  2019-08-02 17:15 ` [PATCH 2/3] fuse: add 'removemapping' Dr. David Alan Gilbert (git)
@ 2019-08-02 17:15 ` Dr. David Alan Gilbert (git)
  2 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-08-02 17:15 UTC (permalink / raw)
  To: linux-fsdevel, miklos, Nikolaus; +Cc: stefanha, vgoyal, tao.peng

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

This new FUSE_INIT field communicates the alignment constraint for
FUSE_SETUPMAPPING/FUSE_REMOVEMAPPING and allows the daemon to
constrain the addresses and file offsets chosen by the kernel.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/uapi/linux/fuse.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index f14eeb5cfc14..65c2136d112e 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -134,6 +134,7 @@
  *  7.31
  *  - add FUSE_WRITE_KILL_PRIV flag
  *  - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
+ *  - add map_alignment to fuse_init_out
  */
 
 #ifndef _LINUX_FUSE_H
@@ -275,6 +276,9 @@ struct fuse_file_lock {
  * FUSE_CACHE_SYMLINKS: cache READLINK responses
  * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
  * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
+ * FUSE_MAP_ALIGNMENT: init_out.map_alignment contains log2(byte alignment) for
+ *                     foffset and moffset fields in struct
+ *                     fuse_setupmapping_in and fuse_removemapping_one.
  */
 #define FUSE_ASYNC_READ		(1 << 0)
 #define FUSE_POSIX_LOCKS	(1 << 1)
@@ -302,6 +306,8 @@ struct fuse_file_lock {
 #define FUSE_CACHE_SYMLINKS	(1 << 23)
 #define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
 #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
+#define FUSE_MAP_ALIGNMENT	(1 << 26)
+
 
 /**
  * CUSE INIT request/reply flags
@@ -655,7 +661,7 @@ struct fuse_init_out {
 	uint32_t	max_write;
 	uint32_t	time_gran;
 	uint16_t	max_pages;
-	uint16_t	padding;
+	uint16_t	map_alignment;
 	uint32_t	unused[8];
 };
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-02 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 17:15 [PATCH 0/3] Fuse definitions for virtiofs Dr. David Alan Gilbert (git)
2019-08-02 17:15 ` [PATCH 1/3] fuse: Add 'setupmapping' Dr. David Alan Gilbert (git)
2019-08-02 17:15 ` [PATCH 2/3] fuse: add 'removemapping' Dr. David Alan Gilbert (git)
2019-08-02 17:15 ` [PATCH 3/3] fuse: Add map_alignment for setup/remove mapping Dr. David Alan Gilbert (git)

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).