Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ad8d6ea authored by Dinesh K Garg's avatar Dinesh K Garg
Browse files

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: default avatarDinesh K Garg <dineshg@codeaurora.org>
parent db9b80a5
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
/* 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,15 @@ 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__);
		BUG();
		error = DM_REQ_CRYPT_ERROR;
		goto submit_request;
	}