From 4eff3e579280ca5a5416ffb7fa106791aa23d6ef Mon Sep 17 00:00:00 2001 From: Vasily Tarasov Date: Wed, 28 Jan 2015 09:10:30 -0700 Subject: [PATCH] dedupe_percentage should work even if compress_percentage is not set Currently dedupe_percentage option does not work properly if compress_percentage is not set. This can be easily demonstrated using the following job file: [job-/dev/dm-0] filename=/dev/dm-0 rw=randwrite blocksize=4096 direct=1 ioengine=libaio iodepth=32 dedupe_percentage=50 time_based=1 runtime=5 numjobs=1 All writes will contain zeroes for the above job file. The problem is in fill_io_buffer() function that switches dedupe random state only if o->compress_percentage is set. This patch updates the condition appropriately in fill_io_buffer() appropriately. Signed-off-by: Vasily Tarasov Signed-off-by: Jens Axboe --- io_u.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_u.c b/io_u.c index 77a3abf7..f61fee8c 100644 --- a/io_u.c +++ b/io_u.c @@ -1869,7 +1869,7 @@ void fill_io_buffer(struct thread_data *td, void *buf, unsigned int min_write, { struct thread_options *o = &td->o; - if (o->compress_percentage) { + if (o->compress_percentage || o->dedupe_percentage) { unsigned int perc = td->o.compress_percentage; struct frand_state *rs; unsigned int left = max_bs; -- 2.25.1