diff options
| -rw-r--r-- | drivers/block/xen-blkfront.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index cfdb033c7107..11043c18ac5a 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
| @@ -836,7 +836,7 @@ static void blkif_free(struct blkfront_info *info, int suspend) | |||
| 836 | static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, | 836 | static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, |
| 837 | struct blkif_response *bret) | 837 | struct blkif_response *bret) |
| 838 | { | 838 | { |
| 839 | int i; | 839 | int i = 0; |
| 840 | struct bio_vec *bvec; | 840 | struct bio_vec *bvec; |
| 841 | struct req_iterator iter; | 841 | struct req_iterator iter; |
| 842 | unsigned long flags; | 842 | unsigned long flags; |
| @@ -853,7 +853,8 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, | |||
| 853 | */ | 853 | */ |
| 854 | rq_for_each_segment(bvec, s->request, iter) { | 854 | rq_for_each_segment(bvec, s->request, iter) { |
| 855 | BUG_ON((bvec->bv_offset + bvec->bv_len) > PAGE_SIZE); | 855 | BUG_ON((bvec->bv_offset + bvec->bv_len) > PAGE_SIZE); |
| 856 | i = offset >> PAGE_SHIFT; | 856 | if (bvec->bv_offset < offset) |
| 857 | i++; | ||
| 857 | BUG_ON(i >= s->req.u.rw.nr_segments); | 858 | BUG_ON(i >= s->req.u.rw.nr_segments); |
| 858 | shared_data = kmap_atomic( | 859 | shared_data = kmap_atomic( |
| 859 | pfn_to_page(s->grants_used[i]->pfn)); | 860 | pfn_to_page(s->grants_used[i]->pfn)); |
| @@ -862,7 +863,7 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, | |||
| 862 | bvec->bv_len); | 863 | bvec->bv_len); |
| 863 | bvec_kunmap_irq(bvec_data, &flags); | 864 | bvec_kunmap_irq(bvec_data, &flags); |
| 864 | kunmap_atomic(shared_data); | 865 | kunmap_atomic(shared_data); |
| 865 | offset += bvec->bv_len; | 866 | offset = bvec->bv_offset + bvec->bv_len; |
| 866 | } | 867 | } |
| 867 | } | 868 | } |
| 868 | /* Add the persistent grant into the list of free grants */ | 869 | /* Add the persistent grant into the list of free grants */ |
