diff options
author | Chris Mason <clm@fb.com> | 2017-07-31 08:59:56 -0700 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2017-07-31 08:59:56 -0700 |
commit | 3479f8ced8621705ac5ac7590f66eaab91239421 (patch) | |
tree | 85ab5b18a45655d5b46cb0d6dc437f5551809181 | |
parent | 2551ba214eeaf2f5d8953d0f96fd0b0ac8f076ea (diff) | |
download | simoop-3479f8ced8621705ac5ac7590f66eaab91239421.tar.gz |
Add some random unlinks into the mix
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | simoop.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1299,6 +1299,7 @@ static void write_to_file(char *path, int seq, char *buf) { int fd; int i; + int ret; int write_bytes = randomize_size(write_size); loff_t offset; void *xxhash_state = XXH32_init(global_rand_seed); @@ -1335,6 +1336,18 @@ static void write_to_file(char *path, int seq, char *buf) /* delete some files */ ftruncate(fd, 0); } + + /* + * lets create some churn of inodes coming in and out and abuse + * the orphan code while we're here + */ + if (rand() % 5 == 0) { + ret = unlink(name); + if (ret < 0 && errno != ENOENT) { + perror("unlink"); + exit(1); + } + } close(fd); } |