Block patches
The following changes since commit 38aea177d93556aada7c4c7aa530f0050715e293:
Merge remote-tracking branch 'pmaydell/configury.next' into staging (2013-06-17 08:57:57 -0500)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git for-anthony
for you to fetch changes up to 0bed087df24c7b3fae366f239b9d150de3309416:
vmdk: Allow reading variable size descriptor files (2013-06-17 17:47:59 +0200)
----------------------------------------------------------------
Evgeny Budilovsky (1):
vmdk: Allow reading variable size descriptor files
Keith Busch (1):
NVMe: Initial commit for new storage interface
Liu Yuan (2):
sheepdog: fix snapshot tag initialization
sheepdog: support 'qemu-img snapshot -a'
Richard W.M. Jones (2):
block/curl.c: Refuse to open the handle for writes.
curl: Don't set curl options on the handle just before it's going to be deleted.
Stefan Hajnoczi (1):
vmdk: byteswap VMDK4Header.desc_offset field
MAINTAINERS | 5 + block/curl.c | 8 +- block/sheepdog.c | 14 +- block/vmdk.c | 34 +- default-configs/pci.mak | 1 + hw/block/Makefile.objs | 1 + hw/block/nvme.c | 885 +++++++++++++++++++++++++++++++++++++++++++++++ hw/block/nvme.h | 711 +++++++++++++++++++++++++++++++++++++ include/hw/pci/pci_ids.h | 1 + 9 files changed, 1641 insertions(+), 19 deletions(-) create mode 100644 hw/block/nvme.c create mode 100644 hw/block/nvme.h
[Qemu-devel] [PULL 2/7] sheepdog: support 'qemu-img snapshot -a'
From: Liu Yuan <[email protected]>
Just call sd_create_branch() in the snapshot_goto to rollback the image is good enough. With this patch, 'loadvm' process for sheepdog is modified:
Suppose we have a snapshot chain A --> B --> C, we do 'loadvm A' so as to get a new chain,
A --> B
|
V
C1
in the old code:
1 reload inode of A (in snapshot_goto)
2 read vmstate via A's vdi_id (loadvm_state)
3 delete C and create C1, reload inode of C1 (sd_create_branch on write)
with this patch applied:
1 reload inode of A, delete C and create C1 (in snapshot_goto) 2 read vmstate via C1's parent, that is A's vdi_id (loadvm_state)
This will fix the possible bug that QEMU exit between 2 and 3 in the old code
--- block/sheepdog.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
block/sheepdog.c +5 -7
@@ -2071,14 +2071,11 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) goto out; } -if (!s->inode.vm_state_size) { -error_report ("Invalid snapshot" ); - ret = -ENOENT ; + ret =sd_create_branch (s); +if (ret) { goto out; } - s->is_snapshot = true; -g_free (old_s);return 0 ;
@@ -2196,8 +2193,9 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,int fd, ret =0 , remaining = size;unsigned int data_len;uint64_t vmstate_oid; -uint32_t vdi_index;uint64_t offset; +uint32_t vdi_index; +uint32_t vdi_id = load ? s->inode.parent_vdi_id : s->inode.vdi_id; fd =connect_to_sdog (s);if (fd <0 ) {
@@ -2210,7 +2208,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data, data_len =MIN (remaining,SD_DATA_OBJ_SIZE - offset); - vmstate_oid =vid_to_vmstate_oid (s->inode.vdi_id, vdi_index); + vmstate_oid =vid_to_vmstate_oid (vdi_id, vdi_index); create = (offset ==0 );if (load) {
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 1/7] sheepdog: fix snapshot tag initialization
In reply to Kevin WolfFrom: Liu Yuan <[email protected]>
This is an old and obvious bug. We should pass snapshot_id to the tag. Or simple command like 'qemu-img snapshot -a tag sheepdog:image' will fail
--- block/sheepdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/sheepdog.c +1 -1
@@ -2063,7 +2063,7 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)if (snapid) { tag[0 ] =0 ; }else { -pstrcpy (tag,sizeof (tag), s->name); +pstrcpy (tag,sizeof (tag), snapshot_id); } ret =reload_inode (s, snapid, tag);
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 4/7] vmdk: byteswap VMDK4Header.desc_offset field
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
Remember to byteswap VMDK4Header.desc_offset on big-endian machines.
--- block/vmdk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
block/vmdk.c +5 -2
@@ -507,8 +507,11 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,if (ret <0 ) {return ret; } -if (header.capacity ==0 && header.desc_offset) { -return vmdk_open_desc_file (bs, flags, header.desc_offset <<9 ); +if (header.capacity ==0 ) { +int64_t desc_offset =le64_to_cpu (header.desc_offset); +if (desc_offset) { +return vmdk_open_desc_file (bs, flags, desc_offset <<9 ); + } }if (le64_to_cpu (header.gd_offset) ==VMDK4_GD_AT_END ) {
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 5/7] curl: Don't set curl options on the handle just before it's going to be deleted.
In reply to Kevin WolfFrom: "Richard W.M. Jones" <[email protected]>
(Found by Kamil Dudka)
--- block/curl.c | 2 -- 1 file changed, 2 deletions(-)
block/curl.c +0 -2
@@ -452,8 +452,6 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags)if (curl_easy_perform (state->curl)) goto out;curl_easy_getinfo (state->curl,CURLINFO_CONTENT_LENGTH_DOWNLOAD , &d); -curl_easy_setopt (state->curl,CURLOPT_WRITEFUNCTION , (void *)curl_read_cb); -curl_easy_setopt (state->curl,CURLOPT_NOBODY ,0 );if (d) s->len = (size_t )d;else if (!s->len)
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 3/7] block/curl.c: Refuse to open the handle for writes.
In reply to Kevin WolfFrom: "Richard W.M. Jones" <[email protected]>
--- block/curl.c | 6 ++++++ 1 file changed, 6 insertions(+)
block/curl.c +6 -0
@@ -406,6 +406,12 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags)static int inited =0 ; +if (flags &BDRV_O_RDWR ) { +qerror_report (ERROR_CLASS_GENERIC_ERROR , +"curl block device does not support writes" ); +return -EROFS ; + } + opts =qemu_opts_create_nofail (&runtime_opts);qemu_opts_absorb_qdict (opts, options, &local_err);if (error_is_set (&local_err)) {
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 7/7] vmdk: Allow reading variable size descriptor files
In reply to Kevin WolfFrom: Evgeny Budilovsky <[email protected]>
the hard-coded 2k buffer on the stack won't allow reading big descriptor files which can be generated when storing big images. For example 500G vmdk splitted to 2G chunks.
--- block/vmdk.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
block/vmdk.c +20 -7
@@ -722,27 +722,40 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags, int64_t desc_offset) {int ret; -char buf[2048 ]; +char *buf =NULL ;char ct[128 ];BDRVVmdkState *s = bs->opaque; +int64_t size; - ret =bdrv_pread (bs->file, desc_offset, buf,sizeof (buf)); + size =bdrv_getlength (bs->file); +if (size <0 ) { +return -EINVAL ; + } + + size =MIN (size,1 <<20 );/* avoid unbounded allocation */ + buf =g_malloc0 (size +1 ); + + ret =bdrv_pread (bs->file, desc_offset, buf, size);if (ret <0 ) { -return ret; + goto exit; } - buf[2047 ] ='\0' ;if (vmdk_parse_description (buf,"createType" , ct,sizeof (ct))) { -return -EMEDIUMTYPE ; + ret = -EMEDIUMTYPE ; + goto exit; }if (strcmp (ct,"monolithicFlat" ) &&strcmp (ct,"twoGbMaxExtentSparse" ) &&strcmp (ct,"twoGbMaxExtentFlat" )) {fprintf (stderr,"VMDK: Not supported image type \"%s\""".\n" , ct); -return -ENOTSUP ; + ret = -ENOTSUP ; + goto exit; } s->desc_offset =0 ; -return vmdk_parse_extents (buf, bs, bs->file->filename); + ret =vmdk_parse_extents (buf, bs, bs->file->filename); +exit: +g_free (buf); +return ret; }static int vmdk_open (BlockDriverState *bs,QDict *options,int flags)
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 6/7] NVMe: Initial commit for new storage interface
In reply to Kevin WolfFrom: Keith Busch <[email protected]>
Initial commit for emulated Non-Volatile-Memory Express (NVMe) pci storage device.
NVMe is an open, industry driven storage specification defining an optimized register and command set designed to deliver the full capabilities of non-volatile memory on PCIe SSDs. Further information may be found on the organizations website at:
This commit implements the minimum from the specification to work with existing drivers.
--- MAINTAINERS | 5 + default-configs/pci.mak | 1 + hw/block/Makefile.objs | 1 + hw/block/nvme.c | 885 +++++++++++++++++++++++++++++++++++++++++++++++ hw/block/nvme.h | 711 +++++++++++++++++++++++++++++++++++++ include/hw/pci/pci_ids.h | 1 + 6 files changed, 1604 insertions(+) create mode 100644 hw/block/nvme.c create mode 100644 hw/block/nvme.h
MAINTAINERS +5 -0
@@ -609,6 +609,11 @@ S: Supported F: hw/char/virtio-serial-bus.c F: hw/char/virtio-console.c +nvme +M: Keith Busch <[email protected]> +S: Supported +F: hw/block/nvme* + Xilinx EDK M: Peter Crosthwaite <[email protected]> M: Edgar E. Iglesias <[email protected]>
default-configs/pci.mak +1 -0
@@ -29,3 +29,4 @@ CONFIG_SERIAL_PCI=y CONFIG_IPACK=y CONFIG_WDT_IB6300ESB=y CONFIG_PCI_TESTDEV=y +CONFIG_NVME_PCI=y
hw/block/Makefile.objs +1 -0
@@ -8,6 +8,7 @@ common-obj-$(CONFIG_XEN_BACKEND) += xen_disk.o common-obj-$(CONFIG_ECC) += ecc.o common-obj-$(CONFIG_ONENAND) += onenand.o common-obj-$(CONFIG_PC_SYSFW) += pc_sysfw.o +common-obj-$(CONFIG_NVME_PCI) += nvme.o obj-$(CONFIG_SH4) += tc58128.o
hw/block/nvme.c new file +885 -0
885 lines not on this page · raw message
hw/block/nvme.h new file +711 -0
711 lines not on this page · raw message
include/hw/pci/pci_ids.h +1 -0
@@ -19,6 +19,7 @@#define PCI_CLASS_STORAGE_IDE 0x0101#define PCI_CLASS_STORAGE_RAID 0x0104#define PCI_CLASS_STORAGE_SATA 0x0106 +#define PCI_CLASS_STORAGE_EXPRESS 0x0108#define PCI_CLASS_STORAGE_OTHER 0x0180#define PCI_CLASS_NETWORK_ETHERNET 0x0200
Signature · 1 line
1.8.1.4
Pulled. Thanks.
Regards,
Anthony Liguori