From: Jens Axboe Date: Wed, 24 Sep 2014 14:21:15 +0000 (-0600) Subject: dedupe: don't add extent items unless we use them X-Git-Tag: fio-2.1.13~47 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=87818659165be63891f382709073c89301c30a06 dedupe: don't add extent items unless we use them Only used for collision_check and debug output, so save memory if those aren't enabled. Signed-off-by: Jens Axboe --- diff --git a/t/dedupe.c b/t/dedupe.c index e51e444e..7acb090a 100644 --- a/t/dedupe.c +++ b/t/dedupe.c @@ -134,11 +134,18 @@ static int read_block(int fd, void *buf, off_t offset) static void add_item(struct chunk *c, struct item *i) { - struct extent *e; + /* + * Save some memory and don't add extent items, if we don't + * use them. + */ + if (dump_output || collision_check) { + struct extent *e; + + e = malloc(sizeof(*e)); + e->offset = i->offset; + flist_add_tail(&e->list, &c->extent_list); + } - e = malloc(sizeof(*e)); - e->offset = i->offset; - flist_add_tail(&e->list, &c->extent_list); c->count++; }