add virtio-fs
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSQHSd0lITzzeNWNm3h3BK/laaZPAUCXYx2zAAKCRDh3BK/laaZ PFpHAQD2G+F8a9e41jFTJg5YpNKMD8/Pl4T6v9chIO9qPXF2IAEAji0P1JterRfv ixiBhv54hSwYbk527nxNWE9tP5gAHAQ= =WCHy -----END PGP SIGNATURE----- Merge tag 'virtio-fs-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse Pull fuse virtio-fs support from Miklos Szeredi: "Virtio-fs allows exporting directory trees on the host and mounting them in guest(s). This isn't actually a new filesystem, but a glue layer between the fuse filesystem and a virtio based back-end. It's similar in functionality to the existing virtio-9p solution, but significantly faster in benchmarks and has better POSIX compliance. Further permformance improvements can be achieved by sharing the page cache between host and guest, allowing for faster I/O and reduced memory use. Kata Containers have been including the out-of-tree virtio-fs (with the shared page cache patches as well) since version 1.7 as an experimental feature. They have been active in development and plan to switch from virtio-9p to virtio-fs as their default solution. There has been interest from other sources as well. The userspace infrastructure is slated to be merged into qemu once the kernel part hits mainline. This was developed by Vivek Goyal, Dave Gilbert and Stefan Hajnoczi" * tag 'virtio-fs-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse: virtio-fs: add virtiofs filesystem virtio-fs: add Documentation/filesystems/virtiofs.rst fuse: reserve values for mapping protocol
This commit is contained in:
Коммит
8f744bdee4
|
@ -37,3 +37,13 @@ filesystem implementations.
|
|||
journalling
|
||||
fscrypt
|
||||
fsverity
|
||||
|
||||
Filesystems
|
||||
===========
|
||||
|
||||
Documentation for filesystem implementations.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
virtiofs
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
.. SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
===================================================
|
||||
virtiofs: virtio-fs host<->guest shared file system
|
||||
===================================================
|
||||
|
||||
- Copyright (C) 2019 Red Hat, Inc.
|
||||
|
||||
Introduction
|
||||
============
|
||||
The virtiofs file system for Linux implements a driver for the paravirtualized
|
||||
VIRTIO "virtio-fs" device for guest<->host file system sharing. It allows a
|
||||
guest to mount a directory that has been exported on the host.
|
||||
|
||||
Guests often require access to files residing on the host or remote systems.
|
||||
Use cases include making files available to new guests during installation,
|
||||
booting from a root file system located on the host, persistent storage for
|
||||
stateless or ephemeral guests, and sharing a directory between guests.
|
||||
|
||||
Although it is possible to use existing network file systems for some of these
|
||||
tasks, they require configuration steps that are hard to automate and they
|
||||
expose the storage network to the guest. The virtio-fs device was designed to
|
||||
solve these problems by providing file system access without networking.
|
||||
|
||||
Furthermore the virtio-fs device takes advantage of the co-location of the
|
||||
guest and host to increase performance and provide semantics that are not
|
||||
possible with network file systems.
|
||||
|
||||
Usage
|
||||
=====
|
||||
Mount file system with tag ``myfs`` on ``/mnt``:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
guest# mount -t virtiofs myfs /mnt
|
||||
|
||||
Please see https://virtio-fs.gitlab.io/ for details on how to configure QEMU
|
||||
and the virtiofsd daemon.
|
||||
|
||||
Internals
|
||||
=========
|
||||
Since the virtio-fs device uses the FUSE protocol for file system requests, the
|
||||
virtiofs file system for Linux is integrated closely with the FUSE file system
|
||||
client. The guest acts as the FUSE client while the host acts as the FUSE
|
||||
server. The /dev/fuse interface between the kernel and userspace is replaced
|
||||
with the virtio-fs device interface.
|
||||
|
||||
FUSE requests are placed into a virtqueue and processed by the host. The
|
||||
response portion of the buffer is filled in by the host and the guest handles
|
||||
the request completion.
|
||||
|
||||
Mapping /dev/fuse to virtqueues requires solving differences in semantics
|
||||
between /dev/fuse and virtqueues. Each time the /dev/fuse device is read, the
|
||||
FUSE client may choose which request to transfer, making it possible to
|
||||
prioritize certain requests over others. Virtqueues have queue semantics and
|
||||
it is not possible to change the order of requests that have been enqueued.
|
||||
This is especially important if the virtqueue becomes full since it is then
|
||||
impossible to add high priority requests. In order to address this difference,
|
||||
the virtio-fs device uses a "hiprio" virtqueue specifically for requests that
|
||||
have priority over normal requests.
|
12
MAINTAINERS
12
MAINTAINERS
|
@ -17280,6 +17280,18 @@ S: Supported
|
|||
F: drivers/s390/virtio/
|
||||
F: arch/s390/include/uapi/asm/virtio-ccw.h
|
||||
|
||||
VIRTIO FILE SYSTEM
|
||||
M: Vivek Goyal <vgoyal@redhat.com>
|
||||
M: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
M: Miklos Szeredi <miklos@szeredi.hu>
|
||||
L: virtualization@lists.linux-foundation.org
|
||||
L: linux-fsdevel@vger.kernel.org
|
||||
W: https://virtio-fs.gitlab.io/
|
||||
S: Supported
|
||||
F: fs/fuse/virtio_fs.c
|
||||
F: include/uapi/linux/virtio_fs.h
|
||||
F: Documentation/filesystems/virtiofs.rst
|
||||
|
||||
VIRTIO GPU DRIVER
|
||||
M: David Airlie <airlied@linux.ie>
|
||||
M: Gerd Hoffmann <kraxel@redhat.com>
|
||||
|
|
|
@ -27,3 +27,14 @@ config CUSE
|
|||
|
||||
If you want to develop or use a userspace character device
|
||||
based on CUSE, answer Y or M.
|
||||
|
||||
config VIRTIO_FS
|
||||
tristate "Virtio Filesystem"
|
||||
depends on FUSE_FS
|
||||
select VIRTIO
|
||||
help
|
||||
The Virtio Filesystem allows guests to mount file systems from the
|
||||
host.
|
||||
|
||||
If you want to share files between guests or with the host, answer Y
|
||||
or M.
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
obj-$(CONFIG_FUSE_FS) += fuse.o
|
||||
obj-$(CONFIG_CUSE) += cuse.o
|
||||
obj-$(CONFIG_VIRTIO_FS) += virtio_fs.o
|
||||
|
||||
fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o
|
||||
|
|
|
@ -353,6 +353,10 @@ struct fuse_req {
|
|||
/** Used to wake up the task waiting for completion of request*/
|
||||
wait_queue_head_t waitq;
|
||||
|
||||
#if IS_ENABLED(CONFIG_VIRTIO_FS)
|
||||
/** virtio-fs's physically contiguous buffer for in and out args */
|
||||
void *argbuf;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct fuse_iqueue;
|
||||
|
@ -383,6 +387,11 @@ struct fuse_iqueue_ops {
|
|||
*/
|
||||
void (*wake_pending_and_unlock)(struct fuse_iqueue *fiq)
|
||||
__releases(fiq->lock);
|
||||
|
||||
/**
|
||||
* Clean up when fuse_iqueue is destroyed
|
||||
*/
|
||||
void (*release)(struct fuse_iqueue *fiq);
|
||||
};
|
||||
|
||||
/** /dev/fuse input queue operations */
|
||||
|
|
|
@ -630,6 +630,10 @@ EXPORT_SYMBOL_GPL(fuse_conn_init);
|
|||
void fuse_conn_put(struct fuse_conn *fc)
|
||||
{
|
||||
if (refcount_dec_and_test(&fc->count)) {
|
||||
struct fuse_iqueue *fiq = &fc->iq;
|
||||
|
||||
if (fiq->ops->release)
|
||||
fiq->ops->release(fiq);
|
||||
put_pid_ns(fc->pid_ns);
|
||||
put_user_ns(fc->user_ns);
|
||||
fc->release(fc);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -133,6 +133,8 @@
|
|||
*
|
||||
* 7.31
|
||||
* - add FUSE_WRITE_KILL_PRIV flag
|
||||
* - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
|
||||
* - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_FUSE_H
|
||||
|
@ -274,6 +276,7 @@ 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: map_alignment field is valid
|
||||
*/
|
||||
#define FUSE_ASYNC_READ (1 << 0)
|
||||
#define FUSE_POSIX_LOCKS (1 << 1)
|
||||
|
@ -301,6 +304,7 @@ 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
|
||||
|
@ -422,6 +426,8 @@ enum fuse_opcode {
|
|||
FUSE_RENAME2 = 45,
|
||||
FUSE_LSEEK = 46,
|
||||
FUSE_COPY_FILE_RANGE = 47,
|
||||
FUSE_SETUPMAPPING = 48,
|
||||
FUSE_REMOVEMAPPING = 49,
|
||||
|
||||
/* CUSE specific operations */
|
||||
CUSE_INIT = 4096,
|
||||
|
@ -656,7 +662,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];
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
|
||||
|
||||
#ifndef _UAPI_LINUX_VIRTIO_FS_H
|
||||
#define _UAPI_LINUX_VIRTIO_FS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/virtio_ids.h>
|
||||
#include <linux/virtio_config.h>
|
||||
#include <linux/virtio_types.h>
|
||||
|
||||
struct virtio_fs_config {
|
||||
/* Filesystem name (UTF-8, not NUL-terminated, padded with NULs) */
|
||||
__u8 tag[36];
|
||||
|
||||
/* Number of request queues */
|
||||
__u32 num_request_queues;
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif /* _UAPI_LINUX_VIRTIO_FS_H */
|
|
@ -44,6 +44,7 @@
|
|||
#define VIRTIO_ID_VSOCK 19 /* virtio vsock transport */
|
||||
#define VIRTIO_ID_CRYPTO 20 /* virtio crypto */
|
||||
#define VIRTIO_ID_IOMMU 23 /* virtio IOMMU */
|
||||
#define VIRTIO_ID_FS 26 /* virtio filesystem */
|
||||
#define VIRTIO_ID_PMEM 27 /* virtio pmem */
|
||||
|
||||
#endif /* _LINUX_VIRTIO_IDS_H */
|
||||
|
|
Загрузка…
Ссылка в новой задаче