ia64/xen-unstable

changeset 19635:85d6849bdcd9

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@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 26 09:49:19 2009 +0100 (2009-05-26)
parents 61404d971c92
children 0f752c773497
files extras/mini-os/blkfront.c
line diff
     1.1 --- a/extras/mini-os/blkfront.c	Thu May 21 04:31:47 2009 +0100
     1.2 +++ b/extras/mini-os/blkfront.c	Tue May 26 09:49:19 2009 +0100
     1.3 @@ -310,14 +310,14 @@ void blkfront_aio(struct blkfront_aiocb 
     1.4      req->nr_segments = n;
     1.5      req->handle = dev->handle;
     1.6      req->id = (uintptr_t) aiocbp;
     1.7 -    req->sector_number = aiocbp->aio_offset / dev->info.sector_size;
     1.8 +    req->sector_number = aiocbp->aio_offset / 512;
     1.9  
    1.10      for (j = 0; j < n; j++) {
    1.11          req->seg[j].first_sect = 0;
    1.12 -        req->seg[j].last_sect = PAGE_SIZE / dev->info.sector_size - 1;
    1.13 +        req->seg[j].last_sect = PAGE_SIZE / 512 - 1;
    1.14      }
    1.15 -    req->seg[0].first_sect = ((uintptr_t)aiocbp->aio_buf & ~PAGE_MASK) / dev->info.sector_size;
    1.16 -    req->seg[n-1].last_sect = (((uintptr_t)aiocbp->aio_buf + aiocbp->aio_nbytes - 1) & ~PAGE_MASK) / dev->info.sector_size;
    1.17 +    req->seg[0].first_sect = ((uintptr_t)aiocbp->aio_buf & ~PAGE_MASK) / 512;
    1.18 +    req->seg[n-1].last_sect = (((uintptr_t)aiocbp->aio_buf + aiocbp->aio_nbytes - 1) & ~PAGE_MASK) / 512;
    1.19      for (j = 0; j < n; j++) {
    1.20  	uintptr_t data = start + j * PAGE_SIZE;
    1.21          if (!write) {