[Devel] [PATCH 1/4] blk-cbt: Remove needless zeroing

Nikolay Borisov nikolay.borisov at virtuozzo.com
Fri Jan 27 14:34:38 MSK 2023


The per-cpu allocator guarantees the returned memory is going to be
zeroed out so it's redundant to do our own zeroing when initialising
cbt. Simply remove this code.

Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
---
 block/blk-cbt.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index c7cf7b0ae264..e2a9be83ac0d 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -265,12 +265,8 @@ inline void blk_cbt_bio_queue(struct request_queue *q, struct bio *bio)
 static struct cbt_info* do_cbt_alloc(struct request_queue *q, __u8 *uuid,
 				     loff_t size, loff_t blocksize)
 {
-	struct cbt_info *cbt;
-	struct cbt_extent *ex;
-	int i;
-
+	struct cbt_info *cbt = kzalloc(sizeof(*cbt), GFP_KERNEL);
 
-	cbt = kzalloc(sizeof(*cbt), GFP_KERNEL);
 	if (!cbt)
 		return ERR_PTR(-ENOMEM);
 
@@ -282,11 +278,6 @@ static struct cbt_info* do_cbt_alloc(struct request_queue *q, __u8 *uuid,
 	if (!cbt->cache)
 		goto err_cbt;
 
-	for_each_possible_cpu(i) {
-		ex = per_cpu_ptr(cbt->cache, i);
-		memset(ex, 0, sizeof (*ex));
-	}
-
 	cbt->map = vmalloc(NR_PAGES(cbt->block_max) * sizeof(void*));
 	if (!cbt->map)
 		goto err_pcpu;
-- 
2.34.1



More information about the Devel mailing list