From 52102eae4df5f2a35e75f7bb1aad0677c53d2113 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Mon, 9 Apr 2012 11:43:29 -0500 Subject: dlm_load: use QUECVT add QUECVT command and random load option Signed-off-by: David Teigland --- dlm/dlm_load.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/dlm/dlm_load.c b/dlm/dlm_load.c index 07a9f57..3b967ef 100644 --- a/dlm/dlm_load.c +++ b/dlm/dlm_load.c @@ -465,7 +465,7 @@ static int do_request(int num, int mode, int noqueue) return rv; } -static int do_convert(int num, int mode, int noqueue) +static int do_convert(int num, int mode, int noqueue, int quecvt) { struct lk *lk; char name[DLM_RESNAME_MAXLEN]; @@ -481,11 +481,14 @@ static int do_convert(int num, int mode, int noqueue) if (noqueue) flags |= LKF_NOQUEUE; + if (quecvt) + flags |= LKF_QUECVT; memset(name, 0, sizeof(name)); snprintf(name, sizeof(name), "test%d", (num % maxr)); - log_pre("lk %03u convert mode %d noqueue %d", num, mode, noqueue); + log_pre("lk %03u convert mode %d %x noqueue %d quecvt %d", + num, mode, flags, noqueue, quecvt); rv = dlm_ls_lockx(dh, mode, &lk->lksb, flags, name, strlen(name), 0, astfn, (void *)lk, bastfn, &our_xid, timeout_arg); @@ -607,7 +610,7 @@ static void rand_loop(int iter) { struct lk *lk; uint32_t n = 0; - int num, noqueue, rqmode, rv; + int num, noqueue, quecvt, rqmode, rv; while (1) { dlm_dispatch(libdlm_fd); @@ -622,6 +625,7 @@ static void rand_loop(int iter) num = rand_int(0, maxn - 1); noqueue = rand_int(0, 1); rqmode = rand_int(0, LKM_EXMODE); + quecvt = 0; lk = get_lock(num); if (!lk) @@ -634,7 +638,7 @@ static void rand_loop(int iter) if (lk->locked_stable && lk->bast) { if (rand_int(0, 1)) { - rv = do_convert(num, LKM_NLMODE, 0); + rv = do_convert(num, LKM_NLMODE, 0, 0); } else { rv = do_unlock(num); } @@ -642,8 +646,11 @@ static void rand_loop(int iter) } if (lk->locked_stable) { + if (rqmode > lk->grmode) + quecvt = rand_int(0, 1); + if (rand_int(0, 1)) { - rv = do_convert(num, rqmode, noqueue); + rv = do_convert(num, rqmode, noqueue, quecvt); } else { rv = do_unlock(num); } @@ -715,6 +722,7 @@ static void print_help(void) printf("ls [lk] - list one or all locks\n"); printf("lock lk mode noqueue\n"); printf("convert lk mode noqueue\n"); + printf("quecvt lk mode\n"); printf("unlock lk\n"); printf("cancel lk\n"); } @@ -751,7 +759,11 @@ static void user_cmd(int *quit) } else if (!strcmp(cmd, "convert")) { - do_convert(num, x, y); + do_convert(num, x, y, 0); + } + + else if (!strcmp(cmd, "quecvt")) { + do_convert(num, x, y, 1); } else if (!strcmp(cmd, "unlock")) { -- cgit