From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGC61-0006G6-Jj for qemu-devel@nongnu.org; Tue, 27 Jan 2015 14:46:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGC5v-00025n-DV for qemu-devel@nongnu.org; Tue, 27 Jan 2015 14:46:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGC5v-00025Q-6m for qemu-devel@nongnu.org; Tue, 27 Jan 2015 14:46:39 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0RJkbCh008038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 27 Jan 2015 14:46:38 -0500 From: Max Reitz Date: Tue, 27 Jan 2015 14:45:42 -0500 Message-Id: <1422387983-32153-10-git-send-email-mreitz@redhat.com> In-Reply-To: <1422387983-32153-1-git-send-email-mreitz@redhat.com> References: <1422387983-32153-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH RESEND 09/50] block: Move guest_block_size into BlockBackend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Jeff Cody , Markus Armbruster , Max Reitz , Stefan Hajnoczi , John Snow guest_block_size is a guest device property so it should be moved into the interface between block layer and guest devices, which is the BlockBackend. Signed-off-by: Max Reitz --- block.c | 7 ------- block/block-backend.c | 7 +++++-- include/block/block.h | 1 - include/block/block_int.h | 3 --- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/block.c b/block.c index aff7682..eff92ca 100644 --- a/block.c +++ b/block.c @@ -965,7 +965,6 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, } bs->open_flags = flags; - bs->guest_block_size = 512; bs->request_alignment = 512; bs->zero_beyond_eof = true; open_flags = bdrv_open_flags(bs, flags); @@ -2039,7 +2038,6 @@ static void bdrv_move_feature_fields(BlockDriverState *bs_dest, /* move some fields that need to stay attached to the device */ /* dev info */ - bs_dest->guest_block_size = bs_src->guest_block_size; bs_dest->copy_on_read = bs_src->copy_on_read; bs_dest->enable_write_cache = bs_src->enable_write_cache; @@ -5286,11 +5284,6 @@ BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, return NULL; } -void bdrv_set_guest_block_size(BlockDriverState *bs, int align) -{ - bs->guest_block_size = align; -} - void *qemu_blockalign(BlockDriverState *bs, size_t size) { return qemu_memalign(bdrv_opt_mem_align(bs), size); diff --git a/block/block-backend.c b/block/block-backend.c index 4a2428e..bf0fcc9 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -31,6 +31,9 @@ struct BlockBackend { /* TODO change to DeviceState when all users are qdevified */ const BlockDevOps *dev_ops; void *dev_opaque; + + /* the block size for which the guest device expects atomicity */ + int guest_block_size; }; typedef struct BlockBackendAIOCB { @@ -334,7 +337,7 @@ void blk_detach_dev(BlockBackend *blk, void *dev) blk->dev = NULL; blk->dev_ops = NULL; blk->dev_opaque = NULL; - bdrv_set_guest_block_size(blk->bs, 512); + blk->guest_block_size = 512; blk_unref(blk); } @@ -763,7 +766,7 @@ int blk_get_flags(BlockBackend *blk) void blk_set_guest_block_size(BlockBackend *blk, int align) { - bdrv_set_guest_block_size(blk->bs, align); + blk->guest_block_size = align; } void *blk_blockalign(BlockBackend *blk, size_t size) diff --git a/include/block/block.h b/include/block/block.h index 3082d2b..df656db 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -425,7 +425,6 @@ void bdrv_img_create(const char *filename, const char *fmt, /* Returns the alignment in bytes that is required so that no bounce buffer * is required throughout the stack */ size_t bdrv_opt_mem_align(BlockDriverState *bs); -void bdrv_set_guest_block_size(BlockDriverState *bs, int align); void *qemu_blockalign(BlockDriverState *bs, size_t size); void *qemu_blockalign0(BlockDriverState *bs, size_t size); void *qemu_try_blockalign(BlockDriverState *bs, size_t size); diff --git a/include/block/block_int.h b/include/block/block_int.h index b340e7e..c6ab73a 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -375,9 +375,6 @@ struct BlockDriverState { /* Alignment requirement for offset/length of I/O requests */ unsigned int request_alignment; - /* the block size for which the guest device expects atomicity */ - int guest_block_size; - /* do we need to tell the quest if we have a volatile write cache? */ int enable_write_cache; -- 2.1.0