Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
b=19415
[fs/lustre-release.git]
/
lustre
/
tests
/
multiop.c
diff --git
a/lustre/tests/multiop.c
b/lustre/tests/multiop.c
index
a8de99b
..
e8868be
100755
(executable)
--- a/
lustre/tests/multiop.c
+++ b/
lustre/tests/multiop.c
@@
-45,11
+45,13
@@
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/vfs.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/vfs.h>
+#include <sys/time.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <semaphore.h>
#include <lustre/liblustreapi.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <semaphore.h>
#include <lustre/liblustreapi.h>
+#include <time.h>
#define T1 "write data before unlink\n"
#define T2 "write data after unlink\n"
#define T1 "write data before unlink\n"
#define T2 "write data after unlink\n"
@@
-58,10
+60,12
@@
char *buf, *buf_align;
int bufsize = 0;
sem_t sem;
#define ALIGN 65535
int bufsize = 0;
sem_t sem;
#define ALIGN 65535
+#define MAX_SHIFT 4096
char usage[] =
"Usage: %s filename command-sequence\n"
" command-sequence items:\n"
char usage[] =
"Usage: %s filename command-sequence\n"
" command-sequence items:\n"
+" b[num] write optional length from random in-memory offset\n"
" c close\n"
" C[num] create with optional stripes\n"
" d mkdir\n"
" c close\n"
" C[num] create with optional stripes\n"
" d mkdir\n"
@@
-204,6
+208,8
@@
int main(int argc, char **argv)
/* use sigaction instead of signal to avoid SA_ONESHOT semantics */
sigaction(SIGUSR1, &(const struct sigaction){.sa_handler = &usr1_handler},
NULL);
/* use sigaction instead of signal to avoid SA_ONESHOT semantics */
sigaction(SIGUSR1, &(const struct sigaction){.sa_handler = &usr1_handler},
NULL);
+ srandom(time(NULL));
+
fname = argv[1];
for (commands = argv[2]; *commands; commands++) {
fname = argv[1];
for (commands = argv[2]; *commands; commands++) {
@@
-407,12
+413,15
@@
int main(int argc, char **argv)
case 'v':
verbose = 1;
break;
case 'v':
verbose = 1;
break;
+ case 'b':
case 'w':
len = atoi(commands+1);
if (len <= 0)
len = 1;
if (bufsize < len) {
case 'w':
len = atoi(commands+1);
if (len <= 0)
len = 1;
if (bufsize < len) {
- buf = realloc(buf, len + ALIGN);
+ int shift = (*commands == 'b') ?
+ (random() % MAX_SHIFT) : 0;
+ buf = realloc(buf, len + ALIGN + shift);
if (buf == NULL) {
save_errno = errno;
perror("allocating buf for write\n");
if (buf == NULL) {
save_errno = errno;
perror("allocating buf for write\n");
@@
-420,7
+429,7
@@
int main(int argc, char **argv)
}
bufsize = len;
buf_align = (char *)((long)(buf + ALIGN) &
}
bufsize = len;
buf_align = (char *)((long)(buf + ALIGN) &
- ~ALIGN);
+ ~ALIGN)
+ shift
;
strncpy(buf_align, msg, bufsize);
}
while (len > 0) {
strncpy(buf_align, msg, bufsize);
}
while (len > 0) {