diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-09-30 16:45:34 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-09-30 16:45:35 +0100 |
commit | 1831e150606a221898bf46ffaf0453e9952cbbc4 (patch) | |
tree | 448102b635faec91c394305f43500a97710f095f /block/iscsi.c | |
parent | 7be3c1408ab7ac0ded770729ec1c4565feead5ab (diff) | |
parent | a9fe4c957b762dbb814c254204c082bab93c8459 (diff) | |
download | qemu-1831e150606a221898bf46ffaf0453e9952cbbc4.tar.gz qemu-1831e150606a221898bf46ffaf0453e9952cbbc4.tar.bz2 qemu-1831e150606a221898bf46ffaf0453e9952cbbc4.zip |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
This update brings dataplane to virtio-scsi (NOT
yet 100% thread-safe, though, which makes it really, really
experimental. It also brings asynchronous cancellation to
the SCSI subsystem and implements it in virtio-scsi. This
is a pretty important feature. Almost all the work here
was done by Fam Zheng.
I also included the virtio refcount fixes from Gonglei,
because they had a small conflict with virtio-scsi dataplane.
This pull request is using the new subkey 4E6B09D7.
# gpg: Signature made Tue 30 Sep 2014 12:31:02 BST using RSA key ID 4E6B09D7
# gpg: Good signature from "Paolo Bonzini <pbonzini@redhat.com>"
# gpg: aka "Paolo Bonzini <bonzini@gnu.org>"
* remotes/bonzini/tags/for-upstream: (39 commits)
block/iscsi: handle failure on malloc of the allocationmap
util: introduce bitmap_try_new
virtio-scsi: Handle TMF request cancellation asynchronously
scsi: Introduce scsi_req_cancel_async
scsi: Introduce scsi_req_cancel_complete
scsi: Drop SCSIReqOps.cancel_io
scsi: Unify request unref in scsi_req_cancel
scsi-generic: Handle canceled request in scsi_command_complete
scsi: Drop scsi_req_abort
virtio-scsi: Process ".iothread" property
virtio-scsi: Call bdrv_io_plug/bdrv_io_unplug in cmd request handling
virtio-scsi: Batched prepare for cmd reqs
virtio-scsi: Two stages processing of cmd request
virtio-scsi: Add migration state notifier for dataplane code
virtio-scsi: Hook up with dataplane
virtio-scsi-dataplane: Code to run virtio-scsi on iothread
virtio-scsi: Add VirtIOSCSIVring in VirtIOSCSIReq
virtio-scsi: Add 'iothread' property to virtio-scsi
virtio: add a wrapper for virtio-backend initialization
virtio-9p: fix virtio-9p child refcount in transports
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block/iscsi.c')
-rw-r--r-- | block/iscsi.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/block/iscsi.c b/block/iscsi.c index 5c72ffeb31..3a01de0edb 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -316,6 +316,13 @@ static bool is_request_lun_aligned(int64_t sector_num, int nb_sectors, return 1; } +static unsigned long *iscsi_allocationmap_init(IscsiLun *iscsilun) +{ + return bitmap_try_new(DIV_ROUND_UP(sector_lun2qemu(iscsilun->num_blocks, + iscsilun), + iscsilun->cluster_sectors)); +} + static void iscsi_allocationmap_set(IscsiLun *iscsilun, int64_t sector_num, int nb_sectors) { @@ -1402,9 +1409,10 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, iscsilun->cluster_sectors = (iscsilun->bl.opt_unmap_gran * iscsilun->block_size) >> BDRV_SECTOR_BITS; if (iscsilun->lbprz && !(bs->open_flags & BDRV_O_NOCACHE)) { - iscsilun->allocationmap = - bitmap_new(DIV_ROUND_UP(bs->total_sectors, - iscsilun->cluster_sectors)); + iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun); + if (iscsilun->allocationmap == NULL) { + ret = -ENOMEM; + } } } @@ -1497,10 +1505,7 @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset) if (iscsilun->allocationmap != NULL) { g_free(iscsilun->allocationmap); - iscsilun->allocationmap = - bitmap_new(DIV_ROUND_UP(sector_lun2qemu(iscsilun->num_blocks, - iscsilun), - iscsilun->cluster_sectors)); + iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun); } return 0; |