mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
block: get rid of blk->guest_block_size
Commit1b7fd72955
("block: rename buffer_alignment to guest_block_size") noted: At this point, the field is set by the device emulation, but completely ignored by the block layer. The last time the value of buffer_alignment/guest_block_size was actually used was before commit339064d506
("block: Don't use guest sector size for qemu_blockalign()"). This value has not been used since 2013. Get rid of it. Cc: Xie Yongji <xieyongji@bytedance.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20220518130945.2657905-1-stefanha@redhat.com> Reviewed-by: Paul Durrant <paul@xen.org> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Faria <afaria@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
3399848b7f
commit
1ab5096b3a
|
@ -56,9 +56,6 @@ struct BlockBackend {
|
||||||
const BlockDevOps *dev_ops;
|
const BlockDevOps *dev_ops;
|
||||||
void *dev_opaque;
|
void *dev_opaque;
|
||||||
|
|
||||||
/* the block size for which the guest device expects atomicity */
|
|
||||||
int guest_block_size;
|
|
||||||
|
|
||||||
/* If the BDS tree is removed, some of its options are stored here (which
|
/* If the BDS tree is removed, some of its options are stored here (which
|
||||||
* can be used to restore those options in the new BDS on insert) */
|
* can be used to restore those options in the new BDS on insert) */
|
||||||
BlockBackendRootState root_state;
|
BlockBackendRootState root_state;
|
||||||
|
@ -998,7 +995,6 @@ void blk_detach_dev(BlockBackend *blk, DeviceState *dev)
|
||||||
blk->dev = NULL;
|
blk->dev = NULL;
|
||||||
blk->dev_ops = NULL;
|
blk->dev_ops = NULL;
|
||||||
blk->dev_opaque = NULL;
|
blk->dev_opaque = NULL;
|
||||||
blk->guest_block_size = 512;
|
|
||||||
blk_set_perm(blk, 0, BLK_PERM_ALL, &error_abort);
|
blk_set_perm(blk, 0, BLK_PERM_ALL, &error_abort);
|
||||||
blk_unref(blk);
|
blk_unref(blk);
|
||||||
}
|
}
|
||||||
|
@ -2100,12 +2096,6 @@ int blk_get_max_iov(BlockBackend *blk)
|
||||||
return blk->root->bs->bl.max_iov;
|
return blk->root->bs->bl.max_iov;
|
||||||
}
|
}
|
||||||
|
|
||||||
void blk_set_guest_block_size(BlockBackend *blk, int align)
|
|
||||||
{
|
|
||||||
IO_CODE();
|
|
||||||
blk->guest_block_size = align;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *blk_try_blockalign(BlockBackend *blk, size_t size)
|
void *blk_try_blockalign(BlockBackend *blk, size_t size)
|
||||||
{
|
{
|
||||||
IO_CODE();
|
IO_CODE();
|
||||||
|
|
|
@ -495,7 +495,6 @@ static int vu_blk_exp_create(BlockExport *exp, BlockExportOptions *opts,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
vexp->blk_size = logical_block_size;
|
vexp->blk_size = logical_block_size;
|
||||||
blk_set_guest_block_size(exp->blk, logical_block_size);
|
|
||||||
|
|
||||||
if (vu_opts->has_num_queues) {
|
if (vu_opts->has_num_queues) {
|
||||||
num_queues = vu_opts->num_queues;
|
num_queues = vu_opts->num_queues;
|
||||||
|
|
|
@ -1228,7 +1228,6 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
|
||||||
|
|
||||||
s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);
|
s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);
|
||||||
blk_set_dev_ops(s->blk, &virtio_block_ops, s);
|
blk_set_dev_ops(s->blk, &virtio_block_ops, s);
|
||||||
blk_set_guest_block_size(s->blk, s->conf.conf.logical_block_size);
|
|
||||||
|
|
||||||
blk_iostatus_enable(s->blk);
|
blk_iostatus_enable(s->blk);
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,6 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
blk_set_dev_ops(blk, &xen_block_dev_ops, blockdev);
|
blk_set_dev_ops(blk, &xen_block_dev_ops, blockdev);
|
||||||
blk_set_guest_block_size(blk, conf->logical_block_size);
|
|
||||||
|
|
||||||
if (conf->discard_granularity == -1) {
|
if (conf->discard_granularity == -1) {
|
||||||
conf->discard_granularity = conf->physical_block_size;
|
conf->discard_granularity = conf->physical_block_size;
|
||||||
|
|
|
@ -2548,7 +2548,6 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,
|
||||||
s->smart_selftest_count = 0;
|
s->smart_selftest_count = 0;
|
||||||
if (kind == IDE_CD) {
|
if (kind == IDE_CD) {
|
||||||
blk_set_dev_ops(blk, &ide_cd_block_ops, s);
|
blk_set_dev_ops(blk, &ide_cd_block_ops, s);
|
||||||
blk_set_guest_block_size(blk, 2048);
|
|
||||||
} else {
|
} else {
|
||||||
if (!blk_is_inserted(s->blk)) {
|
if (!blk_is_inserted(s->blk)) {
|
||||||
error_setg(errp, "Device needs media, but drive is empty");
|
error_setg(errp, "Device needs media, but drive is empty");
|
||||||
|
|
|
@ -2419,7 +2419,6 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
|
||||||
} else {
|
} else {
|
||||||
blk_set_dev_ops(s->qdev.conf.blk, &scsi_disk_block_ops, s);
|
blk_set_dev_ops(s->qdev.conf.blk, &scsi_disk_block_ops, s);
|
||||||
}
|
}
|
||||||
blk_set_guest_block_size(s->qdev.conf.blk, s->qdev.blocksize);
|
|
||||||
|
|
||||||
blk_iostatus_enable(s->qdev.conf.blk);
|
blk_iostatus_enable(s->qdev.conf.blk);
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,6 @@ static void scsi_read_complete(void * opaque, int ret)
|
||||||
s->blocksize = ldl_be_p(&r->buf[8]);
|
s->blocksize = ldl_be_p(&r->buf[8]);
|
||||||
s->max_lba = ldq_be_p(&r->buf[0]);
|
s->max_lba = ldq_be_p(&r->buf[0]);
|
||||||
}
|
}
|
||||||
blk_set_guest_block_size(s->conf.blk, s->blocksize);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Patch MODE SENSE device specific parameters if the BDS is opened
|
* Patch MODE SENSE device specific parameters if the BDS is opened
|
||||||
|
|
|
@ -72,7 +72,6 @@ void blk_error_action(BlockBackend *blk, BlockErrorAction action,
|
||||||
void blk_iostatus_set_err(BlockBackend *blk, int error);
|
void blk_iostatus_set_err(BlockBackend *blk, int error);
|
||||||
int blk_get_max_iov(BlockBackend *blk);
|
int blk_get_max_iov(BlockBackend *blk);
|
||||||
int blk_get_max_hw_iov(BlockBackend *blk);
|
int blk_get_max_hw_iov(BlockBackend *blk);
|
||||||
void blk_set_guest_block_size(BlockBackend *blk, int align);
|
|
||||||
|
|
||||||
void blk_io_plug(BlockBackend *blk);
|
void blk_io_plug(BlockBackend *blk);
|
||||||
void blk_io_unplug(BlockBackend *blk);
|
void blk_io_unplug(BlockBackend *blk);
|
||||||
|
|
Loading…
Reference in a new issue