Re: [PATCH] virtio-blk: set QUEUE_ORDERED_DRAIN by default

From: Christian Borntraeger
Date: Fri Aug 21 2009 - 03:30:52 EST


Am Donnerstag 20 August 2009 22:56:16 schrieb Christoph Hellwig:
> Currently virtio-blk doesn't set any QUEUE_ORDERED_ flag by default, which
> means it does not allow filesystems to use barriers. But the typical use
> case for virtio-blk is to use a backed that uses synchronous I/O, and in
> that case we can simply set QUEUE_ORDERED_DRAIN to make the block layer
> drain the request queue around barrier I/O and provide the semantics that
> the filesystems need. This is what the SCSI disk driver does for disks
> that have the write cache disabled.
>
> With this patch we incorrectly advertise barrier support if someone
> configure qemu with write back caching. While this displays wrong
> information in the guest there is nothing that guest could have done
> even if we rightfully told it that we do not support any barriers.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Make sense to me.
Reviewed-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>

[...]
> - /* If barriers are supported, tell block layer that queue is ordered */
> + /*
> + * If barriers are supported, tell block layer that queue is ordered.
> + *
> + * If no barriers are supported assume the host uses synchronous
> + * writes and just drain the the queue before and after the barrier.
> + */
> if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
> blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL);
> + else
> + blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_DRAIN, NULL);
[...]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/