[PATCH 20/20] Add btree verification

Valerie Aurora val at versity.com
Tue Jun 24 08:45:26 PDT 2025


On Thu, Jun 19, 2025 at 12:36 AM Zach Brown <zab at zabbo.net> wrote:
>
> On Thu, Jun 12, 2025 at 10:11:12PM +0200, Valerie Aurora wrote:
> > Add super janky btree verification functions and associated debugfs
> > commands. They caught a couple of bugs in replace_item().
>
> > +static void print_key(int print, struct ngnfs_btree_key *key)
> > +{
> > +     verify_printf(print, "[%020llu %020llu %020llu]",
> > +                   le64_to_cpu(key->k[0]), le64_to_cpu(key->k[1]), le64_to_cpu(key->k[2]));
> > +}
>
> > +     verify_printf(print, "bt->first:\t");
> > +     print_key(print, &bt->first);
> > +     verify_printf(print, "\nbt->last:\t");
> > +     print_key(print, &bt->last);
> > +     verify_printf(print, "\n\n");
>
> FWIW, I would have done this with _FMT/_ARG macros.  So something like:
>
> #define K_FMT      "[%020llu %020llu %020llu]"
> #define K_ARGS(k)  le64_to_cpu((k)->k[0]), le64_to_cpu((k)->k[1]), le64_to_cpu((k)->k[2])
>
>         verify_printf(print, "bt->first:\t"K_FMT"\nbt->last:\t"K_FMT"\n\n",
>                 K_ARGS(&bt->first), K_ARGS(&bt->last));

Ah, perfect, I hated my solution. I will put this in my next patch set!

Valerie



More information about the ngnfs-devel mailing list