public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: David Teigland <teigland@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: master - dlm_controld: queries in libgroup mode Date: Mon, 11 Aug 2008 07:36:00 -0000 [thread overview] Message-ID: <20080808215553.7F10312003F@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4effc0bac4b5a0f627d57c974a2a936faa90eece Commit: 4effc0bac4b5a0f627d57c974a2a936faa90eece Parent: 3b1db64b020d50d9bc76b21e14aef52125613914 Author: David Teigland <teigland@redhat.com> AuthorDate: Fri Aug 8 15:40:35 2008 -0500 Committer: David Teigland <teigland@redhat.com> CommitterDate: Fri Aug 8 16:47:58 2008 -0500 dlm_controld: queries in libgroup mode Most of the query info doesn't apply when running in LIBGROUP mode, but some of the basic info can be provided. Signed-off-by: David Teigland <teigland@redhat.com> --- dlm/libdlmcontrol/libdlmcontrol.h | 1 + group/dlm_controld/dlm_daemon.h | 5 +++ group/dlm_controld/group.c | 64 +++++++++++++++++++++++++++++++++++- group/dlm_controld/main.c | 3 ++ 4 files changed, 71 insertions(+), 2 deletions(-) diff --git a/dlm/libdlmcontrol/libdlmcontrol.h b/dlm/libdlmcontrol/libdlmcontrol.h index 83ddf6f..9c95c5e 100644 --- a/dlm/libdlmcontrol/libdlmcontrol.h +++ b/dlm/libdlmcontrol/libdlmcontrol.h @@ -38,6 +38,7 @@ struct dlmc_change { #define DLMC_LF_SAVE_PLOCKS 0x00000020 struct dlmc_lockspace { + int group_mode; struct dlmc_change cg_prev; /* completed change (started_change) */ struct dlmc_change cg_next; /* in-progress change (changes list) */ uint32_t flags; diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h index 22e82b1..1af4256 100644 --- a/group/dlm_controld/dlm_daemon.h +++ b/group/dlm_controld/dlm_daemon.h @@ -186,6 +186,11 @@ struct lockspace { struct timeval drop_resources_last; uint64_t plock_ckpt_handle; + /* save copy of groupd member callback data for queries */ + + int cb_member_count; + int cb_members[MAX_NODES]; + /* deadlock stuff */ int deadlk_low_nodeid; diff --git a/group/dlm_controld/group.c b/group/dlm_controld/group.c index acedd08..cd2743b 100644 --- a/group/dlm_controld/group.c +++ b/group/dlm_controld/group.c @@ -117,6 +117,7 @@ void process_groupd(int ci) switch (cb_action) { case DO_STOP: log_debug("groupd callback: stop %s", cb_name); + ls->kernel_stopped = 1; /* for queries */ set_sysfs_control(cb_name, 0); group_stop_done(gh, cb_name); break; @@ -125,12 +126,17 @@ void process_groupd(int ci) log_debug("groupd callback: start %s count %d members %s", cb_name, cb_member_count, str_members()); + /* save in ls for queries */ + ls->cb_member_count = cb_member_count; + memcpy(ls->cb_members, cb_members, sizeof(cb_members)); + set_configfs_members(cb_name, cb_member_count, cb_members, 0, NULL); /* this causes the dlm to do a "start" using the members we just set */ + ls->kernel_stopped = 0; set_sysfs_control(cb_name, 1); /* the dlm doesn't need/use a "finish" stage following @@ -234,29 +240,83 @@ void close_groupd(void) group_exit(gh); } -/* FIXME: most of the query info doesn't apply in the LIBGROUP mode, - but we can emulate some basic parts of it */ +/* most of the query info doesn't apply in the LIBGROUP mode, but we can + emulate some basic parts of it */ int set_lockspace_info_group(struct lockspace *ls, struct dlmc_lockspace *lockspace) { + strncpy(lockspace->name, ls->name, DLM_LOCKSPACE_LEN); + lockspace->global_id = ls->global_id; + + if (ls->joining) + lockspace->flags |= DLMC_LF_JOINING; + if (ls->leaving) + lockspace->flags |= DLMC_LF_LEAVING; + if (ls->kernel_stopped) + lockspace->flags |= DLMC_LF_KERNEL_STOPPED; + + lockspace->cg_prev.member_count = ls->cb_member_count; + + /* we could save the previous cb_members and calculate + joined_count and remove_count */ + return 0; } int set_node_info_group(struct lockspace *ls, int nodeid, struct dlmc_node *node) { + node->nodeid = nodeid; + node->flags = DLMC_NF_MEMBER; return 0; } int set_lockspaces_group(int *count, struct dlmc_lockspace **lss_out) { + struct lockspace *ls; + struct dlmc_lockspace *lss, *lsp; + int ls_count = 0; + + list_for_each_entry(ls, &lockspaces, list) + ls_count++; + + lss = malloc(ls_count * sizeof(struct dlmc_lockspace)); + if (!lss) + return -ENOMEM; + memset(lss, 0, ls_count * sizeof(struct dlmc_lockspace)); + + lsp = lss; + list_for_each_entry(ls, &lockspaces, list) { + set_lockspace_info(ls, lsp++); + } + + *count = ls_count; + *lss_out = lss; return 0; } int set_lockspace_nodes_group(struct lockspace *ls, int option, int *node_count, struct dlmc_node **nodes_out) { + struct dlmc_node *nodes = NULL, *nodep; + int i; + + if (!ls->cb_member_count) + goto out; + + nodes = malloc(ls->cb_member_count * sizeof(struct dlmc_node)); + if (!nodes) + return -ENOMEM; + memset(nodes, 0, sizeof(*nodes)); + + nodep = nodes; + for (i = 0; i < cb_member_count; i++) { + set_node_info_group(ls, ls->cb_members[i], nodep++); + } + out: + *node_count = ls->cb_member_count; + *nodes_out = nodes; return 0; } diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c index 6b866c2..c9a2f56 100644 --- a/group/dlm_controld/main.c +++ b/group/dlm_controld/main.c @@ -499,6 +499,9 @@ static void query_lockspace_info(int fd, char *name) goto out; } + memset(&lockspace, 0, sizeof(lockspace)); + lockspace.group_mode = group_mode; + if (group_mode == GROUP_LIBGROUP) rv = set_lockspace_info_group(ls, &lockspace); else
reply other threads:[~2008-08-08 21:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080808215553.7F10312003F@lists.fedorahosted.org \ --to=teigland@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).