[ext4]08 磁盘布局 - CheckSums

从2012年开始,Ext4和jbd2的元数据中都开始加入checksums。特性标识是metadata_csum。Checksum算法是在super_block中指定:

struct ext4_super_block {

    __u8    s_log_groups_per_flex;  /* FLEX_BG group size */

    __u8   s_checksum_type;  /* metadata checksum algorithm used */

}

但是在当前版本(3.13)中,依旧仅支持一种校验算法CRC32c。

在Ext4系统中,并不是所有的元数据校验值都是保存全部的32校验和,某些元数据因为考虑到数据结构的兼容性问题仅保存校验和的低16位数值。到那时如果开启64bit特性,所有的元数据校验值将保存全部的32位校验和。

Ext4系统中使用CRC32校验的元数据:

Metadata

Length

Ingredients

Superblock

__le32

The entire superblock up to the checksum field. The UUID lives inside the superblock.

MMP

__le32

UUID + the entire MMP block up to the checksum field.

Extended Attributes

__le32

UUID + the entire extended attribute block. The checksum field is set to zero.

Directory Entries

__le32

UUID + inode number + inode generation + the directory block up to the fake entry enclosing the checksum field.

HTREE Nodes

__le32

UUID + inode number + inode generation + all valid extents + HTREE tail. The checksum field is set to zero.

Extents

__le32

UUID + inode number + inode generation + the entire extent block up to the checksum field.

Bitmaps

__le32 or __le16

UUID + the entire bitmap. Checksums are stored in the group descriptor, and truncated if the group descriptor size is 32 bytes (i.e. ^64bit)

Inodes

__le32

UUID + inode number + inode generation + the entire inode. The checksum field is set to zero. Each inode has its own checksum.

Group Descriptors

__le16

If metadata_csum, then UUID + group number + the entire descriptor; else if uninit_bg, then crc16(UUID + group number + the entire descriptor). In all cases, only the lower 16 bits are stored.

转载于:https://www.cnblogs.com/youngerchina/p/5624480.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值