1 | The following changes since commit 6157b0e19721aadb4c7fdcfe57b2924af6144b14: | 1 | The following changes since commit 6338c30111d596d955e6bc933a82184a0b910c43: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.0-pull-= | 3 | Merge tag 'm68k-for-7.2-pull-request' of https://github.com/vivier/qemu-m68k into staging (2022-09-21 13:12:36 -0400) |
4 | request' into staging (2021-03-14 17:47:49 +0000) | ||
5 | 4 | ||
6 | are available in the Git repository at: | 5 | are available in the Git repository at: |
7 | 6 | ||
8 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request | 7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request |
9 | 8 | ||
10 | for you to fetch changes up to fb0b154c801e3447e505de420195fb7038695941: | 9 | for you to fetch changes up to f16d15c9276bd8f501f861c39cbd4adc812d0c1d: |
11 | 10 | ||
12 | virtio-blk: Respect discard granularity (2021-03-15 09:48:53 +0000) | 11 | virtiofsd: use g_date_time_get_microsecond to get subsecond (2022-09-22 13:13:47 -0400) |
13 | 12 | ||
14 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
15 | Pull request | 14 | Pull request |
16 | 15 | ||
17 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
18 | 17 | ||
19 | Akihiko Odaki (1): | 18 | Yusuke Okada (1): |
20 | virtio-blk: Respect discard granularity | 19 | virtiofsd: use g_date_time_get_microsecond to get subsecond |
21 | 20 | ||
22 | include/hw/virtio/virtio-blk.h | 1 + | 21 | tools/virtiofsd/passthrough_ll.c | 7 +++++-- |
23 | hw/block/virtio-blk.c | 8 +++++++- | 22 | 1 file changed, 5 insertions(+), 2 deletions(-) |
24 | hw/core/machine.c | 1 + | ||
25 | 3 files changed, 9 insertions(+), 1 deletion(-) | ||
26 | 23 | ||
27 | --=20 | 24 | -- |
28 | 2.29.2 | 25 | 2.37.3 |
29 | diff view generated by jsdifflib |
1 | From: Akihiko Odaki <akihiko.odaki@gmail.com> | 1 | From: Yusuke Okada <okada.yusuke@jp.fujitsu.com> |
---|---|---|---|
2 | 2 | ||
3 | Report the configured granularity for discard operation to the | 3 | The "%f" specifier in g_date_time_format() is only available in glib |
4 | guest. If this is not set use the block size. | 4 | 2.65.2 or later. If combined with older glib, the function returns null |
5 | and the timestamp displayed as "(null)". | ||
5 | 6 | ||
6 | Since until now we have ignored the configured discard granularity | 7 | For backward compatibility, g_date_time_get_microsecond should be used |
7 | and always reported the block size, let's add | 8 | to retrieve subsecond. |
8 | 'report-discard-granularity' property and disable it for older | ||
9 | machine types to avoid migration issues. | ||
10 | 9 | ||
11 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> | 10 | In this patch the g_date_time_format() leaves subsecond field as "%06d" |
12 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | 11 | and let next snprintf to format with g_date_time_get_microsecond. |
12 | |||
13 | Signed-off-by: Yusuke Okada <okada.yusuke@jp.fujitsu.com> | ||
14 | Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
15 | Message-id: 20220818184618.2205172-1-yokada.996@gmail.com | ||
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 16 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
14 | Message-Id: <20210225001239.47046-1-akihiko.odaki@gmail.com> | ||
15 | --- | 17 | --- |
16 | include/hw/virtio/virtio-blk.h | 1 + | 18 | tools/virtiofsd/passthrough_ll.c | 7 +++++-- |
17 | hw/block/virtio-blk.c | 8 +++++++- | 19 | 1 file changed, 5 insertions(+), 2 deletions(-) |
18 | hw/core/machine.c | 1 + | ||
19 | 3 files changed, 9 insertions(+), 1 deletion(-) | ||
20 | 20 | ||
21 | diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h | 21 | diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c |
22 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/include/hw/virtio/virtio-blk.h | 23 | --- a/tools/virtiofsd/passthrough_ll.c |
24 | +++ b/include/hw/virtio/virtio-blk.h | 24 | +++ b/tools/virtiofsd/passthrough_ll.c |
25 | @@ -XXX,XX +XXX,XX @@ struct VirtIOBlkConf | 25 | @@ -XXX,XX +XXX,XX @@ static void setup_nofile_rlimit(unsigned long rlimit_nofile) |
26 | uint16_t num_queues; | 26 | static void log_func(enum fuse_log_level level, const char *fmt, va_list ap) |
27 | uint16_t queue_size; | 27 | { |
28 | bool seg_max_adjust; | 28 | g_autofree char *localfmt = NULL; |
29 | + bool report_discard_granularity; | 29 | + char buf[64]; |
30 | uint32_t max_discard_sectors; | 30 | |
31 | uint32_t max_write_zeroes_sectors; | 31 | if (current_log_level < level) { |
32 | bool x_enable_wce_if_config_wce; | 32 | return; |
33 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | 33 | @@ -XXX,XX +XXX,XX @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap) |
34 | index XXXXXXX..XXXXXXX 100644 | 34 | fmt); |
35 | --- a/hw/block/virtio-blk.c | 35 | } else { |
36 | +++ b/hw/block/virtio-blk.c | 36 | g_autoptr(GDateTime) now = g_date_time_new_now_utc(); |
37 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) | 37 | - g_autofree char *nowstr = g_date_time_format(now, "%Y-%m-%d %H:%M:%S.%f%z"); |
38 | blkcfg.wce = blk_enable_write_cache(s->blk); | 38 | + g_autofree char *nowstr = g_date_time_format(now, |
39 | virtio_stw_p(vdev, &blkcfg.num_queues, s->conf.num_queues); | 39 | + "%Y-%m-%d %H:%M:%S.%%06d%z"); |
40 | if (virtio_has_feature(s->host_features, VIRTIO_BLK_F_DISCARD)) { | 40 | + snprintf(buf, 64, nowstr, g_date_time_get_microsecond(now)); |
41 | + uint32_t discard_granularity = conf->discard_granularity; | 41 | localfmt = g_strdup_printf("[%s] [ID: %08ld] %s", |
42 | + if (discard_granularity == -1 || !s->conf.report_discard_granularity) { | 42 | - nowstr, syscall(__NR_gettid), fmt); |
43 | + discard_granularity = blk_size; | 43 | + buf, syscall(__NR_gettid), fmt); |
44 | + } | 44 | } |
45 | virtio_stl_p(vdev, &blkcfg.max_discard_sectors, | 45 | fmt = localfmt; |
46 | s->conf.max_discard_sectors); | 46 | } |
47 | virtio_stl_p(vdev, &blkcfg.discard_sector_alignment, | ||
48 | - blk_size >> BDRV_SECTOR_BITS); | ||
49 | + discard_granularity >> BDRV_SECTOR_BITS); | ||
50 | /* | ||
51 | * We support only one segment per request since multiple segments | ||
52 | * are not widely used and there are no userspace APIs that allow | ||
53 | @@ -XXX,XX +XXX,XX @@ static Property virtio_blk_properties[] = { | ||
54 | IOThread *), | ||
55 | DEFINE_PROP_BIT64("discard", VirtIOBlock, host_features, | ||
56 | VIRTIO_BLK_F_DISCARD, true), | ||
57 | + DEFINE_PROP_BOOL("report-discard-granularity", VirtIOBlock, | ||
58 | + conf.report_discard_granularity, true), | ||
59 | DEFINE_PROP_BIT64("write-zeroes", VirtIOBlock, host_features, | ||
60 | VIRTIO_BLK_F_WRITE_ZEROES, true), | ||
61 | DEFINE_PROP_UINT32("max-discard-sectors", VirtIOBlock, | ||
62 | diff --git a/hw/core/machine.c b/hw/core/machine.c | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/hw/core/machine.c | ||
65 | +++ b/hw/core/machine.c | ||
66 | @@ -XXX,XX +XXX,XX @@ | ||
67 | GlobalProperty hw_compat_5_2[] = { | ||
68 | { "ICH9-LPC", "smm-compat", "on"}, | ||
69 | { "PIIX4_PM", "smm-compat", "on"}, | ||
70 | + { "virtio-blk-device", "report-discard-granularity", "off" }, | ||
71 | }; | ||
72 | const size_t hw_compat_5_2_len = G_N_ELEMENTS(hw_compat_5_2); | ||
73 | |||
74 | -- | 47 | -- |
75 | 2.29.2 | 48 | 2.37.3 |
76 | diff view generated by jsdifflib |