git: sbin/hammer: Fix/refactor check_data_crc()

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sun Mar 27 10:07:48 PDT 2016


commit 3fd1e952cb2f26187833a14e7b4115f59505b33d
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Sun Mar 27 20:56:14 2016 +0900

    sbin/hammer: Fix/refactor check_data_crc()
    
    Separate inode CRC from other CRC checks.
    The only reason this function goes into while(data_len) loop is
    because HAMMER userspace can only support upto 16KB buffer data
    whereas inode is always 128 byte.
    
    CRC check should look something similar to the kernel function
    hammer_crc_test_leaf() in order to keep maintainability.
    
    Also blockmap_lookup() doesn't need to be inside the while loop.
    It only needs to verify zone offset once for each record data.
    
    Also use return value of blockmap_lookup() which is zone2 offset
    instead of using non-zone2 offset for get_buffer_data().
    get_buffer() does extra blockmap lookup if offset is not zone-2.

Summary of changes:
 sbin/hammer/cmd_show.c | 69 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 46 insertions(+), 23 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3fd1e952cb2f26187833a14e7b4115f59505b33d


-- 
DragonFly BSD source repository



More information about the Commits mailing list