[Cluster-devel] [PATCH dlm-tool] dlm_tool: handle dynamic length lockspace dump
Alexander Aring
aahringo at redhat.com
Wed Mar 9 15:17:39 UTC 2022
Hi,
On Tue, Mar 8, 2022 at 3:21 PM Alexander Aring <aahringo at redhat.com> wrote:
...
> +++ b/dlm_controld/main.c
> @@ -1070,7 +1070,7 @@ static void query_node_info(int fd, char *name, int nodeid)
> (char *)&node, sizeof(node));
> }
>
> -static void query_lockspaces(int fd, int max)
> +static void query_lockspaces(int fd)
> {
> int ls_count = 0;
> struct dlmc_lockspace *lss = NULL;
> @@ -1083,12 +1083,7 @@ static void query_lockspaces(int fd, int max)
> goto out;
> }
>
> - if (ls_count > max) {
> - result = -E2BIG;
> - ls_count = max;
> - } else {
> - result = ls_count;
> - }
> + result = ls_count;
> out:
> do_reply(fd, DLMC_CMD_LOCKSPACES, NULL, result, 0,
> (char *)lss, ls_count * sizeof(struct dlmc_lockspace));
> @@ -1375,7 +1370,7 @@ static void *process_queries(void *arg)
> query_node_info(f, h.name, h.data);
> break;
> case DLMC_CMD_LOCKSPACES:
> - query_lockspaces(f, h.data);
> + query_lockspaces(f);
> break;
> case DLMC_CMD_LOCKSPACE_NODES:
> query_lockspace_nodes(f, h.name, h.option, h.data);
> diff --git a/dlm_tool/main.c b/dlm_tool/main.c
> index 04ff40f8..f4e69649 100644
> --- a/dlm_tool/main.c
> +++ b/dlm_tool/main.c
> @@ -67,7 +67,6 @@ static int summarize;
> char run_command[DLMC_RUN_COMMAND_LEN];
> char run_uuid[DLMC_RUN_UUID_LEN];
>
> -#define MAX_LS 128
> #define MAX_NODES 128
>
> /* from linux/fs/dlm/dlm_internal.h */
> @@ -91,7 +90,7 @@ char run_uuid[DLMC_RUN_UUID_LEN];
> #define DLM_MSG_PURGE 14
>
>
> -struct dlmc_lockspace lss[MAX_LS];
> +struct dlmc_lockspace *lss;
there should be no need anymore to handle this globally, we should be
able to move this pointer into the function. I will fix that as soon
as I apply this patch.
- Alex
More information about the Cluster-devel
mailing list