Page MenuHomeFreeBSD

Drop blk argument to meta functions
ClosedPublic

Authored by dougm on Aug 10 2017, 6:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 28 2024, 1:46 AM
Unknown Object (File)
Dec 22 2023, 7:32 PM
Unknown Object (File)
Dec 20 2023, 8:31 AM
Unknown Object (File)
Oct 15 2023, 12:17 AM
Unknown Object (File)
Sep 10 2023, 2:46 PM
Unknown Object (File)
Aug 28 2023, 9:36 AM
Unknown Object (File)
Aug 28 2023, 9:35 AM
Unknown Object (File)
Aug 28 2023, 9:34 AM
Subscribers
None

Details

Summary

The *_meta_* functions include a radix parameter, a blk parameter, and another parameter that identifies a starting point in the memory address block. Radix is a power of two, blk is a multiple of radix, and the starting point is in the range [blk, blk+radix), so that blk can always be computed from the other two. This change drops the blk parameter from the meta functions and computes it instead. It also makes the radix parameters unsigned to address concerns that the calculation of '-radix' might overflow, or have an unexpected bit representation on peculiar machines.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This change doesn't compile:

../../../kern/subr_blist.c:457:46: error: too few arguments to function call,
      expected 4, have 3
                return (blst_leaf_alloc(scan, cursor, count));
                        ~~~~~~~~~~~~~~~                    ^
../../../kern/subr_blist.c:358:1: note: 'blst_leaf_alloc' declared here
static daddr_t
^
1 error generated.

I suggest changing the "radix" field of struct blist to be unsigned as well.

Add missing argument, change struct member type.

This change reduces the text size by 7% on amd64.

Before:

# size subr_blist.o
  text   data   bss    dec     hex   filename
  3805     80     0   3885   0xf2d   subr_blist.o

After:

# size subr_blist.o
  text   data   bss    dec     hex   filename
  3532     80     0   3612   0xe1c   subr_blist.o
This revision is now accepted and ready to land.Aug 12 2017, 6:43 PM
This revision was automatically updated to reflect the committed changes.