From 03a29a9ee5f6a45fc52ded7a4f0e063cfe34bf0d Mon Sep 17 00:00:00 2001 From: Andrey Markovytch Date: Wed, 20 Apr 2016 15:29:13 +0300 Subject: md: dm-req-crypt: Increase mempool size for dm-req-crypt data DM layer allocates pool size of 256 for request based module while dm-req-crypt internally allocates pool for minimum 16 requests. Increasing pool size of dm-req-crypt to be consistent with DM layer. Also, changing GFP mask for allocation from pool, depending upon whether call is made from atomic context or not. Change-Id: I9dfeb46520e0d1b1fc6f850a007fce35bdc60d35 Signed-off-by: Dinesh K Garg Signed-off-by: Andrey Markovytch --- drivers/md/dm-req-crypt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/md') diff --git a/drivers/md/dm-req-crypt.c b/drivers/md/dm-req-crypt.c index efb1748bebc7..e4d080ea50e4 100644 --- a/drivers/md/dm-req-crypt.c +++ b/drivers/md/dm-req-crypt.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. @@ -40,7 +40,7 @@ #define MAX_SG_LIST 1024 #define REQ_DM_512_KB (512*1024) #define MAX_ENCRYPTION_BUFFERS 1 -#define MIN_IOS 16 +#define MIN_IOS 256 #define MIN_POOL_PAGES 32 #define KEY_SIZE_XTS 32 #define AES_XTS_IV_LEN 16 @@ -912,10 +912,14 @@ static int req_crypt_map(struct dm_target *ti, struct request *clone, struct req_dm_crypt_io *req_io = NULL; int error = DM_REQ_CRYPT_ERROR, copy_bio_sector_to_req = 0; struct bio *bio_src = NULL; + gfp_t gfp_flag = GFP_KERNEL; - req_io = mempool_alloc(req_io_pool, GFP_NOWAIT); + if (in_interrupt() || irqs_disabled()) + gfp_flag = GFP_NOWAIT; + + req_io = mempool_alloc(req_io_pool, gfp_flag); if (!req_io) { - DMERR("%s req_io allocation failed\n", __func__); + WARN_ON(1); error = DM_REQ_CRYPT_ERROR; goto submit_request; } -- cgit v1.2.3