Patchwork [49/55] block: Declare qemu_blockalign() in block.h, not block_int.h

login
register
mail settings
Submitter Markus Armbruster
Date July 20, 2011, 4:24 p.m.
Message ID <1311179069-27882-50-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/105979/
State New
Headers show

Comments

Markus Armbruster - July 20, 2011, 4:24 p.m.
Device models should be able to use it without an unclean include of
block_int.h.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block.h     |    2 ++
 block_int.h |    2 --
 hw/sd.c     |    1 -
 3 files changed, 2 insertions(+), 3 deletions(-)
Christoph Hellwig - July 26, 2011, 1:05 p.m.
On Wed, Jul 20, 2011 at 06:24:23PM +0200, Markus Armbruster wrote:
> Device models should be able to use it without an unclean include of
> block_int.h.

Hmm.  We already do proper read-modify-write cycles for actual data
transfers, so killing the buffer inside SD sounds like the better
idea.  qemu_blockalign really should be used only for block-layer internal
allocations.
Markus Armbruster - July 26, 2011, 2:10 p.m.
Christoph Hellwig <hch@lst.de> writes:

> On Wed, Jul 20, 2011 at 06:24:23PM +0200, Markus Armbruster wrote:
>> Device models should be able to use it without an unclean include of
>> block_int.h.
>
> Hmm.  We already do proper read-modify-write cycles for actual data
> transfers, so killing the buffer inside SD sounds like the better
> idea.  qemu_blockalign really should be used only for block-layer internal
> allocations.

Ok, dropping the patch.
Markus Armbruster - July 29, 2011, 8:56 a.m.
Christoph Hellwig <hch@lst.de> writes:

> On Wed, Jul 20, 2011 at 06:24:23PM +0200, Markus Armbruster wrote:
>> Device models should be able to use it without an unclean include of
>> block_int.h.
>
> Hmm.  We already do proper read-modify-write cycles for actual data
> transfers, so killing the buffer inside SD sounds like the better
> idea.  qemu_blockalign really should be used only for block-layer internal
> allocations.

What about the uses in scsi-disk.c and ide/core.c?
Christoph Hellwig - July 29, 2011, 1:11 p.m.
On Fri, Jul 29, 2011 at 10:56:07AM +0200, Markus Armbruster wrote:
> > Hmm.  We already do proper read-modify-write cycles for actual data
> > transfers, so killing the buffer inside SD sounds like the better
> > idea.  qemu_blockalign really should be used only for block-layer internal
> > allocations.
> 
> What about the uses in scsi-disk.c and ide/core.c?

They are allocating internal bounce buffers due to suboptimal I/O
models.  But given that this is the reality in multiple qemu drivers I
think I'll give up and ack the move.

Patch

diff --git a/block.h b/block.h
index b6eaaba..8f52abb 100644
--- a/block.h
+++ b/block.h
@@ -264,6 +264,8 @@  int bdrv_img_create(const char *filename, const char *fmt,
                     const char *base_filename, const char *base_fmt,
                     char *options, uint64_t img_size, int flags);
 
+void *qemu_blockalign(BlockDriverState *bs, size_t size);
+
 #define BDRV_SECTORS_PER_DIRTY_CHUNK 2048
 
 void bdrv_set_dirty_tracking(BlockDriverState *bs, int enable);
diff --git a/block_int.h b/block_int.h
index 7e74d01..768c842 100644
--- a/block_int.h
+++ b/block_int.h
@@ -213,8 +213,6 @@  void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs,
                    BlockDriverCompletionFunc *cb, void *opaque);
 void qemu_aio_release(void *p);
 
-void *qemu_blockalign(BlockDriverState *bs, size_t size);
-
 #ifdef _WIN32
 int is_windows_drive(const char *filename);
 #endif
diff --git a/hw/sd.c b/hw/sd.c
index 4dc9047..fdd87b0 100644
--- a/hw/sd.c
+++ b/hw/sd.c
@@ -31,7 +31,6 @@ 
 
 #include "hw.h"
 #include "block.h"
-#include "block_int.h"
 #include "sd.h"
 
 //#define DEBUG_SD 1