summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2017-08-09 06:16:48 -0700
committerChris Mason <clm@fb.com>2017-08-09 06:16:48 -0700
commit598cd23d74b9c31939c520ba80a6b418b5143e1e (patch)
treebf9d58f0ab8a5452d2910d2a28af940d6985afb5
parentc585b5e0a9a3ac5403484dc80827a6c1c52333f7 (diff)
downloadsimoop-598cd23d74b9c31939c520ba80a6b418b5143e1e.tar.gz
Tweak writeback a little to create more inodes and pressure the allocator
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--simoop.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/simoop.c b/simoop.c
index 9536dc8..1bb0c67 100644
--- a/simoop.c
+++ b/simoop.c
@@ -1333,6 +1333,15 @@ static void write_to_file(char *path, int seq, char *buf)
}
} else {
postfix = RESULT_FILE;
+ join_path(name, path, seq, postfix);
+ /* make sure that we're making new inodes for the result
+ * files
+ */
+ ret = unlink(name);
+ if (ret < 0 && errno != ENOENT) {
+ perror("unlink");
+ exit(1);
+ }
fd = open_path(path, seq, RESULT_FILE, 0);
offset = 0;
}
@@ -1358,7 +1367,16 @@ static void write_to_file(char *path, int seq, char *buf)
* lets create some churn of inodes coming in and out and abuse
* the orphan code while we're here
*/
- if (rand() % 5 == 0) {
+ if (rand() % 3 == 0) {
+ /*
+ * make sure the extents actually get allocated and work
+ * is done
+ */
+ ret = sync_file_range(fd, 0, 0, SYNC_FILE_RANGE_WRITE);
+ if (ret < 0) {
+ perror("sync_file_range");
+ exit(1);
+ }
ret = unlink(name);
if (ret < 0 && errno != ENOENT) {
perror("unlink");