summaryrefslogtreecommitdiff
path: root/dedupe.c
diff options
context:
space:
mode:
authorBar David <bardavvid@gmail.com>2021-10-24 13:59:50 +0300
committerBar David <bardavvid@gmail.com>2021-11-21 09:16:59 +0200
commiteb57e710557147c880ade7568538ad7435a6f0dd (patch)
tree8cf87738aa07a5b909d46dc3aadde2ba4c0eb5ba /dedupe.c
parent9f51d89c683d70cd8ab23ba09ec6e628a548af5a (diff)
downloadfio-eb57e710557147c880ade7568538ad7435a6f0dd.tar.gz
fio-eb57e710557147c880ade7568538ad7435a6f0dd.tar.bz2
Mixed dedup and compression
Introducing support for dedupe and compression on the same job. When used together, compression is calculated from unique capacity. E.g. when using dedupe_percentage=50 and buffer_compress_percentage=50, then total reduction should be 75% - 50% would be deduped while 50% of the remaining buffers would be compressed Signed-off-by: Bar David <bardavvid@gmail.com>
Diffstat (limited to 'dedupe.c')
-rw-r--r--dedupe.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/dedupe.c b/dedupe.c
index 043a376c..fd116dfb 100644
--- a/dedupe.c
+++ b/dedupe.c
@@ -2,12 +2,14 @@
int init_dedupe_working_set_seeds(struct thread_data *td)
{
- unsigned long long i;
+ unsigned long long i, j, num_seed_advancements;
struct frand_state dedupe_working_set_state = {0};
if (!td->o.dedupe_percentage || !(td->o.dedupe_mode == DEDUPE_MODE_WORKING_SET))
return 0;
+ num_seed_advancements = td->o.min_bs[DDIR_WRITE] /
+ min_not_zero(td->o.min_bs[DDIR_WRITE], (unsigned long long) td->o.compress_chunk);
/*
* The dedupe working set keeps seeds of unique data (generated by buf_state).
* Dedupe-ed pages will be generated using those seeds.
@@ -21,7 +23,13 @@ int init_dedupe_working_set_seeds(struct thread_data *td)
frand_copy(&dedupe_working_set_state, &td->buf_state);
for (i = 0; i < td->num_unique_pages; i++) {
frand_copy(&td->dedupe_working_set_states[i], &dedupe_working_set_state);
- __get_next_seed(&dedupe_working_set_state);
+ /*
+ * When compression is used the seed is advanced multiple times to
+ * generate the buffer. We want to regenerate the same buffer when
+ * deduping against this page
+ */
+ for (j = 0; j < num_seed_advancements; j++)
+ __get_next_seed(&dedupe_working_set_state);
}
return 0;