• Enzo Matsumiya's avatar
    cifs: use ALIGN() and round_up() macros · d7173623
    Enzo Matsumiya authored
    Improve code readability by using existing macros:
    
    Replace hardcoded alignment computations (e.g. (len + 7) & ~0x7) by
    ALIGN()/IS_ALIGNED() macros.
    
    Also replace (DIV_ROUND_UP(len, 8) * 8) with ALIGN(len, 8), which, if
    not optimized by the compiler, has the overhead of a multiplication
    and a division. Do the same for roundup() by replacing it by round_up()
    (division-less version, but requires the multiple to be a power of 2,
    which is always the case for us).
    
    And remove some unnecessary checks where !IS_ALIGNED() would fit, but
    calling round_up() directly is fine as it's a no-op if the value is
    already aligned.
    Signed-off-by: default avatarEnzo Matsumiya <ematsumiya@suse.de>
    Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    d7173623
smb2misc.c 26.1 KB