]>
Commit | Line | Data |
---|---|---|
39236c6e A |
1 | #include <fcntl.h> |
2 | #include "perf_index.h" | |
3 | #include <errno.h> | |
4 | ||
5 | void stress_file_create(const char *fs_path, int thread_id, int num_threads, long long length) { | |
6 | long long i; | |
7 | int fd; | |
8 | char filepath[MAXPATHLEN]; | |
9 | for(i=0; i<length; i++) { | |
10 | snprintf(filepath, MAXPATHLEN, "%s/file_create-%d-%lld", fs_path, thread_id, i); | |
11 | fd = open(filepath, O_CREAT | O_EXCL | O_WRONLY, 0644); | |
12 | assert(fd>=0); | |
13 | close(fd); | |
14 | } | |
15 | for(i=0; i<length; i++) { | |
16 | snprintf(filepath, MAXPATHLEN, "%s/file_create-%d-%lld", fs_path, thread_id, i); | |
17 | assert(unlink(filepath)>=0); | |
18 | } | |
19 | } |