Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43835
b: refs/heads/master
c: f00b16a
h: refs/heads/master
i:
  43833: 41be738
  43831: cd8aae0
v: v3
  • Loading branch information
Heinz Mauelshagen authored and Linus Torvalds committed Dec 8, 2006
1 parent c389f4b commit ff17331
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5cd307c5655c0b76d563b5f3f911742a32746841
refs/heads/master: f00b16ad665a9b489d46f612679181f3f914917b
15 changes: 9 additions & 6 deletions trunk/drivers/md/dm-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ void dm_io_put(unsigned int num_pages)
*---------------------------------------------------------------*/
static inline void bio_set_region(struct bio *bio, unsigned region)
{
bio->bi_io_vec[bio->bi_max_vecs - 1].bv_len = region;
bio->bi_io_vec[bio->bi_max_vecs].bv_len = region;
}

static inline unsigned bio_get_region(struct bio *bio)
{
return bio->bi_io_vec[bio->bi_max_vecs - 1].bv_len;
return bio->bi_io_vec[bio->bi_max_vecs].bv_len;
}

/*-----------------------------------------------------------------
Expand Down Expand Up @@ -136,6 +136,7 @@ static int endio(struct bio *bio, unsigned int done, int error)
zero_fill_bio(bio);

dec_count(io, bio_get_region(bio), error);
bio->bi_max_vecs++;
bio_put(bio);

return 0;
Expand Down Expand Up @@ -250,16 +251,18 @@ static void do_region(int rw, unsigned int region, struct io_region *where,

while (remaining) {
/*
* Allocate a suitably sized bio, we add an extra
* bvec for bio_get/set_region().
* Allocate a suitably sized-bio: we add an extra
* bvec for bio_get/set_region() and decrement bi_max_vecs
* to hide it from bio_add_page().
*/
num_bvecs = (remaining / (PAGE_SIZE >> 9)) + 2;
num_bvecs = (remaining / (PAGE_SIZE >> SECTOR_SHIFT)) + 2;
bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, _bios);
bio->bi_sector = where->sector + (where->count - remaining);
bio->bi_bdev = where->bdev;
bio->bi_end_io = endio;
bio->bi_private = io;
bio->bi_destructor = dm_bio_destructor;
bio->bi_max_vecs--;
bio_set_region(bio, region);

/*
Expand Down Expand Up @@ -302,7 +305,7 @@ static void dispatch_io(int rw, unsigned int num_regions,
}

/*
* Drop the extra refence that we were holding to avoid
* Drop the extra reference that we were holding to avoid
* the io being completed too early.
*/
dec_count(io, 0, 0);
Expand Down

0 comments on commit ff17331

Please sign in to comment.