diff options
author | Kasoju Mallikarjun <mkasoju@nvidia.com> | 2011-12-27 18:57:13 +0530 |
---|---|---|
committer | Varun Wadekar <vwadekar@nvidia.com> | 2012-01-06 18:05:06 +0530 |
commit | 51ef8c15c4fb5eb1eb510a2f4dacf9f98da2bc34 (patch) | |
tree | cd9f40a27176daa6485bccf5770212b766b5da14 /drivers/md | |
parent | 9ae7d2174f250445884817ca86aca2bea1e5c723 (diff) |
Revert "dm crypt: use io thread for reads only if mempool exhausted"
This reverts commit 20c82538e4f5ede51bc2b4795bc6e5cae772796d.
Conflicts:
drivers/md/dm-crypt.c
Change-Id: Id6c1f774c735836652c07ee279fb81093e732372
Reviewed-on: http://git-master/r/72236
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Tested-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Tested-by: Ahung Cheng <ahcheng@nvidia.com>
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-crypt.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index ff5c952a1884..2cd7e42f764b 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -786,22 +786,25 @@ static void clone_init(struct dm_crypt_io *io, struct bio *clone) clone->bi_destructor = dm_crypt_bio_destructor; } -static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp) +static void kcryptd_io_read(struct dm_crypt_io *io) { struct crypt_config *cc = io->target->private; struct bio *base_bio = io->base_bio; struct bio *clone; + crypt_inc_pending(io); + /* * The block layer might modify the bvec array, so always * copy the required bvecs because we need the original * one in order to decrypt the whole bio data *afterwards*. */ - clone = bio_alloc_bioset(gfp, bio_segments(base_bio), cc->bs); - if (!clone) - return 1; - - crypt_inc_pending(io); + clone = bio_alloc_bioset(GFP_NOIO, bio_segments(base_bio), cc->bs); + if (unlikely(!clone)) { + io->error = -ENOMEM; + crypt_dec_pending(io); + return; + } clone_init(io, clone); clone->bi_idx = 0; @@ -812,7 +815,6 @@ static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp) sizeof(struct bio_vec) * clone->bi_vcnt); generic_make_request(clone); - return 0; } static void kcryptd_io_write(struct dm_crypt_io *io) @@ -825,12 +827,9 @@ static void kcryptd_io(struct work_struct *work) { struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); - if (bio_data_dir(io->base_bio) == READ) { - crypt_inc_pending(io); - if (kcryptd_io_read(io, GFP_NOIO)) - io->error = -ENOMEM; - crypt_dec_pending(io); - } else + if (bio_data_dir(io->base_bio) == READ) + kcryptd_io_read(io); + else kcryptd_io_write(io); } @@ -1463,10 +1462,9 @@ static int crypt_map(struct dm_target *ti, struct bio *bio, io = crypt_io_alloc(ti, bio, dm_target_offset(ti, bio->bi_sector)); - if (bio_data_dir(io->base_bio) == READ) { - if (kcryptd_io_read(io, GFP_NOWAIT)) - kcryptd_queue_io(io); - } else + if (bio_data_dir(io->base_bio) == READ) + kcryptd_queue_io(io); + else kcryptd_queue_crypt(io); return DM_MAPIO_SUBMITTED; |