From: Jens Axboe Date: Wed, 18 Oct 2006 12:16:42 +0000 (+0200) Subject: [PATCH] Add support for unlinking io files X-Git-Tag: fio-1.7~26 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=f6cbb269c54ff40f3922818d42117f5a8026df36;hp=b2a151925a91f38aeb298d693687a47269ad4e94 [PATCH] Add support for unlinking io files Signed-off-by: Jens Axboe --- diff --git a/README b/README index d063df9f..2a245dce 100644 --- a/README +++ b/README @@ -115,6 +115,7 @@ The job file parameters are: bwavgtime=x Average bandwidth stats over an x msec window. create_serialize=x If 'x', serialize file creation. create_fsync=x If 'x', run fsync() after file creation. + unlink If set, unlink files when done. end_fsync=x If 'x', run fsync() after end-of-job. loops=x Run the job 'x' number of times. verify=x If 'x' == md5, use md5 for verifies. If 'x' == crc32, diff --git a/filesetup.c b/filesetup.c index e1afeb9a..04052bf3 100644 --- a/filesetup.c +++ b/filesetup.c @@ -364,6 +364,8 @@ void close_files(struct thread_data *td) struct fio_file *f = &td->files[i]; if (f->fd != -1) { + if (td->unlink && td->filetype == FIO_TYPE_FILE) + unlink(f->file_name); close(f->fd); f->fd = -1; } diff --git a/fio.h b/fio.h index 4be037e9..c778206b 100644 --- a/fio.h +++ b/fio.h @@ -189,6 +189,7 @@ struct thread_data { unsigned char sync_io; unsigned char verify; unsigned char use_thread; + unsigned char unlink; unsigned char do_disk_util; unsigned char override_sync; unsigned char rand_repeatable; diff --git a/init.c b/init.c index 20dd625d..91a1d507 100644 --- a/init.c +++ b/init.c @@ -47,6 +47,7 @@ #define DEF_RWMIX_READ (50) #define DEF_NICE (0) #define DEF_NR_FILES (1) +#define DEF_UNLINK (0) static int def_timeout = DEF_TIMEOUT; @@ -937,6 +938,11 @@ int parse_jobs_ini(char *file, int stonewall_flag) fgetpos(f, &off); continue; } + if (!check_strset(p, "unlink")) { + td->unlink = 1; + fgetpos(f, &off); + continue; + } if (!check_strstore(p, "iolog", tmpbuf)) { if (td->write_iolog) { log_err("fio: read iolog overrides given write_iolog\n"); @@ -1042,6 +1048,7 @@ static int fill_def_thread(void) def_thread.nice = DEF_NICE; def_thread.rand_repeatable = DEF_RAND_REPEAT; def_thread.nr_files = DEF_NR_FILES; + def_thread.unlink = DEF_UNLINK; #ifdef FIO_HAVE_DISK_UTIL def_thread.do_disk_util = 1; #endif