* [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target
@ 2016-06-30 11:08 Peter Lieven
2016-06-30 15:59 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Peter Lieven @ 2016-06-30 11:08 UTC (permalink / raw)
To: qemu-block
Cc: qemu-devel, pbonzini, kwolf, mreitz, ronniesahlberg, famz, Peter Lieven
this fills up the allocationmap at iscsi_open. This helps
to reduce the number of get_block_status requests during runtime
significantly.
Signed-off-by: Peter Lieven <pl@kamp.de>
---
block/iscsi.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/block/iscsi.c b/block/iscsi.c
index 0cdcedb..04fb0a3 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1774,6 +1774,22 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
iscsilun->block_size) >> BDRV_SECTOR_BITS;
if (iscsilun->lbprz) {
ret = iscsi_allocmap_init(iscsilun, bs->open_flags);
+ if (ret == 0) {
+ unsigned int max_reqs = 64;
+ int64_t sector_num = 0;
+ while (max_reqs-- && sector_num < bs->total_sectors) {
+ int n;
+ BlockDriverState *file;
+ ret = bdrv_get_block_status(bs, sector_num,
+ BDRV_REQUEST_MAX_SECTORS,
+ &n, &file);
+ if (ret < 0) {
+ break;
+ }
+ sector_num += n;
+ ret = 0;
+ }
+ }
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target
2016-06-30 11:08 [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target Peter Lieven
@ 2016-06-30 15:59 ` Paolo Bonzini
2016-07-07 11:40 ` Peter Lieven
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2016-06-30 15:59 UTC (permalink / raw)
To: Peter Lieven, qemu-block; +Cc: qemu-devel, kwolf, mreitz, ronniesahlberg, famz
On 30/06/2016 13:08, Peter Lieven wrote:
> this fills up the allocationmap at iscsi_open. This helps
> to reduce the number of get_block_status requests during runtime
> significantly.
>
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
> block/iscsi.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 0cdcedb..04fb0a3 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -1774,6 +1774,22 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
> iscsilun->block_size) >> BDRV_SECTOR_BITS;
> if (iscsilun->lbprz) {
> ret = iscsi_allocmap_init(iscsilun, bs->open_flags);
> + if (ret == 0) {
> + unsigned int max_reqs = 64;
> + int64_t sector_num = 0;
> + while (max_reqs-- && sector_num < bs->total_sectors) {
> + int n;
> + BlockDriverState *file;
> + ret = bdrv_get_block_status(bs, sector_num,
> + BDRV_REQUEST_MAX_SECTORS,
> + &n, &file);
> + if (ret < 0) {
> + break;
> + }
> + sector_num += n;
> + ret = 0;
> + }
> + }
> }
> }
>
>
This can take a long time and the disks may not even be ever used. I
don't think it's a good idea.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target
2016-06-30 15:59 ` Paolo Bonzini
@ 2016-07-07 11:40 ` Peter Lieven
2016-07-07 12:21 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Peter Lieven @ 2016-07-07 11:40 UTC (permalink / raw)
To: Paolo Bonzini, qemu-block; +Cc: qemu-devel, kwolf, mreitz, ronniesahlberg, famz
Am 30.06.2016 um 17:59 schrieb Paolo Bonzini:
>
> On 30/06/2016 13:08, Peter Lieven wrote:
>> this fills up the allocationmap at iscsi_open. This helps
>> to reduce the number of get_block_status requests during runtime
>> significantly.
>>
>> Signed-off-by: Peter Lieven <pl@kamp.de>
>> ---
>> block/iscsi.c | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/block/iscsi.c b/block/iscsi.c
>> index 0cdcedb..04fb0a3 100644
>> --- a/block/iscsi.c
>> +++ b/block/iscsi.c
>> @@ -1774,6 +1774,22 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
>> iscsilun->block_size) >> BDRV_SECTOR_BITS;
>> if (iscsilun->lbprz) {
>> ret = iscsi_allocmap_init(iscsilun, bs->open_flags);
>> + if (ret == 0) {
>> + unsigned int max_reqs = 64;
>> + int64_t sector_num = 0;
>> + while (max_reqs-- && sector_num < bs->total_sectors) {
>> + int n;
>> + BlockDriverState *file;
>> + ret = bdrv_get_block_status(bs, sector_num,
>> + BDRV_REQUEST_MAX_SECTORS,
>> + &n, &file);
>> + if (ret < 0) {
>> + break;
>> + }
>> + sector_num += n;
>> + ret = 0;
>> + }
>> + }
>> }
>> }
>>
>>
> This can take a long time and the disks may not even be ever used. I
> don't think it's a good idea.
Sure, the target might stay unused, but why do you suspect its slow?
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target
2016-07-07 11:40 ` Peter Lieven
@ 2016-07-07 12:21 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2016-07-07 12:21 UTC (permalink / raw)
To: Peter Lieven, qemu-block; +Cc: kwolf, famz, qemu-devel, ronniesahlberg, mreitz
On 07/07/2016 13:40, Peter Lieven wrote:
>>>
>> This can take a long time and the disks may not even be ever used. I
>> don't think it's a good idea.
>
> Sure, the target might stay unused, but why do you suspect its slow?
I don't suspect it's slow; it's just that it can be O(size of disk), and
can send really a lot of commands down the link. I don't think it's a
good thing to do in advance.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-07 12:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-30 11:08 [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target Peter Lieven
2016-06-30 15:59 ` Paolo Bonzini
2016-07-07 11:40 ` Peter Lieven
2016-07-07 12:21 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.