Re: [PATCH bpf-next v2 1/2] bpftool: Add recursive map dumping

From: bot+bpf-ci

Date: Sun Sep 06 2026 - 13:03:13 EST


> diff --git a/tools/bpf/bpftool/Documentation/bpftool-map.rst b/tools/bpf/bpftool/Documentation/bpftool-map.rst
> index 5daf3de5c744..38d1f542bf5a 100644
> --- a/tools/bpf/bpftool/Documentation/bpftool-map.rst
> +++ b/tools/bpf/bpftool/Documentation/bpftool-map.rst

[ ... ]

> @@ -170,6 +170,25 @@ OPTIONS
> Do not automatically attempt to mount any virtual file system (such as
> tracefs or BPF virtual file system) when necessary.
>
> +-r, --recursive
> + Also dump the inner maps referenced by **array_of_maps** and **hash_of_maps**
> + entries when running **map dump**. Each map ID is visited once, even if
> + several entries refer to it. Selected maps are followed by their inner maps.
> +
> + Plain output includes a header identifying each map. On success, JSON output
> + is always an array of map objects, each containing an **id** and an
> + **elements** array, including when only one map is dumped. Outer map entries
> + retain their **inner_map_id** field, which identifies the corresponding inner
> + map object.
> +
> + Inner map IDs are resolved when the maps are visited. The dump is not an
> + atomic snapshot: concurrent updates can change map contents or remove a
> + referenced inner map before it is visited. Failure to open a referenced
> + inner map stops the dump and returns a nonzero exit status. Output may
> + contain maps or entries printed before the error.
> + In JSON mode, an error during traversal is included in the output and the
> + enclosing arrays and objects are closed.

This isn't a bug, but would it be worth reflowing this option block
to 80 columns? Two lines run to 81 columns (the "Also dump the inner
maps referenced by" line and the "retain their **inner_map_id** field"
line), making them the only prose lines over 80 columns in the file.

Also, should there be a blank line before "In JSON mode, ..." if it's
meant to be its own paragraph? It currently starts on a fresh line
after a short 53-column line, so it renders as a continuation of the
same paragraph rather than separated like the other paragraphs in this
block.

[ ... ]

> diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
> index 5ababd8f7d0a..33f4c7172583 100644
> --- a/tools/bpf/bpftool/main.c
> +++ b/tools/bpf/bpftool/main.c
> @@ -26,6 +26,7 @@ static int (*last_do_help)(int argc, char **argv);
> json_writer_t *json_wtr;
> bool pretty_output;
> bool json_output;
> +bool recursive;
> bool show_pinned;
> bool block_mount;
> bool verifier_logs;

This isn't a bug, but would a name like recursive_dump or dump_recursive
read better here? It's a program-wide global exported in main.h, and the
neighbouring flags all carry a qualifier that says what they apply to:
json_output, pretty_output, show_pinned, relaxed_maps, verifier_logs.
Note that --json and --pretty didn't become json or pretty for the same
reason.

[ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/34044964295