1
The following changes since commit 20d6c7312f1b812bb9c750f4087f69ac8485cc90:
1
The following changes since commit 3521ade3510eb5cefb2e27a101667f25dad89935:
2
2
3
Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-3.2-part1' into staging (2019-01-03 13:26:30 +0000)
3
Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2021-07-29' into staging (2021-07-29 13:17:20 +0100)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
git://github.com/stefanha/qemu.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 39a0408e768cd00142f5b57d27ab234282bf4df5:
9
for you to fetch changes up to cc8eecd7f105a1dff5876adeb238a14696061a4a:
10
10
11
dmg: don't skip zero chunk (2019-01-04 11:15:09 +0000)
11
MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver (2021-07-29 17:17:34 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Pull request
14
Pull request
15
15
16
Bug fixes for the .dmg image file format.
16
The main fix here is for io_uring. Spurious -EAGAIN errors can happen and the
17
request needs to be resubmitted.
18
19
The MAINTAINERS changes carry no risk and we might as well include them in QEMU
20
6.1.
17
21
18
----------------------------------------------------------------
22
----------------------------------------------------------------
19
23
20
Julio Faracco (1):
24
Fabian Ebner (1):
21
dmg: Fixing wrong dmg block type value for block terminator.
25
block/io_uring: resubmit when result is -EAGAIN
22
26
23
yuchenlin (3):
27
Philippe Mathieu-Daudé (1):
24
dmg: fix binary search
28
MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver
25
dmg: use enumeration type instead of hard coding number
26
dmg: don't skip zero chunk
27
29
28
block/dmg.c | 31 ++++++++++++++++++++-----------
30
Stefano Garzarella (1):
29
1 file changed, 20 insertions(+), 11 deletions(-)
31
MAINTAINERS: add Stefano Garzarella as io_uring reviewer
32
33
MAINTAINERS | 2 ++
34
block/io_uring.c | 16 +++++++++++++++-
35
2 files changed, 17 insertions(+), 1 deletion(-)
30
36
31
--
37
--
32
2.20.1
38
2.31.1
33
39
34
diff view generated by jsdifflib
Deleted patch
1
From: Julio Faracco <jcfaracco@gmail.com>
2
1
3
This is a trivial patch to fix a wrong value for block terminator.
4
The old value was 0x7fffffff which is wrong. It was not affecting the
5
code because QEMU dmg block is not handling block terminator right now.
6
Neverthless, it should be fixed.
7
8
Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
9
Reviewed-by: yuchenlin <yuchenlin@synology.com>
10
Message-id: 20181228145055.18039-1-jcfaracco@gmail.com
11
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12
---
13
block/dmg.c | 2 +-
14
1 file changed, 1 insertion(+), 1 deletion(-)
15
16
diff --git a/block/dmg.c b/block/dmg.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/block/dmg.c
19
+++ b/block/dmg.c
20
@@ -XXX,XX +XXX,XX @@ enum {
21
UDBZ,
22
ULFO,
23
UDCM = 0x7ffffffe, /* Comments */
24
- UDLE /* Last Entry */
25
+ UDLE = 0xffffffff /* Last Entry */
26
};
27
28
static int dmg_probe(const uint8_t *buf, int buf_size, const char *filename)
29
--
30
2.20.1
31
32
diff view generated by jsdifflib
1
From: yuchenlin <npes87184@gmail.com>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
2
3
The dmg file has many tables which describe: "start from sector XXX to
3
I've been working with io_uring for a while so I'd like to help
4
sector XXX, the compression method is XXX and where the compressed data
4
with reviews.
5
resides on".
6
5
7
Each sector in the expanded file should be covered by a table. The table
6
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
8
will describe the offset of compressed data (or raw depends on the type)
7
Message-Id: <20210728131515.131045-1-sgarzare@redhat.com>
9
in the dmg.
10
11
For example:
12
13
[-----------The expanded file------------]
14
[---bzip table ---]/* zeros */[---zlib---]
15
^
16
| if we want to read this sector.
17
18
we will find bzip table which contains this sector, and get the
19
compressed data offset, read it from dmg, uncompress it, finally write to
20
expanded file.
21
22
If we skip zero chunk (table), some sector cannot find the table which
23
will cause search_chunk() return s->n_chunks, dmg_read_chunk() return -1
24
and finally causing dmg_co_preadv() return EIO.
25
26
See:
27
28
[-----------The expanded file------------]
29
[---bzip table ---]/* zeros */[---zlib---]
30
^
31
| if we want to read this sector.
32
33
Oops, we cannot find the table contains it...
34
35
In the original implementation, we don't have zero table. When we try to
36
read sector inside the zero chunk. We will get EIO, and skip reading.
37
38
After this patch, we treat zero chunk the same as ignore chunk, it will
39
directly write zero and avoid some sector may not find the table.
40
41
After this patch:
42
43
[-----------The expanded file------------]
44
[---bzip table ---][--zeros--][---zlib---]
45
46
Signed-off-by: yuchenlin <npes87184@gmail.com>
47
Reviewed-by: Julio Faracco <jcfaracco@gmail.com>
48
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
49
Message-id: 20190103114700.9686-4-npes87184@gmail.com
50
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
51
---
9
---
52
block/dmg.c | 19 ++++++++++++-------
10
MAINTAINERS | 1 +
53
1 file changed, 12 insertions(+), 7 deletions(-)
11
1 file changed, 1 insertion(+)
54
12
55
diff --git a/block/dmg.c b/block/dmg.c
13
diff --git a/MAINTAINERS b/MAINTAINERS
56
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
57
--- a/block/dmg.c
15
--- a/MAINTAINERS
58
+++ b/block/dmg.c
16
+++ b/MAINTAINERS
59
@@ -XXX,XX +XXX,XX @@ static void update_max_chunk_size(BDRVDMGState *s, uint32_t chunk,
17
@@ -XXX,XX +XXX,XX @@ Linux io_uring
60
case UDRW: /* copy */
18
M: Aarushi Mehta <mehta.aaru20@gmail.com>
61
uncompressed_sectors = DIV_ROUND_UP(s->lengths[chunk], 512);
19
M: Julia Suvorova <jusual@redhat.com>
62
break;
20
M: Stefan Hajnoczi <stefanha@redhat.com>
63
- case UDIG: /* zero */
21
+R: Stefano Garzarella <sgarzare@redhat.com>
64
+ case UDZE: /* zero */
22
L: qemu-block@nongnu.org
65
+ case UDIG: /* ignore */
23
S: Maintained
66
/* as the all-zeroes block may be large, it is treated specially: the
24
F: block/io_uring.c
67
* sector is not copied from a large buffer, a simple memset is used
68
* instead. Therefore uncompressed_sectors does not need to be set. */
69
@@ -XXX,XX +XXX,XX @@ typedef struct DmgHeaderState {
70
static bool dmg_is_known_block_type(uint32_t entry_type)
71
{
72
switch (entry_type) {
73
+ case UDZE: /* zeros */
74
case UDRW: /* uncompressed */
75
- case UDIG: /* zeroes */
76
+ case UDIG: /* ignore */
77
case UDZO: /* zlib */
78
return true;
79
case UDBZ: /* bzip2 */
80
@@ -XXX,XX +XXX,XX @@ static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
81
/* sector count */
82
s->sectorcounts[i] = buff_read_uint64(buffer, offset + 0x10);
83
84
- /* all-zeroes sector (type 2) does not need to be "uncompressed" and can
85
- * therefore be unbounded. */
86
- if (s->types[i] != UDIG && s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {
87
+ /* all-zeroes sector (type UDZE and UDIG) does not need to be
88
+ * "uncompressed" and can therefore be unbounded. */
89
+ if (s->types[i] != UDZE && s->types[i] != UDIG
90
+ && s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {
91
error_report("sector count %" PRIu64 " for chunk %" PRIu32
92
" is larger than max (%u)",
93
s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX);
94
@@ -XXX,XX +XXX,XX @@ static inline int dmg_read_chunk(BlockDriverState *bs, uint64_t sector_num)
95
return -1;
96
}
97
break;
98
- case UDIG: /* zero */
99
+ case UDZE: /* zeros */
100
+ case UDIG: /* ignore */
101
/* see dmg_read, it is treated specially. No buffer needs to be
102
* pre-filled, the zeroes can be set directly. */
103
break;
104
@@ -XXX,XX +XXX,XX @@ dmg_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
105
/* Special case: current chunk is all zeroes. Do not perform a memcpy as
106
* s->uncompressed_chunk may be too small to cover the large all-zeroes
107
* section. dmg_read_chunk is called to find s->current_chunk */
108
- if (s->types[s->current_chunk] == UDIG) { /* all zeroes block entry */
109
+ if (s->types[s->current_chunk] == UDZE
110
+ || s->types[s->current_chunk] == UDIG) { /* all zeroes block entry */
111
qemu_iovec_memset(qiov, i * 512, 0, 512);
112
continue;
113
}
114
--
25
--
115
2.20.1
26
2.31.1
116
27
117
diff view generated by jsdifflib
1
From: yuchenlin <npes87184@gmail.com>
1
From: Fabian Ebner <f.ebner@proxmox.com>
2
2
3
Signed-off-by: yuchenlin <npes87184@gmail.com>
3
Linux SCSI can throw spurious -EAGAIN in some corner cases in its
4
Reviewed-by: Julio Faracco <jcfaracco@gmail.com>
4
completion path, which will end up being the result in the completed
5
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
5
io_uring request.
6
Message-id: 20190103114700.9686-3-npes87184@gmail.com
6
7
Resubmitting such requests should allow block jobs to complete, even
8
if such spurious errors are encountered.
9
10
Co-authored-by: Stefan Hajnoczi <stefanha@gmail.com>
11
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
12
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
13
Message-id: 20210729091029.65369-1-f.ebner@proxmox.com
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8
---
15
---
9
block/dmg.c | 4 ++--
16
block/io_uring.c | 16 +++++++++++++++-
10
1 file changed, 2 insertions(+), 2 deletions(-)
17
1 file changed, 15 insertions(+), 1 deletion(-)
11
18
12
diff --git a/block/dmg.c b/block/dmg.c
19
diff --git a/block/io_uring.c b/block/io_uring.c
13
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
14
--- a/block/dmg.c
21
--- a/block/io_uring.c
15
+++ b/block/dmg.c
22
+++ b/block/io_uring.c
16
@@ -XXX,XX +XXX,XX @@ static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
23
@@ -XXX,XX +XXX,XX @@ static void luring_process_completions(LuringState *s)
17
24
total_bytes = ret + luringcb->total_read;
18
/* all-zeroes sector (type 2) does not need to be "uncompressed" and can
25
19
* therefore be unbounded. */
26
if (ret < 0) {
20
- if (s->types[i] != 2 && s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {
27
- if (ret == -EINTR) {
21
+ if (s->types[i] != UDIG && s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {
28
+ /*
22
error_report("sector count %" PRIu64 " for chunk %" PRIu32
29
+ * Only writev/readv/fsync requests on regular files or host block
23
" is larger than max (%u)",
30
+ * devices are submitted. Therefore -EAGAIN is not expected but it's
24
s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX);
31
+ * known to happen sometimes with Linux SCSI. Submit again and hope
25
@@ -XXX,XX +XXX,XX @@ dmg_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
32
+ * the request completes successfully.
26
/* Special case: current chunk is all zeroes. Do not perform a memcpy as
33
+ *
27
* s->uncompressed_chunk may be too small to cover the large all-zeroes
34
+ * For more information, see:
28
* section. dmg_read_chunk is called to find s->current_chunk */
35
+ * https://lore.kernel.org/io-uring/20210727165811.284510-3-axboe@kernel.dk/T/#u
29
- if (s->types[s->current_chunk] == 2) { /* all zeroes block entry */
36
+ *
30
+ if (s->types[s->current_chunk] == UDIG) { /* all zeroes block entry */
37
+ * If the code is changed to submit other types of requests in the
31
qemu_iovec_memset(qiov, i * 512, 0, 512);
38
+ * future, then this workaround may need to be extended to deal with
32
continue;
39
+ * genuine -EAGAIN results that should not be resubmitted
33
}
40
+ * immediately.
41
+ */
42
+ if (ret == -EINTR || ret == -EAGAIN) {
43
luring_resubmit(s, luringcb);
44
continue;
45
}
34
--
46
--
35
2.20.1
47
2.31.1
36
48
37
diff view generated by jsdifflib
1
From: yuchenlin <npes87184@gmail.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
There is a possible hang in original binary search implementation. That is
3
I'm interested in following the activity around the NVMe bdrv.
4
if chunk1 = 4, chunk2 = 5, chunk3 = 4, and we go else case.
5
4
6
The chunk1 will be still 4, and so on.
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
6
Message-id: 20210728183340.2018313-1-philmd@redhat.com
8
Signed-off-by: yuchenlin <npes87184@gmail.com>
9
Message-id: 20190103114700.9686-2-npes87184@gmail.com
10
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11
---
8
---
12
block/dmg.c | 10 +++++++---
9
MAINTAINERS | 1 +
13
1 file changed, 7 insertions(+), 3 deletions(-)
10
1 file changed, 1 insertion(+)
14
11
15
diff --git a/block/dmg.c b/block/dmg.c
12
diff --git a/MAINTAINERS b/MAINTAINERS
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/block/dmg.c
14
--- a/MAINTAINERS
18
+++ b/block/dmg.c
15
+++ b/MAINTAINERS
19
@@ -XXX,XX +XXX,XX @@ static inline uint32_t search_chunk(BDRVDMGState *s, uint64_t sector_num)
16
@@ -XXX,XX +XXX,XX @@ F: block/null.c
20
{
17
NVMe Block Driver
21
/* binary search */
18
M: Stefan Hajnoczi <stefanha@redhat.com>
22
uint32_t chunk1 = 0, chunk2 = s->n_chunks, chunk3;
19
R: Fam Zheng <fam@euphon.net>
23
- while (chunk1 != chunk2) {
20
+R: Philippe Mathieu-Daudé <philmd@redhat.com>
24
+ while (chunk1 <= chunk2) {
21
L: qemu-block@nongnu.org
25
chunk3 = (chunk1 + chunk2) / 2;
22
S: Supported
26
if (s->sectors[chunk3] > sector_num) {
23
F: block/nvme*
27
- chunk2 = chunk3;
28
+ if (chunk3 == 0) {
29
+ goto err;
30
+ }
31
+ chunk2 = chunk3 - 1;
32
} else if (s->sectors[chunk3] + s->sectorcounts[chunk3] > sector_num) {
33
return chunk3;
34
} else {
35
- chunk1 = chunk3;
36
+ chunk1 = chunk3 + 1;
37
}
38
}
39
+err:
40
return s->n_chunks; /* error */
41
}
42
43
--
24
--
44
2.20.1
25
2.31.1
45
26
46
diff view generated by jsdifflib