diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-06-11 11:32:48 +0200 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-06-13 16:11:07 +0300 |
commit | 908c7b9f788b6faed2fbfdf19920770614f8e853 (patch) | |
tree | b23075f5b24c2a01777b063bc79f002ab4852dff /hw/xen_disk.c | |
parent | 705032644fb37a516e5072136c1a891d12e6c90e (diff) | |
download | qemu-908c7b9f788b6faed2fbfdf19920770614f8e853.zip qemu-908c7b9f788b6faed2fbfdf19920770614f8e853.tar.gz qemu-908c7b9f788b6faed2fbfdf19920770614f8e853.tar.bz2 |
xen_disk: move sanity check to the correct place
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/xen_disk.c')
-rw-r--r-- | hw/xen_disk.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/hw/xen_disk.c b/hw/xen_disk.c index f95e373..659a839 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -179,10 +179,6 @@ static int ioreq_parse(struct ioreq *ioreq) switch (ioreq->req.operation) { case BLKIF_OP_READ: ioreq->prot = PROT_WRITE; /* to memory */ - if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') { - xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n"); - goto err; - } break; case BLKIF_OP_WRITE_BARRIER: if (!syncwrite) @@ -199,6 +195,11 @@ static int ioreq_parse(struct ioreq *ioreq) goto err; }; + if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') { + xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n"); + goto err; + } + ioreq->start = ioreq->req.sector_number * blkdev->file_blk; for (i = 0; i < ioreq->req.nr_segments; i++) { if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) { |