Skip to contentSkip to conversation

pattern.c: Add support for files in buffer_pattern argument.

PATCH In review [email protected] 2 participants 4 messages Jun 8, 2017 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pattern.c: Add support for files in buffer_pattern argument.

From: Stephen Bates <[email protected]>

It is useful to be able to initialize the buffer contents using an input file (e.g. when testing certain pathological patterns for compression). Add support to the buffer_pattern input argument for reading data from a file via enclosing the filename in ``''``.

---
 HOWTO         | 19 +++++++++++------
 lib/pattern.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 6 deletions(-)
HOWTO +13 -6
index ea9466a..7959ad1 100644
@@ -1401,11 +1401,18 @@ Buffers and memory
 
 .. option:: buffer_pattern=str
 
-	If set, fio will fill the I/O buffers with this pattern. If not set, the
-	contents of I/O buffers is defined by the other options related to buffer
-	contents. The setting can be any pattern of bytes, and can be prefixed with
-	0x for hex values. It may also be a string, where the string must then be
-	wrapped with ``""``, e.g.::
+	If set, fio will fill the I/O buffers with this pattern or with the contents
+	of a file. If not set, the contents of I/O buffers are defined by the other
+	options related to buffer contents. The setting can be any pattern of bytes,
+	and can be prefixed with 0x for hex values. It may also be a string, where
+	the string must then be wrapped with ``""``. Or it may also be a filename,
+	where the filename must be wrapped with ``''`` in which case the file is
+	opened and read. Note that not all the file contents will be read if that
+	would cause the buffers to overflow. So, for example::
+
+		buffer_pattern='filename'
+
+	or::
 
 		buffer_pattern="abcd"
 
@@ -1419,7 +1426,7 @@ Buffers and memory
 
 	Also you can combine everything together in any order::
 
-		buffer_pattern=0xdeadface"abcd"-12
+		buffer_pattern=0xdeadface"abcd"-12'filename'
 
 .. option:: dedupe_percentage=int
 
lib/pattern.c +65 -0

83 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw
Quoted 6 lines · On 06/08/2017 05:46 AM, [email protected] wrote:

From: Stephen Bates <[email protected]>

It is useful to be able to initialize the buffer contents using an input file (e.g. when testing certain pathological patterns for compression). Add support to the buffer_pattern input argument for reading data from a file via enclosing the filename in ``''``.

Nifty! Thanks Stephen, I'll add this.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 9 lines · Jens Axboe
Quoted 6 lines · On 06/08/2017 05:46 AM, [email protected] wrote:

From: Stephen Bates <[email protected]>

It is useful to be able to initialize the buffer contents using an input file (e.g. when testing certain pathological patterns for compression). Add support to the buffer_pattern input argument for reading data from a file via enclosing the filename in ``''``.

Nifty! Thanks Stephen, I'll add this.

Could I trouble you for an update to the fio.1 man page as well?

Signature · 1 line
Jens Axboe
#3 lore raw
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

From: Stephen Bates <[email protected]>

It is useful to be able to initialize the buffer contents using an input file (e.g. when testing certain pathological patterns for compression). Add support to the buffer_pattern input argument for reading data from a file via enclosing the filename in ``''``.

Nifty! Thanks Stephen, I'll add this.

Superb

Quoted 2 lines

Could I trouble you for an update to the fio.1 man page as well?

Yes, I will send that shortly

BTW I am not sure my original email made the mailing list. I seem to be having issues with my new stmp provider and SPF records (sigh)…

Stephen