1
The following changes since commit 41feb5b955f0d7c9d071b2c5adbc404ae2895c7a:
1
The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def:
2
2
3
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging (2018-06-05 10:38:33 +0100)
3
Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -0700)
4
4
5
are available in the git repository at:
5
are available in the Git repository at:
6
6
7
git://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 68acc99f143b60ec4faa2903065b187d4d3c4bf3:
9
for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514:
10
10
11
sheepdog: remove huge BSS object (2018-06-05 10:15:12 -0400)
11
iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Sheepdog patches
14
Pull request
15
15
----------------------------------------------------------------
16
----------------------------------------------------------------
16
17
17
Paolo Bonzini (2):
18
Stefano Garzarella (2):
18
sheepdog: cleanup repeated expression
19
iothread: rename PollParamInfo to IOThreadParamInfo
19
sheepdog: remove huge BSS object
20
iothread: use IOThreadParamInfo in iothread_[set|get]_param()
20
21
21
block/sheepdog.c | 28 +++++++++++++++-------------
22
iothread.c | 28 +++++++++++++++-------------
22
1 file changed, 15 insertions(+), 13 deletions(-)
23
1 file changed, 15 insertions(+), 13 deletions(-)
23
24
24
--
25
--
25
2.13.6
26
2.31.1
26
27
27
28
29
diff view generated by jsdifflib
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
2
3
block/sheepdog.o has a 4M static variable that is 90% of QEMU's whole .bss
3
Commit 1793ad0247 ("iothread: add aio-max-batch parameter") added
4
section. Replace it with a heap-allocated block, and make it smaller too
4
a new parameter (aio-max-batch) to IOThread and used PollParamInfo
5
since only the inode header is actually being used.
5
structure to handle it.
6
6
7
bss size goes down from 4464280 to 269976.
7
Since it is not a parameter of the polling mechanism, we rename the
8
structure to a more generic IOThreadParamInfo.
8
9
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Suggested-by: Kevin Wolf <kwolf@redhat.com>
10
Reviewed-by: Jeff Cody <jcody@redhat.com>
11
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
Message-Id: <20180523160721.14018-3-pbonzini@redhat.com>
13
Message-id: 20210727145936.147032-2-sgarzare@redhat.com
13
Signed-off-by: Jeff Cody <jcody@redhat.com>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
---
15
---
15
block/sheepdog.c | 22 ++++++++++++----------
16
iothread.c | 14 +++++++-------
16
1 file changed, 12 insertions(+), 10 deletions(-)
17
1 file changed, 7 insertions(+), 7 deletions(-)
17
18
18
diff --git a/block/sheepdog.c b/block/sheepdog.c
19
diff --git a/iothread.c b/iothread.c
19
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
20
--- a/block/sheepdog.c
21
--- a/iothread.c
21
+++ b/block/sheepdog.c
22
+++ b/iothread.c
22
@@ -XXX,XX +XXX,XX @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
23
@@ -XXX,XX +XXX,XX @@ static void iothread_complete(UserCreatable *obj, Error **errp)
23
QEMUSnapshotInfo *sn_tab = NULL;
24
typedef struct {
24
unsigned wlen, rlen;
25
const char *name;
25
int found = 0;
26
ptrdiff_t offset; /* field's byte offset in IOThread struct */
26
- static SheepdogInode inode;
27
-} PollParamInfo;
27
+ SheepdogInode *inode;
28
+} IOThreadParamInfo;
28
unsigned long *vdi_inuse;
29
29
unsigned int start_nr;
30
-static PollParamInfo poll_max_ns_info = {
30
uint64_t hval;
31
+static IOThreadParamInfo poll_max_ns_info = {
31
uint32_t vid;
32
"poll-max-ns", offsetof(IOThread, poll_max_ns),
32
33
};
33
vdi_inuse = g_malloc(max);
34
-static PollParamInfo poll_grow_info = {
34
+ inode = g_malloc(SD_INODE_HEADER_SIZE);
35
+static IOThreadParamInfo poll_grow_info = {
35
36
"poll-grow", offsetof(IOThread, poll_grow),
36
fd = connect_to_sdog(s, &local_err);
37
};
37
if (fd < 0) {
38
-static PollParamInfo poll_shrink_info = {
38
@@ -XXX,XX +XXX,XX @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
39
+static IOThreadParamInfo poll_shrink_info = {
39
}
40
"poll-shrink", offsetof(IOThread, poll_shrink),
40
41
};
41
/* we don't need to read entire object */
42
-static PollParamInfo aio_max_batch_info = {
42
- ret = read_object(fd, s->bs, (char *)&inode,
43
+static IOThreadParamInfo aio_max_batch_info = {
43
+ ret = read_object(fd, s->bs, (char *)inode,
44
"aio-max-batch", offsetof(IOThread, aio_max_batch),
44
vid_to_vdi_oid(vid),
45
};
45
0, SD_INODE_HEADER_SIZE, 0,
46
46
s->cache_flags);
47
@@ -XXX,XX +XXX,XX @@ static void iothread_get_param(Object *obj, Visitor *v,
47
@@ -XXX,XX +XXX,XX @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
48
const char *name, void *opaque, Error **errp)
48
continue;
49
{
49
}
50
IOThread *iothread = IOTHREAD(obj);
50
51
- PollParamInfo *info = opaque;
51
- if (!strcmp(inode.name, s->name) && is_snapshot(&inode)) {
52
+ IOThreadParamInfo *info = opaque;
52
- sn_tab[found].date_sec = inode.snap_ctime >> 32;
53
int64_t *field = (void *)iothread + info->offset;
53
- sn_tab[found].date_nsec = inode.snap_ctime & 0xffffffff;
54
54
- sn_tab[found].vm_state_size = inode.vm_state_size;
55
visit_type_int64(v, name, field, errp);
55
- sn_tab[found].vm_clock_nsec = inode.vm_clock_nsec;
56
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
56
+ if (!strcmp(inode->name, s->name) && is_snapshot(inode)) {
57
const char *name, void *opaque, Error **errp)
57
+ sn_tab[found].date_sec = inode->snap_ctime >> 32;
58
{
58
+ sn_tab[found].date_nsec = inode->snap_ctime & 0xffffffff;
59
IOThread *iothread = IOTHREAD(obj);
59
+ sn_tab[found].vm_state_size = inode->vm_state_size;
60
- PollParamInfo *info = opaque;
60
+ sn_tab[found].vm_clock_nsec = inode->vm_clock_nsec;
61
+ IOThreadParamInfo *info = opaque;
61
62
int64_t *field = (void *)iothread + info->offset;
62
snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str),
63
int64_t value;
63
- "%" PRIu32, inode.snap_id);
64
64
+ "%" PRIu32, inode->snap_id);
65
pstrcpy(sn_tab[found].name,
66
- MIN(sizeof(sn_tab[found].name), sizeof(inode.tag)),
67
- inode.tag);
68
+ MIN(sizeof(sn_tab[found].name), sizeof(inode->tag)),
69
+ inode->tag);
70
found++;
71
}
72
}
73
@@ -XXX,XX +XXX,XX @@ out:
74
*psn_tab = sn_tab;
75
76
g_free(vdi_inuse);
77
+ g_free(inode);
78
79
if (ret < 0) {
80
return ret;
81
--
65
--
82
2.13.6
66
2.31.1
83
67
84
68
diff view generated by jsdifflib
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
2
3
The expression "SD_INODE_SIZE - sizeof(inode.data_vdi_id)" already has a macro
3
Commit 0445409d74 ("iothread: generalize
4
defined for the same value (though with a nicer definition using offsetof).
4
iothread_set_param/iothread_get_param") moved common code to set and
5
Replace it.
5
get IOThread parameters in two new functions.
6
6
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
These functions are called inside callbacks, so we don't need to use an
8
Reviewed-by: Fam Zheng <famz@redhat.com>
8
opaque pointer. Let's replace `void *opaque` parameter with
9
Reviewed-by: Jeff Cody <jcody@redhat.com>
9
`IOThreadParamInfo *info`.
10
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10
11
Message-Id: <20180523160721.14018-2-pbonzini@redhat.com>
11
Suggested-by: Kevin Wolf <kwolf@redhat.com>
12
Signed-off-by: Jeff Cody <jcody@redhat.com>
12
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
Message-id: 20210727145936.147032-3-sgarzare@redhat.com
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
13
---
16
---
14
block/sheepdog.c | 6 +++---
17
iothread.c | 18 ++++++++++--------
15
1 file changed, 3 insertions(+), 3 deletions(-)
18
1 file changed, 10 insertions(+), 8 deletions(-)
16
19
17
diff --git a/block/sheepdog.c b/block/sheepdog.c
20
diff --git a/iothread.c b/iothread.c
18
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
19
--- a/block/sheepdog.c
22
--- a/iothread.c
20
+++ b/block/sheepdog.c
23
+++ b/iothread.c
21
@@ -XXX,XX +XXX,XX @@ static int sd_truncate(BlockDriverState *bs, int64_t offset,
24
@@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = {
25
};
26
27
static void iothread_get_param(Object *obj, Visitor *v,
28
- const char *name, void *opaque, Error **errp)
29
+ const char *name, IOThreadParamInfo *info, Error **errp)
30
{
31
IOThread *iothread = IOTHREAD(obj);
32
- IOThreadParamInfo *info = opaque;
33
int64_t *field = (void *)iothread + info->offset;
34
35
visit_type_int64(v, name, field, errp);
36
}
37
38
static bool iothread_set_param(Object *obj, Visitor *v,
39
- const char *name, void *opaque, Error **errp)
40
+ const char *name, IOThreadParamInfo *info, Error **errp)
41
{
42
IOThread *iothread = IOTHREAD(obj);
43
- IOThreadParamInfo *info = opaque;
44
int64_t *field = (void *)iothread + info->offset;
45
int64_t value;
46
47
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
48
static void iothread_get_poll_param(Object *obj, Visitor *v,
49
const char *name, void *opaque, Error **errp)
50
{
51
+ IOThreadParamInfo *info = opaque;
52
53
- iothread_get_param(obj, v, name, opaque, errp);
54
+ iothread_get_param(obj, v, name, info, errp);
55
}
56
57
static void iothread_set_poll_param(Object *obj, Visitor *v,
58
const char *name, void *opaque, Error **errp)
59
{
60
IOThread *iothread = IOTHREAD(obj);
61
+ IOThreadParamInfo *info = opaque;
62
63
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
64
+ if (!iothread_set_param(obj, v, name, info, errp)) {
65
return;
22
}
66
}
23
67
24
/* we don't need to update entire object */
68
@@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v,
25
- datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
69
static void iothread_get_aio_param(Object *obj, Visitor *v,
26
+ datalen = SD_INODE_HEADER_SIZE;
70
const char *name, void *opaque, Error **errp)
27
s->inode.vdi_size = offset;
71
{
28
ret = write_object(fd, s->bs, (char *)&s->inode,
72
+ IOThreadParamInfo *info = opaque;
29
vid_to_vdi_oid(s->inode.vdi_id), s->inode.nr_copies,
73
30
@@ -XXX,XX +XXX,XX @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
74
- iothread_get_param(obj, v, name, opaque, errp);
31
*/
75
+ iothread_get_param(obj, v, name, info, errp);
32
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
76
}
33
/* we don't need to update entire object */
77
34
- datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
78
static void iothread_set_aio_param(Object *obj, Visitor *v,
35
+ datalen = SD_INODE_HEADER_SIZE;
79
const char *name, void *opaque, Error **errp)
36
inode = g_malloc(datalen);
80
{
37
81
IOThread *iothread = IOTHREAD(obj);
38
/* refresh inode. */
82
+ IOThreadParamInfo *info = opaque;
39
@@ -XXX,XX +XXX,XX @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
83
40
/* we don't need to read entire object */
84
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
41
ret = read_object(fd, s->bs, (char *)&inode,
85
+ if (!iothread_set_param(obj, v, name, info, errp)) {
42
vid_to_vdi_oid(vid),
86
return;
43
- 0, SD_INODE_SIZE - sizeof(inode.data_vdi_id), 0,
87
}
44
+ 0, SD_INODE_HEADER_SIZE, 0,
88
45
s->cache_flags);
46
47
if (ret) {
48
--
89
--
49
2.13.6
90
2.31.1
50
91
51
92
diff view generated by jsdifflib