qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 3/3] Drop internal bdrv_pread()/bdrv_pwrite() APIs
Date: Sun, 08 Feb 2009 21:37:49 +0200	[thread overview]
Message-ID: <498F348D.3040309@redhat.com> (raw)
In-Reply-To: <498F2E1E.8030605@codemonkey.ws>

Anthony Liguori wrote:
> Avi Kivity wrote:
>> Now that scsi generic no longer uses bdrv_pread() and bdrv_pwrite(), 
>> we can
>> drop the corresponding internal APIs, which overlap 
>> bdrv_read()/bdrv_write()
>> and, being byte oriented, are unnatural for a block device.
>>
>> Signed-off-by: Avi Kivity <avi@redhat.com>
>>
>>  int bdrv_truncate(BlockDriverState *bs, int64_t offset)
>> diff --git a/block_int.h b/block_int.h
>> index e4630f0..cc9966b 100644
>> --- a/block_int.h
>> +++ b/block_int.h
>> @@ -58,10 +58,6 @@ struct BlockDriver {
>>      int aiocb_size;
>>  
>>      const char *protocol_name;
>> -    int (*bdrv_pread)(BlockDriverState *bs, int64_t offset,
>> -                      uint8_t *buf, int count);
>> -    int (*bdrv_pwrite)(BlockDriverState *bs, int64_t offset,
>> -                       const uint8_t *buf, int count);
>>   
>
> $ grep -l bdrv_pwrite *.c hw/*.c
> block.c
> block-qcow2.c
> block-qcow.c
> block-raw-posix.c
> block-raw-win32.c
> block-vmdk.c
> block-vpc.c
> savevm.c
> hw/scsi-generic.c
>
> So there's a lot of users other than scsi-generic.  Usually, these 
> callers are in the block layer to read/write metadata that isn't 
> always block aligned.  Some buffer adjustment could fix savevm.c to 
> ensure alignment.

It's more accurate to say that there are now no users that depend on the 
request size.  The other users will happily allow expansion of a small 
request to a sector.

> These users are now relegated to using emulated pread/pwrite?  Won't 
> that have a noticable impact on performance if updating small bits of 
> metadata.  For instance, I think updating qcow2 refcounts would look 
> bad since you have to read/write the full block to update 4 bytes of 
> data.  Granted it'll be cached, but...

I haven't measured but I'll bet the impact is unnoticable.  We're 
doubling the syscall count for writes, but the actual transfer (if 
cached) or the I/O (if uncached) will swamp that.  For reads, we're 
copying a bit more data, but that won't even tickle performance.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

  parent reply	other threads:[~2009-02-08 19:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-08 17:59 [Qemu-devel] [PATCH 0/3] Remove ->bdrv_pread() internal block layer API Avi Kivity
2009-02-08 17:59 ` [Qemu-devel] [PATCH 1/3] Add specialized block driver scsi generic API Avi Kivity
2009-02-08 17:59 ` [Qemu-devel] [PATCH 2/3] Add internal scsi generic block API Avi Kivity
2009-02-08 17:59 ` [Qemu-devel] [PATCH 3/3] Drop internal bdrv_pread()/bdrv_pwrite() APIs Avi Kivity
2009-02-08 19:10   ` [Qemu-devel] " Anthony Liguori
2009-02-08 19:36     ` Avi Kivity
2009-02-08 19:37     ` Avi Kivity [this message]
2009-02-08 19:05 ` [Qemu-devel] Re: [PATCH 0/3] Remove ->bdrv_pread() internal block layer API Anthony Liguori

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=498F348D.3040309@redhat.com \
    --to=avi@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /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).