Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Feb 10

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 6783ccc569c8e427cb3cfe4e8b37e18fa0601d9f:

options: ensure callback handlers handle NULL input (2026-02-08 08:39:27 -0700)

are available in the Git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 05b2e9fe7722af4470139465a53c629c40936cb4:

fio: bump server version for new option (2026-02-10 07:36:17 -0500)

----------------------------------------------------------------
Charles Henry (1):
SPRandom Cache Size Behavior Implementation

Vincent Fu (2):
Merge branch 'sprandom-cache-implementation' of https://github.com/cachyyyk/fio-spr-cache
fio: bump server version for new option

 HOWTO.rst        | 18 +++++++++++++
 cconv.c          |  2 ++
 fio.1            | 18 +++++++++++++
 options.c        | 13 ++++++++++
 server.h         |  2 +-
 sprandom.c       | 77 +++++++++++++++++++++++++++++++++++++++++++++++---------
 sprandom.h       |  1 +
 t/sprandom.py    | 41 +++++++++++++++++++++++++++++-
 thread_options.h |  2 ++
 9 files changed, 160 insertions(+), 14 deletions(-)

---

Diff of recent changes:

HOWTO.rst +18 -0
index fcb8a914..d31851e9 100644
@@ -1674,6 +1674,24 @@ I/O type
         Default=0.15
 
 
+.. option:: spr_cs=int
+
+	See :option:`sprandom`. Define a cache size in bytes, as specified
+	    by the SSD manufacturer. When this is non-zero, delay invalidating
+		writes by one region in order to make sure that all original
+		writes from a region are flushed from cache before the later
+		invalidating writes are sent to the device. This deferral
+		prevents the original write and the later invalidating write
+		from being present in the device's cache at the same time which
+		would allow the device to ignore the original write and prevent
+		sprandom from achieving its target validity fractions. The
+		actual cache size is used to ensure that the number of regions
+		is not set so large that the size of a region is smaller than
+		the device cache.
+
+        Default=0
+
+
 Block size
 ~~~~~~~~~~
 
cconv.c +2 -0
index 3d7b3d14..9f82c724 100644
@@ -233,6 +233,7 @@ int convert_thread_options_to_cpu(struct thread_options *o,
 	o->sprandom = le32_to_cpu(top->sprandom);
 	o->spr_num_regions = le32_to_cpu(top->spr_num_regions);
 	o->spr_over_provisioning.u.f = fio_uint64_to_double(le64_to_cpu(top->spr_over_provisioning.u.i));
+	o->spr_cache_size = le64_to_cpu(top->spr_cache_size);
 	o->bs_unaligned = le32_to_cpu(top->bs_unaligned);
 	o->fsync_on_close = le32_to_cpu(top->fsync_on_close);
 	o->bs_is_seq_rand = le32_to_cpu(top->bs_is_seq_rand);
@@ -486,6 +487,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
 	top->sprandom = cpu_to_le32(o->sprandom);
 	top->spr_num_regions = cpu_to_le32(o->spr_num_regions);
 	top->spr_over_provisioning.u.i = __cpu_to_le64(fio_double_to_uint64(o->spr_over_provisioning.u.f));
+	top->spr_cache_size = __cpu_to_le64(o->spr_cache_size);
 	top->bs_unaligned = cpu_to_le32(o->bs_unaligned);
 	top->fsync_on_close = cpu_to_le32(o->fsync_on_close);
 	top->bs_is_seq_rand = cpu_to_le32(o->bs_is_seq_rand);
fio.1 +18 -0
index 014916ea..bc3efa5f 100644
@@ -1469,6 +1469,24 @@ For large devices it is better to use more regions, to increase precision
 and reduce memory allocation. The allocation is proportional to the region size.
 .RE
 .TP
+.B spr_cs=int
+See
+.BR sprandom .
+Define a cache size in bytes, as specified by the SSD manufacturer.
+.P
+.RS
+When this is non-zero, delay invalidating writes by one region in order
+to make sure that all original writes from a region are flushed from
+cache before the later invalidating writes are sent to the device.
+This deferral prevents the original write and the later invalidating
+write from being present in the device's cache at the same time which
+would allow the device to ignore the original write and prevent
+sprandom from achieving its target validity fractions. The actual
+cache size is used to ensure that the number of regions is not set
+so large that the size of a region is smaller than the device cache.
+The default is 0.
+.RE
+.TP
 .B spr_op=float
 See
 .BR sprandom .
options.c +13 -0
index 68189be7..f592bc24 100644
@@ -2710,6 +2710,19 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
 		.category = FIO_OPT_C_IO,
 		.group	= FIO_OPT_G_RANDOM,
 	},
+	{
+		.name	= "spr_cs",
+		.lname	= "SPRandom Device cache size",
+		.type	= FIO_OPT_ULL,
+		.off1	= offsetof(struct thread_options, spr_cache_size),
+		.help	= "Cache Size in bytes for SPRandom",
+		.parent	= "sprandom",
+		.maxlen = 1,
+		.hide	= 1,
+		.def    = "0",
+		.category = FIO_OPT_C_IO,
+		.group	= FIO_OPT_G_RANDOM,
+	},
 	{
 		.name	= "random_generator",
 		.lname	= "Random Generator",
server.h +1 -1
index a1e71a44..e0a921b8 100644
@@ -51,7 +51,7 @@ struct fio_net_cmd_reply {
 };
 
 enum {
-	FIO_SERVER_VER			= 117,
+	FIO_SERVER_VER			= 118,
 
 	FIO_SERVER_MAX_FRAGMENT_PDU	= 1024,
 	FIO_SERVER_MAX_CMD_MB		= 2048,
sprandom.c +65 -12

136 lines not on this page · raw message

sprandom.h +1 -0
index 175df8f5..d50c5afb 100644
@@ -31,6 +31,7 @@
 struct sprandom_info {
 	double    over_provisioning;
 	uint64_t  region_sz;
+	uint64_t  cache_sz;
 	uint32_t  num_regions;
 
 	uint32_t  *invalid_pct;
t/sprandom.py +40 -1

86 lines not on this page · raw message

thread_options.h +2 -0
index 4a52f981..3e66d477 100644
@@ -180,6 +180,7 @@ struct thread_options {
 	unsigned int softrandommap;
 	unsigned int sprandom;
 	unsigned int spr_num_regions;
+	unsigned long long spr_cache_size;
 	fio_fp64_t spr_over_provisioning;
 	unsigned int bs_unaligned;
 	unsigned int fsync_on_close;
@@ -517,6 +518,7 @@ struct thread_options_pack {
 	uint32_t softrandommap;
 	uint32_t sprandom;
 	uint32_t spr_num_regions;
+	uint64_t spr_cache_size;
 	fio_fp64_t spr_over_provisioning;
 	uint32_t bs_unaligned;
 	uint32_t fsync_on_close;