Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Apr 11, 2017 Kbuild

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit e5a415c889251928dd256738a8022f1eab91c73b:

Fix num2str() output when maxlen <= strlen(tmp) (2017-04-08 11:04:21 -0600)

are available in the git repository at:

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

for you to fetch changes up to b94d4d75a2e474561dcda8ee852cd5e67dde884e:

Merge branch 'pull-2' of https://github.com/dmonakhov/fio (2017-04-10 11:41:09 -0600)

----------------------------------------------------------------
Dmitry Monakhov (2):
engine: e4defrag fix error reporting
engine: add ftruncate ioengine

Jens Axboe (1):
Merge branch 'pull-2' of https://github.com/dmonakhov/fio

Sitsofe Wheeler (1):
doc: add ftruncate engine documentation and example jobfile

 HOWTO                  |  5 +++++
 Makefile               |  1 +
 engines/e4defrag.c     |  9 ++++++--
 engines/ftruncate.c    | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++
 examples/ftruncate.fio | 27 ++++++++++++++++++++++++
 5 files changed, 96 insertions(+), 2 deletions(-)
 create mode 100644 engines/ftruncate.c
 create mode 100644 examples/ftruncate.fio

---

Diff of recent changes:

HOWTO +5 -0
index 80b9e75..ffdcb75 100644
@@ -1675,6 +1675,11 @@ I/O engine
 			DDIR_TRIM
 				does fallocate(,mode = FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE).
 
+		**ftruncate**
+			I/O engine that sends :manpage:`ftruncate(2)` operations in response
+			to write (DDIR_WRITE) events. Each ftruncate issued sets the file's
+			size to the current block offset. Block size is ignored.
+
 		**e4defrag**
 			I/O engine that does regular EXT4_IOC_MOVE_EXT ioctls to simulate
 			defragment activity in request to DDIR_WRITE event.
Makefile +1 -0
index 37150c6..66083ff 100644
@@ -42,6 +42,7 @@ SOURCE :=	$(patsubst $(SRCDIR)/%,%,$(wildcard $(SRCDIR)/crc/*.c)) \
 		eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
 		smalloc.c filehash.c profile.c debug.c engines/cpu.c \
 		engines/mmap.c engines/sync.c engines/null.c engines/net.c \
+		engines/ftruncate.c \
 		server.c client.c iolog.c backend.c libfio.c flow.c cconv.c \
 		gettime-thread.c helpers.c json.c idletime.c td_error.c \
 		profiles/tiobench.c profiles/act.c io_u_queue.c filelock.c \
engines/e4defrag.c +7 -2
index 1e4996f..4b44488 100644
@@ -172,8 +172,13 @@ static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u)
 		len = io_u->xfer_buflen;
 
 	if (len != io_u->xfer_buflen) {
-		io_u->resid = io_u->xfer_buflen - len;
-		io_u->error = 0;
+		if (len) {
+			io_u->resid = io_u->xfer_buflen - len;
+			io_u->error = 0;
+		} else {
+			/* access beyond i_size */
+			io_u->error = EINVAL;
+		}
 	}
 	if (ret)
 		io_u->error = errno;
engines/ftruncate.c new file +56 -0

56 lines not on this page · raw message

examples/ftruncate.fio new file +27 -0
new file mode 100644
index 0000000..a6ef457
@@ -0,0 +1,27 @@
+# Example ftruncate engine jobs
+
+[global]
+ioengine=ftruncate
+directory=/scratch
+size=102404k ; 100Mb+4k
+stonewall
+filename=truncate
+runtime=10s
+time_based
+direct=1
+#
+# bs option is stub here. Truncation is performed on the current block offset.
+# blocksize value is ignored
+bs=4k
+
+# truncate the file to 4Kbytes then repeatedly grow the file back to just over
+# its original size using subsequent truncates
+[grow-truncate]
+rw=write
+
+# Repeatedly change a file to a random size between 0Kbytes and 100Mb
+# using truncates
+[rand-truncate]
+rw=randwrite
+norandommap
+