[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCHv3 09/10] iscsi: remove support for misaligned nb_sec
From: |
Peter Lieven |
Subject: |
[Qemu-devel] [PATCHv3 09/10] iscsi: remove support for misaligned nb_sectors in aio_readv |
Date: |
Thu, 11 Jul 2013 14:16:26 +0200 |
this hask is not working (anymore). support for misaligned offsets should
be handled at the block layer.
Signed-off-by: Peter Lieven <address@hidden>
---
block/iscsi.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index bc62a7e..903f2fb 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -76,8 +76,6 @@ typedef struct IscsiAIOCB {
int status;
int canceled;
int retries;
- size_t read_size;
- size_t read_offset;
int64_t sector_num;
int nb_sectors;
#ifdef __linux__
@@ -435,6 +433,7 @@ static int
iscsi_aio_readv_acb(IscsiAIOCB *acb)
{
struct iscsi_context *iscsi = acb->iscsilun->iscsi;
+ size_t size;
uint64_t lba;
uint32_t num_sectors;
int ret;
@@ -447,20 +446,7 @@ iscsi_aio_readv_acb(IscsiAIOCB *acb)
acb->status = -EINPROGRESS;
acb->buf = NULL;
- /* If LUN blocksize is bigger than BDRV_BLOCK_SIZE a read from QEMU
- * may be misaligned to the LUN, so we may need to read some extra
- * data.
- */
- acb->read_offset = 0;
- if (acb->iscsilun->block_size > BDRV_SECTOR_SIZE) {
- uint64_t bdrv_offset = BDRV_SECTOR_SIZE * acb->sector_num;
-
- acb->read_offset = bdrv_offset % acb->iscsilun->block_size;
- }
-
- num_sectors = (acb->read_size + acb->iscsilun->block_size
- + acb->read_offset - 1)
- / acb->iscsilun->block_size;
+ size = acb->nb_sectors * BDRV_SECTOR_SIZE;
acb->task = malloc(sizeof(struct scsi_task));
if (acb->task == NULL) {
@@ -471,8 +457,9 @@ iscsi_aio_readv_acb(IscsiAIOCB *acb)
memset(acb->task, 0, sizeof(struct scsi_task));
acb->task->xfer_dir = SCSI_XFER_READ;
+ acb->task->expxferlen = size;
lba = sector_qemu2lun(acb->sector_num, acb->iscsilun);
- acb->task->expxferlen = acb->read_size;
+ num_sectors = sector_qemu2lun(acb->nb_sectors, acb->iscsilun);
switch (acb->iscsilun->type) {
case TYPE_DISK:
@@ -527,7 +514,6 @@ iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num,
acb->sector_num = sector_num;
acb->iscsilun = iscsilun;
acb->qiov = qiov;
- acb->read_size = BDRV_SECTOR_SIZE * (size_t)acb->nb_sectors;
acb->retries = ISCSI_CMD_RETRIES;
if (iscsi_aio_readv_acb(acb) != 0) {
--
1.7.9.5
- [Qemu-devel] [PATCHv3 00/10] iscsi/qemu-img/block-migration enhancements, Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 03/10] iscsi: add .bdrv_co_discard, Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 02/10] iscsi: add .bdrv_co_is_allocated, Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 01/10] iscsi: add logical block provisioning information to iscsilun, Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 04/10] iscsi: add .bdrv_write_zeroes, Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 05/10] block: add bdrv_write_zeroes(), Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 07/10] iscsi: fix -ENOSPC in iscsi_create(), Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 09/10] iscsi: remove support for misaligned nb_sectors in aio_readv,
Peter Lieven <=
- [Qemu-devel] [PATCHv3 08/10] iscsi: factor out sector conversions, Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 10/10] iscsi: assert that sectors are aligned to LUN blocksize, Peter Lieven, 2013/07/11
- [Qemu-devel] [PATCHv3 06/10] block/raw: add bdrv_co_write_zeroes, Peter Lieven, 2013/07/11
- Re: [Qemu-devel] [PATCHv3 00/10] iscsi/qemu-img/block-migration enhancements, Paolo Bonzini, 2013/07/17
- Re: [Qemu-devel] [PATCHv3 00/10] iscsi/qemu-img/block-migration enhancements, Stefan Hajnoczi, 2013/07/18