[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] iscsi: add intelligent has_zero_init check
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] iscsi: add intelligent has_zero_init check |
Date: |
Fri, 21 Jun 2013 22:00:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
Il 20/06/2013 20:20, Peter Lieven ha scritto:
> + for (lba = 0; lba < iscsilun->num_blocks; lba += 1 << 26) {
> + nb_sectors = 1 << 26;
> + if (lba + nb_sectors > iscsilun->num_blocks) {
> + nb_sectors = iscsilun->num_blocks - lba;
> + }
> + nb_sectors *= (iscsilun->block_size / BDRV_SECTOR_SIZE);
> + n = 0;
> + ret = iscsi_co_is_allocated(bs, lba, nb_sectors, &n);
> + if (ret || n != nb_sectors) {
> + return 0;
> + }
I would just do lba += n in the for loop, and only exit if n == 0. The
SCSI spec does not forbid splitting a single allocated area into
multiple descriptors, or only returning part of an allocated area into
the last descriptor.
Otherwise looks good, but you may want to cache the result. It would
not be 1 anymore after the first write.
Paolo
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), (continued)
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Paolo Bonzini, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Peter Lieven, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), ronnie sahlberg, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Peter Lieven, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), ronnie sahlberg, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Paolo Bonzini, 2013/06/21
[Qemu-devel] [PATCH 2/2] iscsi: add intelligent has_zero_init check, Peter Lieven, 2013/06/20
- Re: [Qemu-devel] [PATCH 2/2] iscsi: add intelligent has_zero_init check,
Paolo Bonzini <=
[Qemu-devel] [PATCH 0/2] iscsi: support for is_allocated and inproved has_zero_init, Peter Lieven, 2013/06/20