Commit 68e9ec01 authored by Max Reitz's avatar Max Reitz Committed by Kevin Wolf
Browse files

block: Move guest_block_size into BlockBackend



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: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 4981bdec
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -857,7 +857,6 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
        goto fail_opts;
    }

    bs->guest_block_size = 512;
    bs->request_alignment = 512;
    bs->zero_beyond_eof = true;
    open_flags = bdrv_open_flags(bs, flags);
@@ -2002,7 +2001,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;
@@ -3207,11 +3205,6 @@ void bdrv_lock_medium(BlockDriverState *bs, bool locked)
    }
}

void bdrv_set_guest_block_size(BlockDriverState *bs, int align)
{
    bs->guest_block_size = align;
}

BdrvDirtyBitmap *bdrv_find_dirty_bitmap(BlockDriverState *bs, const char *name)
{
    BdrvDirtyBitmap *bm;
+5 −2
Original line number Diff line number Diff line
@@ -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 {
@@ -351,7 +354,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);
}

@@ -806,7 +809,7 @@ int blk_get_max_transfer_length(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)
+0 −1
Original line number Diff line number Diff line
@@ -466,7 +466,6 @@ void bdrv_img_create(const char *filename, const char *fmt,
size_t bdrv_min_mem_align(BlockDriverState *bs);
/* Returns optimal alignment in bytes for bounce buffer */
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);
+0 −3
Original line number Diff line number Diff line
@@ -411,9 +411,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;