{"id":65,"date":"2012-07-24T21:55:26","date_gmt":"2012-07-24T13:55:26","guid":{"rendered":"http:\/\/www.datarelab.com\/blog\/?p=65"},"modified":"2012-07-24T21:55:26","modified_gmt":"2012-07-24T13:55:26","slug":"linux_ext%e5%88%86%e5%8c%ba%e8%b6%85%e7%ba%a7%e5%9d%97%e7%bb%93%e6%9e%84","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/65.html","title":{"rendered":"Linux_Ext\u5206\u533a\u8d85\u7ea7\u5757\u7ed3\u6784"},"content":{"rendered":"<pre class=\"brush:cpp; toolbar: true; auto-links: true;\">\/\/ext4\r\n\/*\r\n * Behaviour when detecting errors\r\n *\/\r\n#define EXT4_ERRORS_CONTINUE\t\t1\t\/* Continue execution *\/\r\n#define EXT4_ERRORS_RO\t\t\t2\t\/* Remount fs read-only *\/\r\n#define EXT4_ERRORS_PANIC\t\t3\t\/* Panic *\/\r\n#define EXT4_ERRORS_DEFAULT\t\tEXT4_ERRORS_CONTINUE\r\n\r\n\/* Metadata checksum algorithm codes *\/\r\n#define EXT4_CRC32C_CHKSUM\t\t1\r\n\r\n\/*\r\n * Structure of the super block\r\n *\/\r\nstruct ext4_super_block {\r\n\/*00*\/\t__le32\ts_inodes_count;\t\t\/* Inodes count *\/\r\n\t__le32\ts_blocks_count_lo;\t\/* Blocks count *\/\r\n\t__le32\ts_r_blocks_count_lo;\t\/* Reserved blocks count *\/\r\n\t__le32\ts_free_blocks_count_lo;\t\/* Free blocks count *\/\r\n\/*10*\/\t__le32\ts_free_inodes_count;\t\/* Free inodes count *\/\r\n\t__le32\ts_first_data_block;\t\/* First Data Block *\/\r\n\t__le32\ts_log_block_size;\t\/* Block size *\/\r\n\t__le32\ts_log_cluster_size;\t\/* Allocation cluster size *\/\r\n\/*20*\/\t__le32\ts_blocks_per_group;\t\/* # Blocks per group *\/\r\n\t__le32\ts_clusters_per_group;\t\/* # Clusters per group *\/\r\n\t__le32\ts_inodes_per_group;\t\/* # Inodes per group *\/\r\n\t__le32\ts_mtime;\t\t\/* Mount time *\/\r\n\/*30*\/\t__le32\ts_wtime;\t\t\/* Write time *\/\r\n\t__le16\ts_mnt_count;\t\t\/* Mount count *\/\r\n\t__le16\ts_max_mnt_count;\t\/* Maximal mount count *\/\r\n\t__le16\ts_magic;\t\t\/* Magic signature *\/\r\n\t__le16\ts_state;\t\t\/* File system state *\/\r\n\t__le16\ts_errors;\t\t\/* Behaviour when detecting errors *\/\r\n\t__le16\ts_minor_rev_level;\t\/* minor revision level *\/\r\n\/*40*\/\t__le32\ts_lastcheck;\t\t\/* time of last check *\/\r\n\t__le32\ts_checkinterval;\t\/* max. time between checks *\/\r\n\t__le32\ts_creator_os;\t\t\/* OS *\/\r\n\t__le32\ts_rev_level;\t\t\/* Revision level *\/\r\n\/*50*\/\t__le16\ts_def_resuid;\t\t\/* Default uid for reserved blocks *\/\r\n\t__le16\ts_def_resgid;\t\t\/* Default gid for reserved blocks *\/\r\n\t\/*\r\n\t * These fields are for EXT4_DYNAMIC_REV superblocks only.\r\n\t *\r\n\t * Note: the difference between the compatible feature set and\r\n\t * the incompatible feature set is that if there is a bit set\r\n\t * in the incompatible feature set that the kernel doesn't\r\n\t * know about, it should refuse to mount the filesystem.\r\n\t *\r\n\t * e2fsck's requirements are more strict; if it doesn't know\r\n\t * about a feature in either the compatible or incompatible\r\n\t * feature set, it must abort and not try to meddle with\r\n\t * things it doesn't understand...\r\n\t *\/\r\n\t__le32\ts_first_ino;\t\t\/* First non-reserved inode *\/\r\n\t__le16  s_inode_size;\t\t\/* size of inode structure *\/\r\n\t__le16\ts_block_group_nr;\t\/* block group # of this superblock *\/\r\n\t__le32\ts_feature_compat;\t\/* compatible feature set *\/\r\n\/*60*\/\t__le32\ts_feature_incompat;\t\/* incompatible feature set *\/\r\n\t__le32\ts_feature_ro_compat;\t\/* readonly-compatible feature set *\/\r\n\/*68*\/\t__u8\ts_uuid[16];\t\t\/* 128-bit uuid for volume *\/\r\n\/*78*\/\tchar\ts_volume_name[16];\t\/* volume name *\/\r\n\/*88*\/\tchar\ts_last_mounted[64];\t\/* directory where last mounted *\/\r\n\/*C8*\/\t__le32\ts_algorithm_usage_bitmap; \/* For compression *\/\r\n\t\/*\r\n\t * Performance hints.  Directory preallocation should only\r\n\t * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.\r\n\t *\/\r\n\t__u8\ts_prealloc_blocks;\t\/* Nr of blocks to try to preallocate*\/\r\n\t__u8\ts_prealloc_dir_blocks;\t\/* Nr to preallocate for dirs *\/\r\n\t__le16\ts_reserved_gdt_blocks;\t\/* Per group desc for online growth *\/\r\n\t\/*\r\n\t * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.\r\n\t *\/\r\n\/*D0*\/\t__u8\ts_journal_uuid[16];\t\/* uuid of journal superblock *\/\r\n\/*E0*\/\t__le32\ts_journal_inum;\t\t\/* inode number of journal file *\/\r\n\t__le32\ts_journal_dev;\t\t\/* device number of journal file *\/\r\n\t__le32\ts_last_orphan;\t\t\/* start of list of inodes to delete *\/\r\n\t__le32\ts_hash_seed[4];\t\t\/* HTREE hash seed *\/\r\n\t__u8\ts_def_hash_version;\t\/* Default hash version to use *\/\r\n\t__u8\ts_jnl_backup_type;\r\n\t__le16  s_desc_size;\t\t\/* size of group descriptor *\/\r\n\/*100*\/\t__le32\ts_default_mount_opts;\r\n\t__le32\ts_first_meta_bg;\t\/* First metablock block group *\/\r\n\t__le32\ts_mkfs_time;\t\t\/* When the filesystem was created *\/\r\n\t__le32\ts_jnl_blocks[17];\t\/* Backup of the journal inode *\/\r\n\t\/* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT *\/\r\n\/*150*\/\t__le32\ts_blocks_count_hi;\t\/* Blocks count *\/\r\n\t__le32\ts_r_blocks_count_hi;\t\/* Reserved blocks count *\/\r\n\t__le32\ts_free_blocks_count_hi;\t\/* Free blocks count *\/\r\n\t__le16\ts_min_extra_isize;\t\/* All inodes have at least # bytes *\/\r\n\t__le16\ts_want_extra_isize; \t\/* New inodes should reserve # bytes *\/\r\n\t__le32\ts_flags;\t\t\/* Miscellaneous flags *\/\r\n\t__le16  s_raid_stride;\t\t\/* RAID stride *\/\r\n\t__le16  s_mmp_update_interval;  \/* # seconds to wait in MMP checking *\/\r\n\t__le64  s_mmp_block;            \/* Block for multi-mount protection *\/\r\n\t__le32  s_raid_stripe_width;    \/* blocks on all data disks (N*stride)*\/\r\n\t__u8\ts_log_groups_per_flex;  \/* FLEX_BG group size *\/\r\n\t__u8\ts_checksum_type;\t\/* metadata checksum algorithm used *\/\r\n\t__le16  s_reserved_pad;\r\n\t__le64\ts_kbytes_written;\t\/* nr of lifetime kilobytes written *\/\r\n\t__le32\ts_snapshot_inum;\t\/* Inode number of active snapshot *\/\r\n\t__le32\ts_snapshot_id;\t\t\/* sequential ID of active snapshot *\/\r\n\t__le64\ts_snapshot_r_blocks_count; \/* reserved blocks for active\r\n\t\t\t\t\t      snapshot's future use *\/\r\n\t__le32\ts_snapshot_list;\t\/* inode number of the head of the\r\n\t\t\t\t\t   on-disk snapshot list *\/\r\n#define EXT4_S_ERR_START offsetof(struct ext4_super_block, s_error_count)\r\n\t__le32\ts_error_count;\t\t\/* number of fs errors *\/\r\n\t__le32\ts_first_error_time;\t\/* first time an error happened *\/\r\n\t__le32\ts_first_error_ino;\t\/* inode involved in first error *\/\r\n\t__le64\ts_first_error_block;\t\/* block involved of first error *\/\r\n\t__u8\ts_first_error_func[32];\t\/* function where the error happened *\/\r\n\t__le32\ts_first_error_line;\t\/* line number where error happened *\/\r\n\t__le32\ts_last_error_time;\t\/* most recent time of an error *\/\r\n\t__le32\ts_last_error_ino;\t\/* inode involved in last error *\/\r\n\t__le32\ts_last_error_line;\t\/* line number where error happened *\/\r\n\t__le64\ts_last_error_block;\t\/* block involved of last error *\/\r\n\t__u8\ts_last_error_func[32];\t\/* function where the error happened *\/\r\n#define EXT4_S_ERR_END offsetof(struct ext4_super_block, s_mount_opts)\r\n\t__u8\ts_mount_opts[64];\r\n\t__le32\ts_usr_quota_inum;\t\/* inode for tracking user quota *\/\r\n\t__le32\ts_grp_quota_inum;\t\/* inode for tracking group quota *\/\r\n\t__le32\ts_overhead_clusters;\t\/* overhead blocks\/clusters in fs *\/\r\n\t__le32\ts_reserved[108];\t\/* Padding to the end of the block *\/\r\n\t__le32\ts_checksum;\t\t\/* crc32c(superblock) *\/\r\n};\r\n\r\n\/\/ext3\r\n\/*\r\n * Structure of the super block\r\n *\/\r\nstruct ext3_super_block {\r\n\/*00*\/\t__le32\ts_inodes_count;\t\t\/* Inodes count *\/\r\n\t__le32\ts_blocks_count;\t\t\/* Blocks count *\/\r\n\t__le32\ts_r_blocks_count;\t\/* Reserved blocks count *\/\r\n\t__le32\ts_free_blocks_count;\t\/* Free blocks count *\/\r\n\/*10*\/\t__le32\ts_free_inodes_count;\t\/* Free inodes count *\/\r\n\t__le32\ts_first_data_block;\t\/* First Data Block *\/\r\n\t__le32\ts_log_block_size;\t\/* Block size *\/\r\n\t__le32\ts_log_frag_size;\t\/* Fragment size *\/\r\n\/*20*\/\t__le32\ts_blocks_per_group;\t\/* # Blocks per group *\/\r\n\t__le32\ts_frags_per_group;\t\/* # Fragments per group *\/\r\n\t__le32\ts_inodes_per_group;\t\/* # Inodes per group *\/\r\n\t__le32\ts_mtime;\t\t\/* Mount time *\/\r\n\/*30*\/\t__le32\ts_wtime;\t\t\/* Write time *\/\r\n\t__le16\ts_mnt_count;\t\t\/* Mount count *\/\r\n\t__le16\ts_max_mnt_count;\t\/* Maximal mount count *\/\r\n\t__le16\ts_magic;\t\t\/* Magic signature *\/\r\n\t__le16\ts_state;\t\t\/* File system state *\/\r\n\t__le16\ts_errors;\t\t\/* Behaviour when detecting errors *\/\r\n\t__le16\ts_minor_rev_level;\t\/* minor revision level *\/\r\n\/*40*\/\t__le32\ts_lastcheck;\t\t\/* time of last check *\/\r\n\t__le32\ts_checkinterval;\t\/* max. time between checks *\/\r\n\t__le32\ts_creator_os;\t\t\/* OS *\/\r\n\t__le32\ts_rev_level;\t\t\/* Revision level *\/\r\n\/*50*\/\t__le16\ts_def_resuid;\t\t\/* Default uid for reserved blocks *\/\r\n\t__le16\ts_def_resgid;\t\t\/* Default gid for reserved blocks *\/\r\n\t\/*\r\n\t * These fields are for EXT3_DYNAMIC_REV superblocks only.\r\n\t *\r\n\t * Note: the difference between the compatible feature set and\r\n\t * the incompatible feature set is that if there is a bit set\r\n\t * in the incompatible feature set that the kernel doesn't\r\n\t * know about, it should refuse to mount the filesystem.\r\n\t *\r\n\t * e2fsck's requirements are more strict; if it doesn't know\r\n\t * about a feature in either the compatible or incompatible\r\n\t * feature set, it must abort and not try to meddle with\r\n\t * things it doesn't understand...\r\n\t *\/\r\n\t__le32\ts_first_ino;\t\t\/* First non-reserved inode *\/\r\n\t__le16   s_inode_size;\t\t\/* size of inode structure *\/\r\n\t__le16\ts_block_group_nr;\t\/* block group # of this superblock *\/\r\n\t__le32\ts_feature_compat;\t\/* compatible feature set *\/\r\n\/*60*\/\t__le32\ts_feature_incompat;\t\/* incompatible feature set *\/\r\n\t__le32\ts_feature_ro_compat;\t\/* readonly-compatible feature set *\/\r\n\/*68*\/\t__u8\ts_uuid[16];\t\t\/* 128-bit uuid for volume *\/\r\n\/*78*\/\tchar\ts_volume_name[16];\t\/* volume name *\/\r\n\/*88*\/\tchar\ts_last_mounted[64];\t\/* directory where last mounted *\/\r\n\/*C8*\/\t__le32\ts_algorithm_usage_bitmap; \/* For compression *\/\r\n\t\/*\r\n\t * Performance hints.  Directory preallocation should only\r\n\t * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on.\r\n\t *\/\r\n\t__u8\ts_prealloc_blocks;\t\/* Nr of blocks to try to preallocate*\/\r\n\t__u8\ts_prealloc_dir_blocks;\t\/* Nr to preallocate for dirs *\/\r\n\t__le16\ts_reserved_gdt_blocks;\t\/* Per group desc for online growth *\/\r\n\t\/*\r\n\t * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.\r\n\t *\/\r\n\/*D0*\/\t__u8\ts_journal_uuid[16];\t\/* uuid of journal superblock *\/\r\n\/*E0*\/\t__le32\ts_journal_inum;\t\t\/* inode number of journal file *\/\r\n\t__le32\ts_journal_dev;\t\t\/* device number of journal file *\/\r\n\t__le32\ts_last_orphan;\t\t\/* start of list of inodes to delete *\/\r\n\t__le32\ts_hash_seed[4];\t\t\/* HTREE hash seed *\/\r\n\t__u8\ts_def_hash_version;\t\/* Default hash version to use *\/\r\n\t__u8\ts_reserved_char_pad;\r\n\t__u16\ts_reserved_word_pad;\r\n\t__le32\ts_default_mount_opts;\r\n\t__le32\ts_first_meta_bg;\t\/* First metablock block group *\/\r\n\t__le32\ts_mkfs_time;\t\t\/* When the filesystem was created *\/\r\n\t__le32\ts_jnl_blocks[17];\t\/* Backup of the journal inode *\/\r\n\t\/* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT *\/\r\n\/*150*\/\t__le32\ts_blocks_count_hi;\t\/* Blocks count *\/\r\n\t__le32\ts_r_blocks_count_hi;\t\/* Reserved blocks count *\/\r\n\t__le32\ts_free_blocks_count_hi;\t\/* Free blocks count *\/\r\n\t__le16\ts_min_extra_isize;\t\/* All inodes have at least # bytes *\/\r\n\t__le16\ts_want_extra_isize; \t\/* New inodes should reserve # bytes *\/\r\n\t__le32\ts_flags;\t\t\/* Miscellaneous flags *\/\r\n\t__le16  s_raid_stride;\t\t\/* RAID stride *\/\r\n\t__le16  s_mmp_interval;         \/* # seconds to wait in MMP checking *\/\r\n\t__le64  s_mmp_block;            \/* Block for multi-mount protection *\/\r\n\t__le32  s_raid_stripe_width;    \/* blocks on all data disks (N*stride)*\/\r\n\t__u8\ts_log_groups_per_flex;  \/* FLEX_BG group size *\/\r\n\t__u8\ts_reserved_char_pad2;\r\n\t__le16  s_reserved_pad;\r\n\t__u32   s_reserved[162];        \/* Padding to the end of the block *\/\r\n};\r\n\r\n\/\/ext2\r\n\/*\r\n * Structure of the super block\r\n *\/\r\nstruct ext2_super_block {\r\n\t__le32\ts_inodes_count;\t\t\/* Inodes count *\/\r\n\t__le32\ts_blocks_count;\t\t\/* Blocks count *\/\r\n\t__le32\ts_r_blocks_count;\t\/* Reserved blocks count *\/\r\n\t__le32\ts_free_blocks_count;\t\/* Free blocks count *\/\r\n\t__le32\ts_free_inodes_count;\t\/* Free inodes count *\/\r\n\t__le32\ts_first_data_block;\t\/* First Data Block *\/\r\n\t__le32\ts_log_block_size;\t\/* Block size *\/\r\n\t__le32\ts_log_frag_size;\t\/* Fragment size *\/\r\n\t__le32\ts_blocks_per_group;\t\/* # Blocks per group *\/\r\n\t__le32\ts_frags_per_group;\t\/* # Fragments per group *\/\r\n\t__le32\ts_inodes_per_group;\t\/* # Inodes per group *\/\r\n\t__le32\ts_mtime;\t\t\/* Mount time *\/\r\n\t__le32\ts_wtime;\t\t\/* Write time *\/\r\n\t__le16\ts_mnt_count;\t\t\/* Mount count *\/\r\n\t__le16\ts_max_mnt_count;\t\/* Maximal mount count *\/\r\n\t__le16\ts_magic;\t\t\/* Magic signature *\/\r\n\t__le16\ts_state;\t\t\/* File system state *\/\r\n\t__le16\ts_errors;\t\t\/* Behaviour when detecting errors *\/\r\n\t__le16\ts_minor_rev_level; \t\/* minor revision level *\/\r\n\t__le32\ts_lastcheck;\t\t\/* time of last check *\/\r\n\t__le32\ts_checkinterval;\t\/* max. time between checks *\/\r\n\t__le32\ts_creator_os;\t\t\/* OS *\/\r\n\t__le32\ts_rev_level;\t\t\/* Revision level *\/\r\n\t__le16\ts_def_resuid;\t\t\/* Default uid for reserved blocks *\/\r\n\t__le16\ts_def_resgid;\t\t\/* Default gid for reserved blocks *\/\r\n\t\/*\r\n\t * These fields are for EXT2_DYNAMIC_REV superblocks only.\r\n\t *\r\n\t * Note: the difference between the compatible feature set and\r\n\t * the incompatible feature set is that if there is a bit set\r\n\t * in the incompatible feature set that the kernel doesn't\r\n\t * know about, it should refuse to mount the filesystem.\r\n\t * \r\n\t * e2fsck's requirements are more strict; if it doesn't know\r\n\t * about a feature in either the compatible or incompatible\r\n\t * feature set, it must abort and not try to meddle with\r\n\t * things it doesn't understand...\r\n\t *\/\r\n\t__le32\ts_first_ino; \t\t\/* First non-reserved inode *\/\r\n\t__le16   s_inode_size; \t\t\/* size of inode structure *\/\r\n\t__le16\ts_block_group_nr; \t\/* block group # of this superblock *\/\r\n\t__le32\ts_feature_compat; \t\/* compatible feature set *\/\r\n\t__le32\ts_feature_incompat; \t\/* incompatible feature set *\/\r\n\t__le32\ts_feature_ro_compat; \t\/* readonly-compatible feature set *\/\r\n\t__u8\ts_uuid[16];\t\t\/* 128-bit uuid for volume *\/\r\n\tchar\ts_volume_name[16]; \t\/* volume name *\/\r\n\tchar\ts_last_mounted[64]; \t\/* directory where last mounted *\/\r\n\t__le32\ts_algorithm_usage_bitmap; \/* For compression *\/\r\n\t\/*\r\n\t * Performance hints.  Directory preallocation should only\r\n\t * happen if the EXT2_COMPAT_PREALLOC flag is on.\r\n\t *\/\r\n\t__u8\ts_prealloc_blocks;\t\/* Nr of blocks to try to preallocate*\/\r\n\t__u8\ts_prealloc_dir_blocks;\t\/* Nr to preallocate for dirs *\/\r\n\t__u16\ts_padding1;\r\n\t\/*\r\n\t * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.\r\n\t *\/\r\n\t__u8\ts_journal_uuid[16];\t\/* uuid of journal superblock *\/\r\n\t__u32\ts_journal_inum;\t\t\/* inode number of journal file *\/\r\n\t__u32\ts_journal_dev;\t\t\/* device number of journal file *\/\r\n\t__u32\ts_last_orphan;\t\t\/* start of list of inodes to delete *\/\r\n\t__u32\ts_hash_seed[4];\t\t\/* HTREE hash seed *\/\r\n\t__u8\ts_def_hash_version;\t\/* Default hash version to use *\/\r\n\t__u8\ts_reserved_char_pad;\r\n\t__u16\ts_reserved_word_pad;\r\n\t__le32\ts_default_mount_opts;\r\n \t__le32\ts_first_meta_bg; \t\/* First metablock block group *\/\r\n\t__u32\ts_reserved[190];\t\/* Padding to the end of the block *\/\r\n};<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ext4 \/* * Behaviour when detecting errors *\/ #define  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[114,115,116,14,113],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-Technical_literature","tag-ext2","tag-ext3","tag-ext4","tag-linux"],"views":1279,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=65"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/65\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}