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)
Sat, Dec 21, 12:24 AM
Unknown Object (File)
Tue, Dec 10, 11:50 PM
Unknown Object (File)
Nov 25 2024, 1:18 AM
Unknown Object (File)
Nov 19 2024, 8:13 AM
Unknown Object (File)
Nov 14 2024, 1:19 PM
Unknown Object (File)
Nov 14 2024, 11:46 AM
Unknown Object (File)
Nov 13 2024, 2:45 AM
Unknown Object (File)
Oct 18 2024, 6:10 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.