Merge "md: dm-req-crypt Recalculate nr_phys_segments"

This commit is contained in:
Linux Build Service Account 2014-11-02 09:33:13 -08:00 committed by Gerrit - the friendly Code Review server
commit 8aa3079875
3 changed files with 15 additions and 7 deletions

View File

@ -138,7 +138,6 @@ int attempt_back_merge(struct request_queue *q, struct request *rq);
int attempt_front_merge(struct request_queue *q, struct request *rq);
int blk_attempt_req_merge(struct request_queue *q, struct request *rq,
struct request *next);
void blk_recalc_rq_segments(struct request *rq);
void blk_rq_set_mixed_merge(struct request *rq);
bool blk_rq_merge_ok(struct request *rq, struct bio *bio);
int blk_try_merge(struct request *rq, struct bio *bio);

View File

@ -605,6 +605,11 @@ static void req_cryptd_crypt_write_convert(struct req_dm_crypt_io *io)
blk_queue_bounce(clone->q, &bio_src);
}
/*
* Recalculate the phy_segments as we allocate new pages
* This is used by storage driver to fill the sg list.
*/
blk_recalc_rq_segments(clone);
ablkcipher_req_alloc_failure:
if (req)
@ -867,6 +872,8 @@ static void req_crypt_dtr(struct dm_target *ti)
destroy_workqueue(req_crypt_queue);
req_crypt_queue = NULL;
}
kmem_cache_destroy(_req_crypt_io_pool);
if (dev) {
dm_put_device(ti, dev);
dev = NULL;
@ -936,6 +943,12 @@ static int req_crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
is_fde_enabled = true; /* backward compatible */
}
_req_crypt_io_pool = KMEM_CACHE(req_dm_crypt_io, 0);
if (!_req_crypt_io_pool) {
err = DM_REQ_CRYPT_ERROR;
goto ctr_exit;
}
req_crypt_queue = alloc_workqueue("req_cryptd",
WQ_UNBOUND |
WQ_CPU_INTENSIVE |
@ -1060,14 +1073,11 @@ static int __init req_dm_crypt_init(void)
{
int r;
_req_crypt_io_pool = KMEM_CACHE(req_dm_crypt_io, 0);
if (!_req_crypt_io_pool)
return -ENOMEM;
r = dm_register_target(&req_crypt_target);
if (r < 0) {
DMERR("register failed %d", r);
kmem_cache_destroy(_req_crypt_io_pool);
return r;
}
DMINFO("dm-req-crypt successfully initalized.\n");
@ -1077,7 +1087,6 @@ static int __init req_dm_crypt_init(void)
static void __exit req_dm_crypt_exit(void)
{
kmem_cache_destroy(_req_crypt_io_pool);
dm_unregister_target(&req_crypt_target);
}

View File

@ -765,7 +765,7 @@ extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
struct scsi_ioctl_command __user *);
extern void blk_queue_bio(struct request_queue *q, struct bio *bio);
extern void blk_recalc_rq_segments(struct request *rq);
/*
* A queue has just exitted congestion. Note this in the global counter of
* congested queues, and wake up anyone who was waiting for requests to be