1 | The following changes since commit fe8ee082db5038a05dbd8872e946049e9a9c550e: | 1 | The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-02-22' into staging (2017-02-24 15:00:51 +0000) | 3 | Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request | 7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 1d393bdeae22fde2cb83c1ea719675747c85c40e: | 9 | for you to fetch changes up to d45c83328feab2e4083991693160f0a417cfd9b0: |
10 | 10 | ||
11 | RBD: Add support readv,writev for rbd (2017-02-24 12:43:01 -0500) | 11 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option (2022-04-21 12:05:15 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches for 2.9 | 14 | Pull request |
15 | |||
16 | Small contrib/vhost-user-blk, contrib/vhost-user-scsi, and tools/virtiofsd | ||
17 | improvements. | ||
18 | |||
15 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
16 | 20 | ||
17 | Peter Lieven (2): | 21 | Liu Yiding (1): |
18 | block/nfs: convert to preadv / pwritev | 22 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option |
19 | block/nfs: try to avoid the bounce buffer in pwritev | ||
20 | 23 | ||
21 | tianqing (1): | 24 | Sakshi Kaushik (1): |
22 | RBD: Add support readv,writev for rbd | 25 | Implements Backend Program conventions for vhost-user-scsi |
23 | 26 | ||
24 | block/nfs.c | 62 +++++++++++++++++++++++++---------------------- | 27 | Stefan Hajnoczi (1): |
25 | block/rbd.c | 80 ++++++++++++++++++++++++++++++++++++++++++------------------- | 28 | contrib/vhost-user-blk: add missing GOptionEntry NULL terminator |
26 | 2 files changed, 90 insertions(+), 52 deletions(-) | 29 | |
30 | docs/tools/virtiofsd.rst | 5 ++ | ||
31 | contrib/vhost-user-blk/vhost-user-blk.c | 3 +- | ||
32 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- | ||
33 | tools/virtiofsd/helper.c | 3 + | ||
34 | 4 files changed, 62 insertions(+), 26 deletions(-) | ||
27 | 35 | ||
28 | -- | 36 | -- |
29 | 2.9.3 | 37 | 2.35.1 |
30 | |||
31 | diff view generated by jsdifflib |
1 | From: Peter Lieven <pl@kamp.de> | 1 | From: Sakshi Kaushik <sakshikaushik717@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | if the passed qiov contains exactly one iov we can | 3 | Signed-off-by: Sakshi Kaushik <sakshikaushik717@gmail.com> |
4 | pass the buffer directly. | 4 | Message-id: 20220406162410.8536-1-sakshikaushik717@gmail.com |
5 | 5 | ||
6 | Signed-off-by: Peter Lieven <pl@kamp.de> | 6 | [Name the iSCSI URL long option --iscsi-uri instead of --iscsi_uri for |
7 | Reviewed-by: Jeff Cody <jcody@redhat.com> | 7 | consistency, fix --fd which was rejected due to an outdated |
8 | Message-id: 1487349541-10201-3-git-send-email-pl@kamp.de | 8 | --socket-path check, and add missing entries[] terminator. |
9 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 9 | --Stefan] |
10 | |||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
10 | --- | 12 | --- |
11 | block/nfs.c | 35 ++++++++++++++++++++++------------- | 13 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- |
12 | 1 file changed, 22 insertions(+), 13 deletions(-) | 14 | 1 file changed, 52 insertions(+), 25 deletions(-) |
13 | 15 | ||
14 | diff --git a/block/nfs.c b/block/nfs.c | 16 | diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/block/nfs.c | 18 | --- a/contrib/vhost-user-scsi/vhost-user-scsi.c |
17 | +++ b/block/nfs.c | 19 | +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c |
18 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn nfs_co_pwritev(BlockDriverState *bs, uint64_t offset, | 20 | @@ -XXX,XX +XXX,XX @@ fail: |
19 | NFSClient *client = bs->opaque; | 21 | |
20 | NFSRPC task; | 22 | /** vhost-user-scsi **/ |
21 | char *buf = NULL; | 23 | |
22 | + bool my_buffer = false; | 24 | +static int opt_fdnum = -1; |
23 | 25 | +static char *opt_socket_path; | |
24 | nfs_co_init_task(bs, &task); | 26 | +static gboolean opt_print_caps; |
25 | 27 | +static char *iscsi_uri; | |
26 | - buf = g_try_malloc(bytes); | 28 | + |
27 | - if (bytes && buf == NULL) { | 29 | +static GOptionEntry entries[] = { |
28 | - return -ENOMEM; | 30 | + { "print-capabilities", 'c', 0, G_OPTION_ARG_NONE, &opt_print_caps, |
29 | + if (iov->niov != 1) { | 31 | + "Print capabilities", NULL }, |
30 | + buf = g_try_malloc(bytes); | 32 | + { "fd", 'f', 0, G_OPTION_ARG_INT, &opt_fdnum, |
31 | + if (bytes && buf == NULL) { | 33 | + "Use inherited fd socket", "FDNUM" }, |
32 | + return -ENOMEM; | 34 | + { "iscsi-uri", 'i', 0, G_OPTION_ARG_FILENAME, &iscsi_uri, |
33 | + } | 35 | + "iSCSI URI to connect to", "FDNUM" }, |
34 | + qemu_iovec_to_buf(iov, 0, buf, bytes); | 36 | + { "socket-path", 's', 0, G_OPTION_ARG_FILENAME, &opt_socket_path, |
35 | + my_buffer = true; | 37 | + "Use UNIX socket path", "PATH" }, |
36 | + } else { | 38 | + { NULL, } |
37 | + buf = iov->iov[0].iov_base; | 39 | +}; |
38 | } | 40 | + |
39 | 41 | int main(int argc, char **argv) | |
40 | - qemu_iovec_to_buf(iov, 0, buf, bytes); | 42 | { |
41 | - | 43 | VusDev *vdev_scsi = NULL; |
42 | if (nfs_pwrite_async(client->context, client->fh, | 44 | - char *unix_fn = NULL; |
43 | offset, bytes, buf, | 45 | - char *iscsi_uri = NULL; |
44 | nfs_co_generic_cb, &task) != 0) { | 46 | - int lsock = -1, csock = -1, opt, err = EXIT_SUCCESS; |
45 | + if (my_buffer) { | 47 | + int lsock = -1, csock = -1, err = EXIT_SUCCESS; |
46 | + g_free(buf); | 48 | |
47 | + } | 49 | - while ((opt = getopt(argc, argv, "u:i:")) != -1) { |
48 | + return -ENOMEM; | 50 | - switch (opt) { |
51 | - case 'h': | ||
52 | - goto help; | ||
53 | - case 'u': | ||
54 | - unix_fn = g_strdup(optarg); | ||
55 | - break; | ||
56 | - case 'i': | ||
57 | - iscsi_uri = g_strdup(optarg); | ||
58 | - break; | ||
59 | - default: | ||
60 | - goto help; | ||
61 | - } | ||
62 | + GError *error = NULL; | ||
63 | + GOptionContext *context; | ||
64 | + | ||
65 | + context = g_option_context_new(NULL); | ||
66 | + g_option_context_add_main_entries(context, entries, NULL); | ||
67 | + if (!g_option_context_parse(context, &argc, &argv, &error)) { | ||
68 | + g_printerr("Option parsing failed: %s\n", error->message); | ||
69 | + exit(EXIT_FAILURE); | ||
49 | + } | 70 | + } |
50 | + | 71 | + |
51 | + nfs_set_events(client); | 72 | + if (opt_print_caps) { |
52 | + while (!task.complete) { | 73 | + g_print("{\n"); |
53 | + qemu_coroutine_yield(); | 74 | + g_print(" \"type\": \"scsi\"\n"); |
54 | + } | 75 | + g_print("}\n"); |
76 | + goto out; | ||
77 | } | ||
78 | - if (!unix_fn || !iscsi_uri) { | ||
55 | + | 79 | + |
56 | + if (my_buffer) { | 80 | + if (!iscsi_uri) { |
57 | g_free(buf); | 81 | goto help; |
58 | - return -ENOMEM; | ||
59 | } | 82 | } |
60 | 83 | ||
61 | - nfs_set_events(client); | 84 | - lsock = unix_sock_new(unix_fn); |
62 | - while (!task.complete) { | 85 | - if (lsock < 0) { |
63 | - qemu_coroutine_yield(); | 86 | - goto err; |
64 | - } | 87 | + if (opt_socket_path) { |
65 | - | 88 | + lsock = unix_sock_new(opt_socket_path); |
66 | - g_free(buf); | 89 | + if (lsock < 0) { |
67 | - | 90 | + exit(EXIT_FAILURE); |
68 | if (task.ret != bytes) { | 91 | + } |
69 | return task.ret < 0 ? task.ret : -EIO; | 92 | + } else if (opt_fdnum < 0) { |
93 | + g_print("%s\n", g_option_context_get_help(context, true, NULL)); | ||
94 | + exit(EXIT_FAILURE); | ||
95 | + } else { | ||
96 | + lsock = opt_fdnum; | ||
70 | } | 97 | } |
98 | |||
99 | csock = accept(lsock, NULL, NULL); | ||
100 | @@ -XXX,XX +XXX,XX @@ out: | ||
101 | if (vdev_scsi) { | ||
102 | g_main_loop_unref(vdev_scsi->loop); | ||
103 | g_free(vdev_scsi); | ||
104 | - unlink(unix_fn); | ||
105 | + unlink(opt_socket_path); | ||
106 | } | ||
107 | if (csock >= 0) { | ||
108 | close(csock); | ||
109 | @@ -XXX,XX +XXX,XX @@ out: | ||
110 | if (lsock >= 0) { | ||
111 | close(lsock); | ||
112 | } | ||
113 | - g_free(unix_fn); | ||
114 | + g_free(opt_socket_path); | ||
115 | g_free(iscsi_uri); | ||
116 | |||
117 | return err; | ||
118 | @@ -XXX,XX +XXX,XX @@ err: | ||
119 | goto out; | ||
120 | |||
121 | help: | ||
122 | - fprintf(stderr, "Usage: %s [ -u unix_sock_path -i iscsi_uri ] | [ -h ]\n", | ||
123 | + fprintf(stderr, "Usage: %s [ -s socket-path -i iscsi-uri -f fd -p print-capabilities ] | [ -h ]\n", | ||
124 | argv[0]); | ||
125 | - fprintf(stderr, " -u path to unix socket\n"); | ||
126 | - fprintf(stderr, " -i iscsi uri for lun 0\n"); | ||
127 | + fprintf(stderr, " -s, --socket-path=SOCKET_PATH path to unix socket\n"); | ||
128 | + fprintf(stderr, " -i, --iscsi-uri=ISCSI_URI iscsi uri for lun 0\n"); | ||
129 | + fprintf(stderr, " -f, --fd=FILE_DESCRIPTOR file-descriptor\n"); | ||
130 | + fprintf(stderr, " -p, --print-capabilities=PRINT_CAPABILITIES denotes print-capabilities\n"); | ||
131 | fprintf(stderr, " -h print help and quit\n"); | ||
132 | |||
133 | goto err; | ||
71 | -- | 134 | -- |
72 | 2.9.3 | 135 | 2.35.1 |
73 | |||
74 | diff view generated by jsdifflib |
1 | From: tianqing <tianqing@unitedstack.com> | 1 | The GLib documentation says "a NULL-terminated array of GOptionEntrys" |
---|---|---|---|
2 | so we'd better make sure there is a terminator that lets | ||
3 | g_option_context_add_main_entries() know when the end of the array has | ||
4 | been reached. | ||
2 | 5 | ||
3 | Rbd can do readv and writev directly, so wo do not need to transform | 6 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
4 | iov to buf or vice versa any more. | 7 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> |
8 | Message-id: 20220411150057.3009667-1-stefanha@redhat.com | ||
9 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
10 | --- | ||
11 | contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- | ||
12 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
5 | 13 | ||
6 | Signed-off-by: tianqing <tianqing@unitedstack.com> | 14 | diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c |
7 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
8 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
9 | --- | ||
10 | block/rbd.c | 80 ++++++++++++++++++++++++++++++++++++++++++------------------- | ||
11 | 1 file changed, 56 insertions(+), 24 deletions(-) | ||
12 | |||
13 | diff --git a/block/rbd.c b/block/rbd.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/block/rbd.c | 16 | --- a/contrib/vhost-user-blk/vhost-user-blk.c |
16 | +++ b/block/rbd.c | 17 | +++ b/contrib/vhost-user-blk/vhost-user-blk.c |
17 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static GOptionEntry entries[] = { |
18 | #define RBD_MAX_SNAP_NAME_SIZE 128 | 19 | {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file, |
19 | #define RBD_MAX_SNAPS 100 | 20 | "block device or file path", "PATH"}, |
20 | 21 | { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only, | |
21 | +/* The LIBRBD_SUPPORTS_IOVEC is defined in librbd.h */ | 22 | - "Enable read-only", NULL } |
22 | +#ifdef LIBRBD_SUPPORTS_IOVEC | 23 | + "Enable read-only", NULL }, |
23 | +#define LIBRBD_USE_IOVEC 1 | 24 | + { NULL, }, |
24 | +#else | 25 | }; |
25 | +#define LIBRBD_USE_IOVEC 0 | 26 | |
26 | +#endif | 27 | int main(int argc, char **argv) |
27 | + | ||
28 | typedef enum { | ||
29 | RBD_AIO_READ, | ||
30 | RBD_AIO_WRITE, | ||
31 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_set_conf(rados_t cluster, const char *conf, | ||
32 | return ret; | ||
33 | } | ||
34 | |||
35 | +static void qemu_rbd_memset(RADOSCB *rcb, int64_t offs) | ||
36 | +{ | ||
37 | + if (LIBRBD_USE_IOVEC) { | ||
38 | + RBDAIOCB *acb = rcb->acb; | ||
39 | + iov_memset(acb->qiov->iov, acb->qiov->niov, offs, 0, | ||
40 | + acb->qiov->size - offs); | ||
41 | + } else { | ||
42 | + memset(rcb->buf + offs, 0, rcb->size - offs); | ||
43 | + } | ||
44 | +} | ||
45 | + | ||
46 | static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) | ||
47 | { | ||
48 | Error *local_err = NULL; | ||
49 | @@ -XXX,XX +XXX,XX @@ static void qemu_rbd_complete_aio(RADOSCB *rcb) | ||
50 | } | ||
51 | } else { | ||
52 | if (r < 0) { | ||
53 | - memset(rcb->buf, 0, rcb->size); | ||
54 | + qemu_rbd_memset(rcb, 0); | ||
55 | acb->ret = r; | ||
56 | acb->error = 1; | ||
57 | } else if (r < rcb->size) { | ||
58 | - memset(rcb->buf + r, 0, rcb->size - r); | ||
59 | + qemu_rbd_memset(rcb, r); | ||
60 | if (!acb->error) { | ||
61 | acb->ret = rcb->size; | ||
62 | } | ||
63 | @@ -XXX,XX +XXX,XX @@ static void qemu_rbd_complete_aio(RADOSCB *rcb) | ||
64 | |||
65 | g_free(rcb); | ||
66 | |||
67 | - if (acb->cmd == RBD_AIO_READ) { | ||
68 | - qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); | ||
69 | + if (!LIBRBD_USE_IOVEC) { | ||
70 | + if (acb->cmd == RBD_AIO_READ) { | ||
71 | + qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); | ||
72 | + } | ||
73 | + qemu_vfree(acb->bounce); | ||
74 | } | ||
75 | - qemu_vfree(acb->bounce); | ||
76 | + | ||
77 | acb->common.cb(acb->common.opaque, (acb->ret > 0 ? 0 : acb->ret)); | ||
78 | |||
79 | qemu_aio_unref(acb); | ||
80 | @@ -XXX,XX +XXX,XX @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, | ||
81 | RBDAIOCB *acb; | ||
82 | RADOSCB *rcb = NULL; | ||
83 | rbd_completion_t c; | ||
84 | - char *buf; | ||
85 | int r; | ||
86 | |||
87 | BDRVRBDState *s = bs->opaque; | ||
88 | @@ -XXX,XX +XXX,XX @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, | ||
89 | acb->cmd = cmd; | ||
90 | acb->qiov = qiov; | ||
91 | assert(!qiov || qiov->size == size); | ||
92 | - if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) { | ||
93 | - acb->bounce = NULL; | ||
94 | - } else { | ||
95 | - acb->bounce = qemu_try_blockalign(bs, qiov->size); | ||
96 | - if (acb->bounce == NULL) { | ||
97 | - goto failed; | ||
98 | + | ||
99 | + rcb = g_new(RADOSCB, 1); | ||
100 | + | ||
101 | + if (!LIBRBD_USE_IOVEC) { | ||
102 | + if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) { | ||
103 | + acb->bounce = NULL; | ||
104 | + } else { | ||
105 | + acb->bounce = qemu_try_blockalign(bs, qiov->size); | ||
106 | + if (acb->bounce == NULL) { | ||
107 | + goto failed; | ||
108 | + } | ||
109 | } | ||
110 | + if (cmd == RBD_AIO_WRITE) { | ||
111 | + qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); | ||
112 | + } | ||
113 | + rcb->buf = acb->bounce; | ||
114 | } | ||
115 | + | ||
116 | acb->ret = 0; | ||
117 | acb->error = 0; | ||
118 | acb->s = s; | ||
119 | |||
120 | - if (cmd == RBD_AIO_WRITE) { | ||
121 | - qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); | ||
122 | - } | ||
123 | - | ||
124 | - buf = acb->bounce; | ||
125 | - | ||
126 | - rcb = g_new(RADOSCB, 1); | ||
127 | rcb->acb = acb; | ||
128 | - rcb->buf = buf; | ||
129 | rcb->s = acb->s; | ||
130 | rcb->size = size; | ||
131 | r = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c); | ||
132 | @@ -XXX,XX +XXX,XX @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, | ||
133 | |||
134 | switch (cmd) { | ||
135 | case RBD_AIO_WRITE: | ||
136 | - r = rbd_aio_write(s->image, off, size, buf, c); | ||
137 | +#ifdef LIBRBD_SUPPORTS_IOVEC | ||
138 | + r = rbd_aio_writev(s->image, qiov->iov, qiov->niov, off, c); | ||
139 | +#else | ||
140 | + r = rbd_aio_write(s->image, off, size, rcb->buf, c); | ||
141 | +#endif | ||
142 | break; | ||
143 | case RBD_AIO_READ: | ||
144 | - r = rbd_aio_read(s->image, off, size, buf, c); | ||
145 | +#ifdef LIBRBD_SUPPORTS_IOVEC | ||
146 | + r = rbd_aio_readv(s->image, qiov->iov, qiov->niov, off, c); | ||
147 | +#else | ||
148 | + r = rbd_aio_read(s->image, off, size, rcb->buf, c); | ||
149 | +#endif | ||
150 | break; | ||
151 | case RBD_AIO_DISCARD: | ||
152 | r = rbd_aio_discard_wrapper(s->image, off, size, c); | ||
153 | @@ -XXX,XX +XXX,XX @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, | ||
154 | if (r < 0) { | ||
155 | goto failed_completion; | ||
156 | } | ||
157 | - | ||
158 | return &acb->common; | ||
159 | |||
160 | failed_completion: | ||
161 | rbd_aio_release(c); | ||
162 | failed: | ||
163 | g_free(rcb); | ||
164 | - qemu_vfree(acb->bounce); | ||
165 | + if (!LIBRBD_USE_IOVEC) { | ||
166 | + qemu_vfree(acb->bounce); | ||
167 | + } | ||
168 | + | ||
169 | qemu_aio_unref(acb); | ||
170 | return NULL; | ||
171 | } | ||
172 | -- | 28 | -- |
173 | 2.9.3 | 29 | 2.35.1 |
174 | |||
175 | diff view generated by jsdifflib |
1 | From: Peter Lieven <pl@kamp.de> | 1 | From: Liu Yiding <liuyd.fnst@fujitsu.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Peter Lieven <pl@kamp.de> | 3 | virtiofsd has introduced killpriv_v2/no_killpriv_v2 for a while. Add |
4 | Reviewed-by: Jeff Cody <jcody@redhat.com> | 4 | description of it to docs/helper. |
5 | Message-id: 1487349541-10201-2-git-send-email-pl@kamp.de | 5 | |
6 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 6 | Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com> |
7 | Message-Id: <20220421095151.2231099-1-liuyd.fnst@fujitsu.com> | ||
8 | |||
9 | [Small documentation fixes: s/as client supports/as the client supports/ | ||
10 | and s/. /. /. | ||
11 | --Stefan] | ||
12 | |||
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
7 | --- | 14 | --- |
8 | block/nfs.c | 33 +++++++++++++++------------------ | 15 | docs/tools/virtiofsd.rst | 5 +++++ |
9 | 1 file changed, 15 insertions(+), 18 deletions(-) | 16 | tools/virtiofsd/helper.c | 3 +++ |
17 | 2 files changed, 8 insertions(+) | ||
10 | 18 | ||
11 | diff --git a/block/nfs.c b/block/nfs.c | 19 | diff --git a/docs/tools/virtiofsd.rst b/docs/tools/virtiofsd.rst |
12 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/block/nfs.c | 21 | --- a/docs/tools/virtiofsd.rst |
14 | +++ b/block/nfs.c | 22 | +++ b/docs/tools/virtiofsd.rst |
15 | @@ -XXX,XX +XXX,XX @@ nfs_co_generic_cb(int ret, struct nfs_context *nfs, void *data, | 23 | @@ -XXX,XX +XXX,XX @@ Options |
16 | nfs_co_generic_bh_cb, task); | 24 | label. Server will try to set that label on newly created file |
25 | atomically wherever possible. | ||
26 | |||
27 | + * killpriv_v2|no_killpriv_v2 - | ||
28 | + Enable/disable ``FUSE_HANDLE_KILLPRIV_V2`` support. KILLPRIV_V2 is enabled | ||
29 | + by default as long as the client supports it. Enabling this option helps | ||
30 | + with performance in write path. | ||
31 | + | ||
32 | .. option:: --socket-path=PATH | ||
33 | |||
34 | Listen on vhost-user UNIX domain socket at PATH. | ||
35 | diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/tools/virtiofsd/helper.c | ||
38 | +++ b/tools/virtiofsd/helper.c | ||
39 | @@ -XXX,XX +XXX,XX @@ void fuse_cmdline_help(void) | ||
40 | " -o announce_submounts Announce sub-mount points to the guest\n" | ||
41 | " -o posix_acl/no_posix_acl Enable/Disable posix_acl. (default: disabled)\n" | ||
42 | " -o security_label/no_security_label Enable/Disable security label. (default: disabled)\n" | ||
43 | + " -o killpriv_v2/no_killpriv_v2\n" | ||
44 | + " Enable/Disable FUSE_HANDLE_KILLPRIV_V2.\n" | ||
45 | + " (default: enabled as long as client supports it)\n" | ||
46 | ); | ||
17 | } | 47 | } |
18 | 48 | ||
19 | -static int coroutine_fn nfs_co_readv(BlockDriverState *bs, | ||
20 | - int64_t sector_num, int nb_sectors, | ||
21 | - QEMUIOVector *iov) | ||
22 | +static int coroutine_fn nfs_co_preadv(BlockDriverState *bs, uint64_t offset, | ||
23 | + uint64_t bytes, QEMUIOVector *iov, | ||
24 | + int flags) | ||
25 | { | ||
26 | NFSClient *client = bs->opaque; | ||
27 | NFSRPC task; | ||
28 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn nfs_co_readv(BlockDriverState *bs, | ||
29 | task.iov = iov; | ||
30 | |||
31 | if (nfs_pread_async(client->context, client->fh, | ||
32 | - sector_num * BDRV_SECTOR_SIZE, | ||
33 | - nb_sectors * BDRV_SECTOR_SIZE, | ||
34 | - nfs_co_generic_cb, &task) != 0) { | ||
35 | + offset, bytes, nfs_co_generic_cb, &task) != 0) { | ||
36 | return -ENOMEM; | ||
37 | } | ||
38 | |||
39 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn nfs_co_readv(BlockDriverState *bs, | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | -static int coroutine_fn nfs_co_writev(BlockDriverState *bs, | ||
44 | - int64_t sector_num, int nb_sectors, | ||
45 | - QEMUIOVector *iov) | ||
46 | +static int coroutine_fn nfs_co_pwritev(BlockDriverState *bs, uint64_t offset, | ||
47 | + uint64_t bytes, QEMUIOVector *iov, | ||
48 | + int flags) | ||
49 | { | ||
50 | NFSClient *client = bs->opaque; | ||
51 | NFSRPC task; | ||
52 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn nfs_co_writev(BlockDriverState *bs, | ||
53 | |||
54 | nfs_co_init_task(bs, &task); | ||
55 | |||
56 | - buf = g_try_malloc(nb_sectors * BDRV_SECTOR_SIZE); | ||
57 | - if (nb_sectors && buf == NULL) { | ||
58 | + buf = g_try_malloc(bytes); | ||
59 | + if (bytes && buf == NULL) { | ||
60 | return -ENOMEM; | ||
61 | } | ||
62 | |||
63 | - qemu_iovec_to_buf(iov, 0, buf, nb_sectors * BDRV_SECTOR_SIZE); | ||
64 | + qemu_iovec_to_buf(iov, 0, buf, bytes); | ||
65 | |||
66 | if (nfs_pwrite_async(client->context, client->fh, | ||
67 | - sector_num * BDRV_SECTOR_SIZE, | ||
68 | - nb_sectors * BDRV_SECTOR_SIZE, | ||
69 | - buf, nfs_co_generic_cb, &task) != 0) { | ||
70 | + offset, bytes, buf, | ||
71 | + nfs_co_generic_cb, &task) != 0) { | ||
72 | g_free(buf); | ||
73 | return -ENOMEM; | ||
74 | } | ||
75 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn nfs_co_writev(BlockDriverState *bs, | ||
76 | |||
77 | g_free(buf); | ||
78 | |||
79 | - if (task.ret != nb_sectors * BDRV_SECTOR_SIZE) { | ||
80 | + if (task.ret != bytes) { | ||
81 | return task.ret < 0 ? task.ret : -EIO; | ||
82 | } | ||
83 | |||
84 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_nfs = { | ||
85 | .bdrv_create = nfs_file_create, | ||
86 | .bdrv_reopen_prepare = nfs_reopen_prepare, | ||
87 | |||
88 | - .bdrv_co_readv = nfs_co_readv, | ||
89 | - .bdrv_co_writev = nfs_co_writev, | ||
90 | + .bdrv_co_preadv = nfs_co_preadv, | ||
91 | + .bdrv_co_pwritev = nfs_co_pwritev, | ||
92 | .bdrv_co_flush_to_disk = nfs_co_flush, | ||
93 | |||
94 | .bdrv_detach_aio_context = nfs_detach_aio_context, | ||
95 | -- | 49 | -- |
96 | 2.9.3 | 50 | 2.35.1 |
97 | |||
98 | diff view generated by jsdifflib |