Signed-off-by: Neil Brown <[email protected]>
### Diffstat output
./drivers/block/umem.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff .prev/drivers/block/umem.c ./drivers/block/umem.c
--- .prev/drivers/block/umem.c 2007-07-31 11:21:03.000000000 +1000
+++ ./drivers/block/umem.c 2007-07-31 11:21:11.000000000 +1000
@@ -115,6 +115,7 @@ struct cardinfo {
struct bio *bio, *currentbio, **biotail;
int current_idx;
sector_t current_sector;
+ int current_size;
struct request_queue *queue;
@@ -387,12 +388,14 @@ static int add_bio(struct cardinfo *card
int idx;
int rw;
int len;
+ int bvoffset = 0;
bio = card->currentbio;
if (!bio && card->bio) {
card->currentbio = card->bio;
card->current_idx = 0;
card->current_sector = card->bio->bi_sector;
+ card->current_size = bio->bi_size;
card->bio = card->bio->bi_next;
if (card->bio == NULL)
card->biotail = &card->bio;
@@ -408,10 +411,14 @@ static int add_bio(struct cardinfo *card
return 0;
vec = bio_iovec_idx(bio, idx);
- len = vec->bv_len;
+ if (idx == 0)
+ bvoffset = bio->bi_offset;
+ len = vec->bv_len - bvoffset;
+ if (len > card->current_size)
+ len = card->current_size;
dma_handle = pci_map_page(card->dev,
vec->bv_page,
- vec->bv_offset,
+ vec->bv_offset + bvoffset,
len,
(rw==READ) ?
PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
@@ -446,11 +453,14 @@ static int add_bio(struct cardinfo *card
desc->control_bits |= cpu_to_le32(DMASCR_TRANSFER_READ);
desc->sem_control_bits = desc->control_bits;
+ card->current_size -= len;
card->current_sector += (len >> 9);
idx++;
card->current_idx = idx;
- if (idx >= bio->bi_vcnt)
+ if (idx >= bio->bi_vcnt) {
+ BUG_ON(card->current_size);
card->currentbio = NULL;
+ }
return 1;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]