qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, anthony@codemonkey.ws, stefanha@redhat.com,
	qemu-devel@nongnu.org, ronniesahlberg@gmail.com
Subject: Re: [Qemu-devel] [PATCHv5] block/get_block_status: avoid redundant callouts on raw devices
Date: Mon, 07 Oct 2013 11:25:14 +0200	[thread overview]
Message-ID: <52527DFA.3000701@kamp.de> (raw)
In-Reply-To: <52527015.4090103@redhat.com>

On 07.10.2013 10:25, Paolo Bonzini wrote:
> Il 07/10/2013 07:59, Peter Lieven ha scritto:
>> if a raw device like an iscsi target or host device is used
>> the current implementation makes a second call out to get
>> the block status of bs->file.
>>
>> Signed-off-by: Peter Lieven <pl@kamp.de>
>> ---
>> v5: add a generic get_lba_status function in the raw driver which
>>      adds the BDRV_BLOCK_RAW flag. bdrv_co_get_block_status will
>>      handle the callout to bs->file then.
>>
>> v4: use a flag to detect the raw driver instead of the strncmp
>>      hack
>>
>>   block.c               |    4 ++++
>>   block/raw_bsd.c       |    3 ++-
>>   include/block/block.h |    4 ++++
>>   3 files changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/block.c b/block.c
>> index 93e113a..38a589e 100644
>> --- a/block.c
>> +++ b/block.c
>> @@ -3147,6 +3147,10 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
>>           return ret;
>>       }
>>   
>> +    if (ret & BDRV_BLOCK_RAW) {
>> +        return bdrv_get_block_status(bs->file, sector_num, nb_sectors, pnum);
> Strictly speaking, this should probably do something like this:
>
>    assert(ret & BDRV_BLOCK_OFFSET_VALID);
>    return bdrv_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS,
>                                 nb_sectors, pnum);
>
> Or alternatively the raw driver should return just "BDRV_BLOCK_RAW".
>
> As a third option, the raw driver could also return not just
> BDRV_BLOCK_RAW and BDRV_BLOCK_OFFSET_VALID, but also BDRV_BLOCK_DATA (so
> that the answer makes some sense even without going down to bs->file).
>
> But I'll let the block maintainers decide what to do.
Okay, I will wait for their feedback.

Peter

  reply	other threads:[~2013-10-07  9:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-07  5:59 [Qemu-devel] [PATCHv5] block/get_block_status: avoid redundant callouts on raw devices Peter Lieven
2013-10-07  8:25 ` Paolo Bonzini
2013-10-07  9:25   ` Peter Lieven [this message]
2013-10-08 11:13   ` Stefan Hajnoczi
2013-10-08 12:05   ` Peter Lieven
2013-10-08 12:36     ` 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=52527DFA.3000701@kamp.de \
    --to=pl@kamp.de \
    --cc=anthony@codemonkey.ws \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=stefanha@redhat.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).