git: sbin/hammer: Fix memory allocation for zone statistics

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sat Jul 25 12:54:58 PDT 2015


commit fff0110a0b936812fc3f14008be83aa396551ce3
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Sun Jul 26 01:01:33 2015 +0900

    sbin/hammer: Fix memory allocation for zone statistics
    
    - 2550036 allocates unnecessary amount of memory when the
      filesystem consists of >1 volumes and accounting actually
      reaches to the second volume. This commit fixes it by
      splitting bitmap into bitmaps[2^8] where 2^8 is the maximum
      number of volumes. Other than that it's basically the same.
    
      layer1/layer2 direct map:
          <------> Max 2^8 volumes
      zzzzvvvvvvvvoooo oooooooooooooooo oooooooooooooooo oooooooooooooooo
      ----111111111111 1111112222222222 222222222ooooooo oooooooooooooooo
                  <----...
                  Most environment doesn't use address space this
                  far as the storage usually isn't as huge as 2^52,
                  so hammer_extend_layer2_bits() allocating bitmaps
                  for this region mostly ends up waste of memory.
                  Having an array bitmaps[2^8] prevents this as the
                  volume-bits-masked-laye1-index doesn't jump up by
                  2^10 when v part gets ++.

Summary of changes:
 sbin/hammer/misc.c | 100 ++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 72 insertions(+), 28 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/fff0110a0b936812fc3f14008be83aa396551ce3


-- 
DragonFly BSD source repository



More information about the Commits mailing list