From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Lieven <pl@kamp.de>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com,
ronniesahlberg@gmail.com, famz@redhat.com
Subject: Re: [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target
Date: Thu, 30 Jun 2016 17:59:01 +0200 [thread overview]
Message-ID: <0bdc5c9b-e565-d63d-c82c-acee433c036d@redhat.com> (raw)
In-Reply-To: <1467284899-22575-1-git-send-email-pl@kamp.de>
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
next prev parent reply other threads:[~2016-06-30 15:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2016-07-07 11:40 ` Peter Lieven
2016-07-07 12:21 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0bdc5c9b-e565-d63d-c82c-acee433c036d@redhat.com \
--to=pbonzini@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).