git: sbin/hammer: Fix bug in get_buffer_data()

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sat Dec 17 11:28:49 PST 2016


commit e4323571a2e8310683120148b720a92f801c618f
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Sat Dec 17 20:26:17 2016 +0900

    sbin/hammer: Fix bug in get_buffer_data()
    
    The previous commit made clear that xor part of get_buffer_data()
    was wrong. Since buf_offset is in any zone not limited to zone-2,
    xor of two offsets doesn't necessarily show the right result to
    know whether they belong to the same buffer, even if ->zone2_offset
    is originally translated from the same zone within the same buffer.
    
    It needs to take xor of long offsets instead of full 64 bits.
    
    The reason cache releasing is now limited to directly translated
    zones is because for indirectly translated zones (i.e. undo zone),
    it can't tell overlap by xor of offsets regardless of long format.
    
    Prior to this commit, get_buffer_data() has been releasing buffers
    that don't need to be released (i.e. *bufferp being the right cache),
    and has resulted in huge overhead as shown in below comparison.
    In the first example, get_buffer_data() is releasing *bufferp for
    undo fifo entries everytime when it doesn't need to release.
    
    -- Prior to this commit
     # time newfs_hammer -L TEST /dev/da4
     Volume 0 DEVICE /dev/da4        size   4.55TB
     initialize freemap volume 0
     initializing the undo map (1024 MB)
     ---------------------------------------------
     HAMMER version 6
     1 volume total size   4.55TB
     root-volume:         /dev/da4
     boot-area-size:       32.00KB
     memory-log-size:     256.00KB
     undo-buffer-size:      1.00GB
     total-pre-allocated:   1.02GB
     <snip>
     newfs_hammer -L TEST /dev/da4  3.05s user 1.16s system 41% cpu 10.098 total
    
    -- Using this commit
     # time newfs_hammer -L TEST /dev/da4
     Volume 0 DEVICE /dev/da4        size   4.55TB
     initialize freemap volume 0
     initializing the undo map (1024 MB)
     ---------------------------------------------
     HAMMER version 6
     1 volume total size   4.55TB
     root-volume:         /dev/da4
     boot-area-size:       32.00KB
     memory-log-size:     256.00KB
     undo-buffer-size:      1.00GB
     total-pre-allocated:   1.02GB
     <snip>
     newfs_hammer -L TEST /dev/da4  2.72s user 0.04s system 73% cpu 3.755 total

Summary of changes:
 sbin/hammer/ondisk.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

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


-- 
DragonFly BSD source repository


More information about the Commits mailing list