diff options
author | Jeremy Allison <jra@samba.org> | 2009-04-09 22:46:59 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-04-09 22:46:59 -0700 |
commit | 7f10bf980edef3ace1522d0c9c082b35e225c950 (patch) | |
tree | d4e9af21de194cca812e754b28f9358a3651f4ce /source4/torture/raw/lockbench.c | |
parent | f8f68703da58cf7f61b655b48bbbc45cda647748 (diff) | |
parent | f930f504e1d5e78d2f6f36cab9ce36dbeb34e955 (diff) | |
download | samba-7f10bf980edef3ace1522d0c9c082b35e225c950.tar.gz samba-7f10bf980edef3ace1522d0c9c082b35e225c950.tar.bz2 samba-7f10bf980edef3ace1522d0c9c082b35e225c950.zip |
Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
Diffstat (limited to 'source4/torture/raw/lockbench.c')
-rw-r--r-- | source4/torture/raw/lockbench.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d20175a018..c7f99aeb3c 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -317,13 +317,15 @@ bool torture_bench_lock(struct torture_context *torture) { bool ret = true; TALLOC_CTX *mem_ctx = talloc_new(torture); - int i; + int i, j; int timelimit = torture_setting_int(torture, "timelimit", 10); struct timeval tv; struct benchlock_state *state; int total = 0, minops=0; struct smbcli_state *cli; bool progress; + off_t offset; + int initial_locks = torture_setting_int(torture, "initial_locks", 0); progress = torture_setting_bool(torture, "progress", true); @@ -371,6 +373,21 @@ bool torture_bench_lock(struct torture_context *torture) goto failed; } + /* Optionally, lock initial_locks for each proc beforehand. */ + if (i == 0 && initial_locks > 0) { + printf("Initializing %d locks on each proc.\n", + initial_locks); + } + + for (j = 0; j < initial_locks; j++) { + offset = (0xFFFFFED8LLU * (i+2)) + j; + if (!NT_STATUS_IS_OK(smbcli_lock64(state[i].tree, + state[i].fnum, offset, 1, 0, WRITE_LOCK))) { + printf("Failed initializing, lock=%d\n", j); + goto failed; + } + } + state[i].stage = LOCK_INITIAL; lock_send(&state[i]); } @@ -413,6 +430,7 @@ bool torture_bench_lock(struct torture_context *torture) return ret; failed: + smbcli_deltree(state[0].tree, BASEDIR); talloc_free(mem_ctx); return false; } |