git: sys/vfs/hammer: Add inline CRC functions hammer_crc_get_xxx()

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sun Sep 4 06:18:05 PDT 2016


commit c577aa50f5b320b86dc9ec1656662e10dc872776
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Sun Sep 4 14:50:21 2016 +0900

    sys/vfs/hammer: Add inline CRC functions hammer_crc_get_xxx()
    
    in addition to the existing hammer_crc_set_xxx() and hammer_crc_test_xxx().
    Reduces overly duplicated crc32(&..., HAMMER_XXX_CRCSIZE);.
    
    The only functional difference is that hammer_crc_test_leaf()
    now compares (leaf->data_crc == 0) if hammer_crc_get_leaf()
    returns 0 for inode whose length is not sizeof(hammer_inode_data).
    It previously directly returned false for this case.
    
    It is still expected that (leaf->data_crc == 0) would be false,
    however inode size (not file size, but the size of inode itself)
    other than sizeof(hammer_inode_data) is wrong which shouldn't
    happen in the first place. hammer_crc_set_leaf() has assertion
    for this like it did before, but only if INVARIANTS is set.

Summary of changes:
 sys/vfs/hammer/hammer.h      | 49 ++++++++++++++++++++++++++++++++-
 sys/vfs/hammer/hammer_subs.c | 65 ++++++++------------------------------------
 2 files changed, 59 insertions(+), 55 deletions(-)

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


-- 
DragonFly BSD source repository


More information about the Commits mailing list