[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/20] ide: propagate the required alignment
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 14/20] ide: propagate the required alignment |
Date: |
Tue, 21 Sep 2010 17:21:56 +0200 |
From: Christoph Hellwig <address@hidden>
IDE is a bit ugly in this respect. For one it doesn't really keep track
of a sector size - most of the protocol is in units of 512 bytes, and we
assume 2048 bytes for CDROMs which is correct most of the time.
Second IDE allocates an I/O buffer long before we know if we're dealing
with a CDROM or not, so increase the alignment for the io_buffer
unconditionally.
Signed-off-by: Christoph Hellwig <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/ide/core.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 1e466d1..06b6e14 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2645,6 +2645,7 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs,
if (bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM) {
s->drive_kind = IDE_CD;
bdrv_set_change_cb(bs, cdrom_change_cb, s);
+ bs->buffer_alignment = 2048;
} else {
if (!bdrv_is_inserted(s->bs)) {
error_report("Device needs media, but drive is empty");
@@ -2679,7 +2680,8 @@ static void ide_init1(IDEBus *bus, int unit)
s->bus = bus;
s->unit = unit;
s->drive_serial = drive_serial++;
- s->io_buffer = qemu_blockalign(s->bs, IDE_DMA_BUF_SECTORS*512 + 4);
+ /* we need at least 2k alignment for accessing CDROMs using O_DIRECT */
+ s->io_buffer = qemu_memalign(2048, IDE_DMA_BUF_SECTORS*512 + 4);
s->io_buffer_total_len = IDE_DMA_BUF_SECTORS*512 + 4;
s->smart_selftest_data = qemu_blockalign(s->bs, 512);
s->sector_write_timer = qemu_new_timer(vm_clock,
--
1.7.2.2
- [Qemu-devel] [PATCH 01/20] vvfat: Fix segfault on write to read-only disk, (continued)
- [Qemu-devel] [PATCH 01/20] vvfat: Fix segfault on write to read-only disk, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 02/20] vvfat: Fix double free for opening the image rw, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 05/20] raw-posix: handle > 512 byte alignment correctly, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 10/20] qcow2: Move sync out of qcow2_alloc_clusters, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 04/20] use qemu_blockalign consistently, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 11/20] qcow2: Get rid of additional sync on COW, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 13/20] scsi-disk: propagate the required alignment, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 07/20] nbd: correctly manage default port, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 08/20] qcow2: Move sync out of write_refcount_block_entries, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 16/20] qcow2: Avoid bounce buffers for AIO read requests, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 14/20] ide: propagate the required alignment,
Kevin Wolf <=
- [Qemu-devel] [PATCH 15/20] cutils: qemu_iovec_copy and qemu_iovec_memset, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 12/20] virtio-blk: propagate the required alignment, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 09/20] qcow2: Move sync out of update_refcount, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 18/20] scsi-generic: add missing reset handler, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 06/20] Improve qemu-nbd performance by 4400 %, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 19/20] scsi_bus: fix length and xfer_mode for RESERVE and RELEASE commands, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 17/20] qcow2: Avoid bounce buffers for AIO write requests, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 20/20] blkverify: Add block driver for verifying I/O, Kevin Wolf, 2010/09/21
- Re: [Qemu-devel] [PULL 00/20] Block patches, Anthony Liguori, 2010/09/21