From 1ef4ea3462e15a7ab26c39b0d532dad2a0745931 Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Fri, 14 Feb 2025 12:14:22 +0100 Subject: [PATCH] LU-18680 ptlrpc: Improve yaml output for nodemap offset Nodemap offset presents loose values on lctl get_param: $ lctl get_param -n nodemap.t0.offset start_uid: 100000 limit_uid: 200000 start_gid: 100000 limit_gid: 200000 start_projid: 100000 limit_projid: 200000 This is technically valid YAML syntax, but not contextually bound as a unit or to its key "offset". In the future, we want to save/restore entire nodemap configurations. This means that the key "offset" is necessary to relate the values to. This can be done via indenting or more explicitly with {}, as done in this patch to be consistent with other nodemap properties like ranges or idmap and to not necessarily rely on indentation: $ lctl get_param -n nodemap.t0.offset { start_uid: 100000, limit_uid: 200000, start_gid: 100000, limit_gid: 200000, start_projid: 100000, limit_projid: 200000 } Note, offsets are always shown even for zero, thus {} is not shown when no offsets are defined. Test-Parameters: trivial testlist=sanity-sec env=ONLY=27ab Signed-off-by: Marc Vef Change-Id: I9b9a5411c3adcd39d45f29c8fc1d8c51163ba9b5 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58085 Reviewed-by: Sebastien Buisson Reviewed-by: Aurelien Degremont Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lustre/ptlrpc/nodemap_lproc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lustre/ptlrpc/nodemap_lproc.c b/lustre/ptlrpc/nodemap_lproc.c index 4f5aeb8..c705277 100644 --- a/lustre/ptlrpc/nodemap_lproc.c +++ b/lustre/ptlrpc/nodemap_lproc.c @@ -125,12 +125,16 @@ static int nodemap_offset_seq_show(struct seq_file *m, void *data) return rc; } - seq_printf(m, "start_uid: %u\n", nodemap->nm_offset_start_uid); - seq_printf(m, "limit_uid: %u\n", nodemap->nm_offset_limit_uid); - seq_printf(m, "start_gid: %u\n", nodemap->nm_offset_start_gid); - seq_printf(m, "limit_gid: %u\n", nodemap->nm_offset_limit_gid); - seq_printf(m, "start_projid: %u\n", nodemap->nm_offset_start_projid); - seq_printf(m, "limit_projid: %u\n", nodemap->nm_offset_limit_projid); + seq_puts(m, "{\n"); + + seq_printf(m, " start_uid: %u,\n", nodemap->nm_offset_start_uid); + seq_printf(m, " limit_uid: %u,\n", nodemap->nm_offset_limit_uid); + seq_printf(m, " start_gid: %u,\n", nodemap->nm_offset_start_gid); + seq_printf(m, " limit_gid: %u,\n", nodemap->nm_offset_limit_gid); + seq_printf(m, " start_projid: %u,\n", nodemap->nm_offset_start_projid); + seq_printf(m, " limit_projid: %u\n", nodemap->nm_offset_limit_projid); + + seq_puts(m, "}\n"); nodemap_putref(nodemap); return 0; -- 1.8.3.1