diff --git a/tests/zfs-tests/cmd/mmapwrite.c b/tests/zfs-tests/cmd/mmapwrite.c index a18609898485..0a57daff5eae 100644 --- a/tests/zfs-tests/cmd/mmapwrite.c +++ b/tests/zfs-tests/cmd/mmapwrite.c @@ -52,6 +52,7 @@ */ #define NORMAL_WRITE_TH_NUM 2 +#define MAX_WRITE_BYTES 262144000 static void * normal_writer(void *filename) @@ -67,18 +68,21 @@ normal_writer(void *filename) } char buf = 'z'; - while (1) { + off_t bytes_written = 0; + + while (bytes_written < MAX_WRITE_BYTES) { write_num = write(fd, &buf, 1); if (write_num == 0) { err(1, "write failed!"); break; } - if (lseek(fd, page_size, SEEK_CUR) == -1) { + if ((bytes_written = lseek(fd, page_size, SEEK_CUR)) == -1) { err(1, "lseek failed on %s: %s", file_path, strerror(errno)); break; } } + return (NULL); } static void *