atomic_t pending;
int error;
+ sector_t sector;
};
struct crypt_config;
struct crypt_config *cc = io->target->private;
struct bio *base_bio = io->base_bio;
struct bio *clone;
- sector_t sector = base_bio->bi_sector - io->target->begin;
atomic_inc(&io->pending);
clone->bi_idx = 0;
clone->bi_vcnt = bio_segments(base_bio);
clone->bi_size = base_bio->bi_size;
- clone->bi_sector = cc->start + sector;
+ clone->bi_sector = cc->start + io->sector;
memcpy(clone->bi_io_vec, bio_iovec(base_bio),
sizeof(struct bio_vec) * clone->bi_vcnt);
struct bio *base_bio = io->base_bio;
struct bio *clone;
unsigned remaining = base_bio->bi_size;
- sector_t sector = base_bio->bi_sector - io->target->begin;
atomic_inc(&io->pending);
- crypt_convert_init(cc, &io->ctx, NULL, base_bio, sector);
+ crypt_convert_init(cc, &io->ctx, NULL, base_bio, io->sector);
/*
* The allocated buffers can be smaller than the whole bio,
/* crypt_convert should have filled the clone bio */
BUG_ON(io->ctx.idx_out < clone->bi_vcnt);
- clone->bi_sector = cc->start + sector;
+ clone->bi_sector = cc->start + io->sector;
remaining -= clone->bi_size;
- sector += bio_sectors(clone);
+ io->sector += bio_sectors(clone);
/* Grab another reference to the io struct
* before we kick off the request */
int r = 0;
crypt_convert_init(cc, &io->ctx, io->base_bio, io->base_bio,
- io->base_bio->bi_sector - io->target->begin);
+ io->sector);
r = crypt_convert(cc, &io->ctx);
io = mempool_alloc(cc->io_pool, GFP_NOIO);
io->target = ti;
io->base_bio = bio;
+ io->sector = bio->bi_sector - ti->begin;
io->error = 0;
atomic_set(&io->pending, 0);