Recent changes (master)
Jens Axboe <[email protected]> Thu, 4 Sep 2025 06:00:01 -0600 (MDT)
| Newsgroups | org.kernel.vger.fio |
|---|---|
| Message-ID | <[email protected]> |
The following changes since commit d6acda3d2e3992dbbb51e6ce2ba5d69e5ef85570:
Merge branch 'patch-1' of https://github.com/neheb/fio (2025-08-26 19:56:42 -0600)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to d4b1dce71cf9fa0f0ba1f53286315a3ebb2147dd:
Merge branch 'sprandom-fixes' of https://github.com/tomas-winkler-sndk/fio (2025-09-03 20:33:23 -0400)
----------------------------------------------------------------
Tomas Winkler (4):
sprandom: setup SPRandom before total_io_size is computed
sprandom: fix debug printout for offset
sprandom: free invalid_pct buffer
sprandom: drop validity_dist after use
Vincent Fu (1):
Merge branch 'sprandom-fixes' of https://github.com/tomas-winkler-sndk/fio
filesetup.c | 20 ++++++++++----------
sprandom.c | 12 ++++++------
sprandom.h | 3 +--
3 files changed, 17 insertions(+), 18 deletions(-)
---
Diff of recent changes:
diff --git a/filesetup.c b/filesetup.c
index 597bf4c5..1e5f2fa7 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -1390,6 +1390,16 @@ int setup_files(struct thread_data *td)
if (err)
goto err_out;
+ if (td->o.sprandom) {
+ if (td->o.nr_files != 1) {
+ log_err("fio: SPRandom supports only one file");
+ goto err_out;
+ }
+ err = sprandom_init(td, td->files[0]);
+ if (err)
+ goto err_out;
+ }
+
if (o->io_size)
td->total_io_size = o->io_size * o->loops;
else
@@ -1402,16 +1412,6 @@ done:
goto err_out;
}
- if (td->o.sprandom) {
- if (td->o.nr_files != 1) {
- log_err("fio: SPRandom supports only one file");
- goto err_out;
- }
- err = sprandom_init(td, td->files[0]);
- if (err)
- goto err_out;
- }
-
if (o->create_only)
td->done = 1;
diff --git a/sprandom.c b/sprandom.c
index 93e8609d..05e8c88a 100644
--- a/sprandom.c
+++ b/sprandom.c
@@ -590,9 +590,6 @@ static int sprandom_setup(struct sprandom_info *spr_info, uint64_t logical_size,
/* Initialize validity_distribution */
print_d_array("validity resampled:", validity_dist, spr_info->num_regions);
- spr_info->validity_dist = validity_dist;
- total_alloc += spr_info->num_regions * sizeof(spr_info->validity_dist[0]);
-
/* Precompute invalidity percentage array */
spr_info->invalid_pct = calloc(spr_info->num_regions,
sizeof(spr_info->invalid_pct[0]));
@@ -605,6 +602,8 @@ static int sprandom_setup(struct sprandom_info *spr_info, uint64_t logical_size,
double inv = (1.0 - validity_dist[i]) * (double)PCT_PRECISION;
spr_info->invalid_pct[i] = (int)round(inv);
}
+ free(validity_dist);
+ validity_dist = NULL;
region_sz = physical_size / spr_info->num_regions;
region_write_count = region_sz / align_bs;
@@ -644,7 +643,7 @@ static int sprandom_setup(struct sprandom_info *spr_info, uint64_t logical_size,
return 0;
err:
- free(spr_info->validity_dist);
+ free(validity_dist);
free(spr_info->invalid_pct);
return -ENOMEM;
}
@@ -722,7 +721,8 @@ int sprandom_get_next_offset(struct sprandom_info *info, struct fio_file *f, uin
/* replay invalidation */
if (pcb_pop(info->invalid_buf, &offset)) {
sprandom_add_with_probability(info, offset, phase ^ 1);
- dprint(FD_SPRANDOM, "Write %"PRIu64" over %d\n", *b, info->current_region);
+ dprint(FD_SPRANDOM, "Write %"PRIu64" over %d\n",
+ offset, info->current_region);
goto out;
}
@@ -829,7 +829,7 @@ void sprandom_free(struct sprandom_info *info)
if (!info)
return;
- free(info->validity_dist);
+ free(info->invalid_pct);
free(info->invalid_buf);
free(info);
}
diff --git a/sprandom.h b/sprandom.h
index ea8b829d..175df8f5 100644
--- a/sprandom.h
+++ b/sprandom.h
@@ -33,12 +33,11 @@ struct sprandom_info {
uint64_t region_sz;
uint32_t num_regions;
- double *validity_dist;
uint32_t *invalid_pct;
/* Invalidation list*/
struct pc_buf *invalid_buf;
- uint64_t invalid_capacity;
+ uint64_t invalid_capacity;
size_t invalid_count[2];
uint32_t current_region;
uint32_t curr_phase;