[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] minios: Fix blkfront driver when sector_size != 512



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1243327759 -3600
# Node ID 85d6849bdcd955bd5a15124c3d5f209d2bc3d51c
# Parent  61404d971c92656b19deb595ed95c9e05f5a6928
minios: Fix blkfront driver when sector_size != 512

The first and last sector as well as the sector number of the request
is expressed in 512 bytes units, independently from the real sector
size.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 extras/mini-os/blkfront.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff -r 61404d971c92 -r 85d6849bdcd9 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Thu May 21 04:31:47 2009 +0100
+++ b/extras/mini-os/blkfront.c Tue May 26 09:49:19 2009 +0100
@@ -310,14 +310,14 @@ void blkfront_aio(struct blkfront_aiocb 
     req->nr_segments = n;
     req->handle = dev->handle;
     req->id = (uintptr_t) aiocbp;
-    req->sector_number = aiocbp->aio_offset / dev->info.sector_size;
+    req->sector_number = aiocbp->aio_offset / 512;
 
     for (j = 0; j < n; j++) {
         req->seg[j].first_sect = 0;
-        req->seg[j].last_sect = PAGE_SIZE / dev->info.sector_size - 1;
-    }
-    req->seg[0].first_sect = ((uintptr_t)aiocbp->aio_buf & ~PAGE_MASK) / 
dev->info.sector_size;
-    req->seg[n-1].last_sect = (((uintptr_t)aiocbp->aio_buf + 
aiocbp->aio_nbytes - 1) & ~PAGE_MASK) / dev->info.sector_size;
+        req->seg[j].last_sect = PAGE_SIZE / 512 - 1;
+    }
+    req->seg[0].first_sect = ((uintptr_t)aiocbp->aio_buf & ~PAGE_MASK) / 512;
+    req->seg[n-1].last_sect = (((uintptr_t)aiocbp->aio_buf + 
aiocbp->aio_nbytes - 1) & ~PAGE_MASK) / 512;
     for (j = 0; j < n; j++) {
        uintptr_t data = start + j * PAGE_SIZE;
         if (!write) {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.