• N
    btrfs: Round down values which are written for total_bytes_size · 7dfb8be1
    Nikolay Borisov 提交于
    We got an internal report about a file system not wanting to mount
    following 99e3ecfc ("Btrfs: add more validation checks for
    superblock").
    
    BTRFS error (device sdb1): super_total_bytes 1000203816960 mismatch with
    fs_devices total_rw_bytes 1000203820544
    
    Subtracting the numbers we get a difference of less than a 4kb. Upon
    closer inspection it became apparent that mkfs actually rounds down the
    size of the device to a multiple of sector size. However, the same
    cannot be said for various functions which modify the total size and are
    called from btrfs_balance as well as when adding a new device. So this
    patch ensures that values being saved into on-disk data structures are
    always rounded down to a multiple of sectorsize.
    Signed-off-by: NNikolay Borisov <nborisov@suse.com>
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    7dfb8be1
ctree.h 126.6 KB