summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2017-07-31 08:59:56 -0700
committerChris Mason <clm@fb.com>2017-07-31 08:59:56 -0700
commit3479f8ced8621705ac5ac7590f66eaab91239421 (patch)
tree85ab5b18a45655d5b46cb0d6dc437f5551809181
parent2551ba214eeaf2f5d8953d0f96fd0b0ac8f076ea (diff)
downloadsimoop-3479f8ced8621705ac5ac7590f66eaab91239421.tar.gz
Add some random unlinks into the mix
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--simoop.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/simoop.c b/simoop.c
index c984168..d305795 100644
--- a/simoop.c
+++ b/simoop.c
@@ -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);
}