Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97519
b: refs/heads/master
c: 3ef5360
h: refs/heads/master
i:
  97517: 3602d5b
  97515: e8178de
  97511: 1785415
  97503: 234cea0
v: v3
  • Loading branch information
Christian Borntraeger authored and Rusty Russell committed May 30, 2008
1 parent ede8def commit 6d60a3a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a16ffe93c46dfca211434d00453ebb695025978b
refs/heads/master: 3ef536095446552823fc488fec1c5451aab1260d
6 changes: 5 additions & 1 deletion trunk/drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ static int virtblk_probe(struct virtio_device *vdev)
if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL);

/* If disk is read-only in the host, the guest should obey */
if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))
set_disk_ro(vblk->disk, 1);

/* Host must always specify the capacity. */
vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity),
&cap, sizeof(cap));
Expand Down Expand Up @@ -326,7 +330,7 @@ static struct virtio_device_id id_table[] = {

static unsigned int features[] = {
VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
VIRTIO_BLK_F_GEOMETRY,
VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO,
};

static struct virtio_driver virtio_blk = {
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/virtio_blk.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */

struct virtio_blk_config
{
Expand Down

0 comments on commit 6d60a3a

Please sign in to comment.