Drop blk argument to meta functions

Authored by dougm_rice.edu on Aug 10 2017, 6:45 PM.



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

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
dougm_rice.edu created this revision.Aug 10 2017, 6:45 PM
alc edited edge metadata.Aug 12 2017, 6:01 PM

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.
alc added a comment.Aug 12 2017, 6:02 PM

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

Add missing argument, change struct member type.

alc accepted this revision.Aug 12 2017, 6:43 PM

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


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


# 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.