*dev = stripe_mod / stripe_unit * ios->layout->mirrors_p1;
}
-static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_bvec,
- struct exofs_per_dev_state *per_dev, int cur_len)
+static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
+ unsigned pgbase, struct exofs_per_dev_state *per_dev,
+ int cur_len)
{
- unsigned bv = *cur_bvec;
+ unsigned pg = *cur_pg;
struct request_queue *q =
osd_request_queue(exofs_ios_od(ios, per_dev->dev));
if (per_dev->bio == NULL) {
unsigned pages_in_stripe = ios->layout->group_width *
(ios->layout->stripe_unit / PAGE_SIZE);
- unsigned bio_size = (ios->bio->bi_vcnt + pages_in_stripe) /
+ unsigned bio_size = (ios->nr_pages + pages_in_stripe) /
ios->layout->group_width;
per_dev->bio = bio_kmalloc(GFP_KERNEL, bio_size);
}
while (cur_len > 0) {
- int added_len;
- struct bio_vec *bvec = &ios->bio->bi_io_vec[bv];
+ unsigned pglen = min_t(unsigned, PAGE_SIZE - pgbase, cur_len);
+ unsigned added_len;
- BUG_ON(ios->bio->bi_vcnt <= bv);
- cur_len -= bvec->bv_len;
+ BUG_ON(ios->nr_pages <= pg);
+ cur_len -= pglen;
- added_len = bio_add_pc_page(q, per_dev->bio, bvec->bv_page,
- bvec->bv_len, bvec->bv_offset);
- if (unlikely(bvec->bv_len != added_len))
+ added_len = bio_add_pc_page(q, per_dev->bio, ios->pages[pg],
+ pglen, pgbase);
+ if (unlikely(pglen != added_len))
return -ENOMEM;
- ++bv;
+ pgbase = 0;
+ ++pg;
}
BUG_ON(cur_len);
- *cur_bvec = bv;
+ *cur_pg = pg;
return 0;
}
unsigned stripe_unit = ios->layout->stripe_unit;
unsigned comp = 0;
unsigned stripes = 0;
- unsigned cur_bvec = 0;
- int ret;
+ unsigned cur_pg = 0;
+ int ret = 0;
- if (!ios->bio) {
+ if (!ios->pages) {
if (ios->kern_buff) {
struct exofs_per_dev_state *per_dev = &ios->per_dev[0];
unsigned unit_off;
while (length) {
struct exofs_per_dev_state *per_dev = &ios->per_dev[comp];
- unsigned cur_len;
+ unsigned cur_len, page_off;
if (!per_dev->length) {
unsigned unit_off;
stripes++;
cur_len = min_t(u64, stripe_unit - unit_off, length);
offset += cur_len;
+ page_off = unit_off & ~PAGE_MASK;
+ BUG_ON(page_off != ios->pgbase);
} else {
cur_len = min_t(u64, stripe_unit, length);
+ page_off = 0;
}
- ret = _add_stripe_unit(ios, &cur_bvec, per_dev, cur_len);
+ ret = _add_stripe_unit(ios, &cur_pg, page_off , per_dev,
+ cur_len);
if (unlikely(ret))
goto out;
per_dev->or = or;
per_dev->offset = master_dev->offset;
- if (ios->bio) {
+ if (ios->pages) {
struct bio *bio;
if (per_dev != master_dev) {
}
per_dev->or = or;
- if (ios->bio) {
+ if (ios->pages) {
osd_req_read(or, &ios->obj, per_dev->offset,
per_dev->bio, per_dev->length);
EXOFS_DBGMSG("read(0x%llx) offset=0x%llx length=0x%llx"