summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Kirsch <zack.kirsch@isilon.com>2009-04-01 17:46:40 -0700
committerTim Prouty <tprouty@samba.org>2009-04-01 20:59:52 -0700
commit108cf27bb1fe0e602d00a8cc0b54c1d72a1630c8 (patch)
treecc2c856984ed9b062adae833d100677173818feb
parent9d95f8704d4dab70d50290ebd1e3c0b8800261a7 (diff)
downloadsamba-108cf27bb1fe0e602d00a8cc0b54c1d72a1630c8.tar.gz
samba-108cf27bb1fe0e602d00a8cc0b54c1d72a1630c8.tar.bz2
samba-108cf27bb1fe0e602d00a8cc0b54c1d72a1630c8.zip
s4 torture: Addition to RAW-BENCH-LOCK to take a configurable number of locks before starting the test
This can be useful for benchmarking as well as stress testing.
-rw-r--r--source4/torture/raw/lockbench.c20
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;
}