Commit a5b8dd2c authored by Eric Blake's avatar Eric Blake Committed by Kevin Wolf
Browse files

block: Move request_alignment into BlockLimit



It makes more sense to have ALL block size limit constraints
in the same struct.  Improve the documentation while at it.

Simplify a couple of conditionals, now that we have audited and
documented that request_alignment is always non-zero.

Signed-off-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarFam Zheng <famz@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent d9e0dfa2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1016,7 +1016,7 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,

    assert(bdrv_opt_mem_align(bs) != 0);
    assert(bdrv_min_mem_align(bs) != 0);
    assert(is_power_of_2(bs->request_alignment) || bdrv_is_sg(bs));
    assert(is_power_of_2(bs->bl.request_alignment));

    qemu_opts_del(opts);
    return 0;
+1 −1
Original line number Diff line number Diff line
@@ -726,7 +726,7 @@ static void blkdebug_refresh_limits(BlockDriverState *bs, Error **errp)
    BDRVBlkdebugState *s = bs->opaque;

    if (s->align) {
        bs->request_alignment = s->align;
        bs->bl.request_alignment = s->align;
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ fail:

static void bochs_refresh_limits(BlockDriverState *bs, Error **errp)
{
    bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */
    bs->bl.request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O */
}

static int64_t seek_to_sector(BlockDriverState *bs, int64_t sector_num)
+1 −1
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ fail:

static void cloop_refresh_limits(BlockDriverState *bs, Error **errp)
{
    bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */
    bs->bl.request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O */
}

static inline int cloop_read_block(BlockDriverState *bs, int block_num)
+1 −1
Original line number Diff line number Diff line
@@ -548,7 +548,7 @@ fail:

static void dmg_refresh_limits(BlockDriverState *bs, Error **errp)
{
    bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */
    bs->bl.request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O */
}

static inline int is_sector_in_chunk(BDRVDMGState* s,
Loading