diff options
Diffstat (limited to 'include/linux/nilfs2_fs.h')
| -rw-r--r-- | include/linux/nilfs2_fs.h | 79 |
1 files changed, 59 insertions, 20 deletions
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h index 3fe02cf8b65a..f5487b6f91ed 100644 --- a/include/linux/nilfs2_fs.h +++ b/include/linux/nilfs2_fs.h | |||
| @@ -153,13 +153,14 @@ struct nilfs_super_root { | |||
| 153 | semantics also for data */ | 153 | semantics also for data */ |
| 154 | #define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during | 154 | #define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during |
| 155 | mount-time recovery */ | 155 | mount-time recovery */ |
| 156 | #define NILFS_MOUNT_DISCARD 0x8000 /* Issue DISCARD requests */ | ||
| 156 | 157 | ||
| 157 | 158 | ||
| 158 | /** | 159 | /** |
| 159 | * struct nilfs_super_block - structure of super block on disk | 160 | * struct nilfs_super_block - structure of super block on disk |
| 160 | */ | 161 | */ |
| 161 | struct nilfs_super_block { | 162 | struct nilfs_super_block { |
| 162 | __le32 s_rev_level; /* Revision level */ | 163 | /*00*/ __le32 s_rev_level; /* Revision level */ |
| 163 | __le16 s_minor_rev_level; /* minor revision level */ | 164 | __le16 s_minor_rev_level; /* minor revision level */ |
| 164 | __le16 s_magic; /* Magic signature */ | 165 | __le16 s_magic; /* Magic signature */ |
| 165 | 166 | ||
| @@ -168,51 +169,53 @@ struct nilfs_super_block { | |||
| 168 | is excluded. */ | 169 | is excluded. */ |
| 169 | __le16 s_flags; /* flags */ | 170 | __le16 s_flags; /* flags */ |
| 170 | __le32 s_crc_seed; /* Seed value of CRC calculation */ | 171 | __le32 s_crc_seed; /* Seed value of CRC calculation */ |
| 171 | __le32 s_sum; /* Check sum of super block */ | 172 | /*10*/ __le32 s_sum; /* Check sum of super block */ |
| 172 | 173 | ||
| 173 | __le32 s_log_block_size; /* Block size represented as follows | 174 | __le32 s_log_block_size; /* Block size represented as follows |
| 174 | blocksize = | 175 | blocksize = |
| 175 | 1 << (s_log_block_size + 10) */ | 176 | 1 << (s_log_block_size + 10) */ |
| 176 | __le64 s_nsegments; /* Number of segments in filesystem */ | 177 | __le64 s_nsegments; /* Number of segments in filesystem */ |
| 177 | __le64 s_dev_size; /* block device size in bytes */ | 178 | /*20*/ __le64 s_dev_size; /* block device size in bytes */ |
| 178 | __le64 s_first_data_block; /* 1st seg disk block number */ | 179 | __le64 s_first_data_block; /* 1st seg disk block number */ |
| 179 | __le32 s_blocks_per_segment; /* number of blocks per full segment */ | 180 | /*30*/ __le32 s_blocks_per_segment; /* number of blocks per full segment */ |
| 180 | __le32 s_r_segments_percentage; /* Reserved segments percentage */ | 181 | __le32 s_r_segments_percentage; /* Reserved segments percentage */ |
| 181 | 182 | ||
| 182 | __le64 s_last_cno; /* Last checkpoint number */ | 183 | __le64 s_last_cno; /* Last checkpoint number */ |
| 183 | __le64 s_last_pseg; /* disk block addr pseg written last */ | 184 | /*40*/ __le64 s_last_pseg; /* disk block addr pseg written last */ |
| 184 | __le64 s_last_seq; /* seq. number of seg written last */ | 185 | __le64 s_last_seq; /* seq. number of seg written last */ |
| 185 | __le64 s_free_blocks_count; /* Free blocks count */ | 186 | /*50*/ __le64 s_free_blocks_count; /* Free blocks count */ |
| 186 | 187 | ||
| 187 | __le64 s_ctime; /* Creation time (execution time of | 188 | __le64 s_ctime; /* Creation time (execution time of |
| 188 | newfs) */ | 189 | newfs) */ |
| 189 | __le64 s_mtime; /* Mount time */ | 190 | /*60*/ __le64 s_mtime; /* Mount time */ |
| 190 | __le64 s_wtime; /* Write time */ | 191 | __le64 s_wtime; /* Write time */ |
| 191 | __le16 s_mnt_count; /* Mount count */ | 192 | /*70*/ __le16 s_mnt_count; /* Mount count */ |
| 192 | __le16 s_max_mnt_count; /* Maximal mount count */ | 193 | __le16 s_max_mnt_count; /* Maximal mount count */ |
| 193 | __le16 s_state; /* File system state */ | 194 | __le16 s_state; /* File system state */ |
| 194 | __le16 s_errors; /* Behaviour when detecting errors */ | 195 | __le16 s_errors; /* Behaviour when detecting errors */ |
| 195 | __le64 s_lastcheck; /* time of last check */ | 196 | __le64 s_lastcheck; /* time of last check */ |
| 196 | 197 | ||
| 197 | __le32 s_checkinterval; /* max. time between checks */ | 198 | /*80*/ __le32 s_checkinterval; /* max. time between checks */ |
| 198 | __le32 s_creator_os; /* OS */ | 199 | __le32 s_creator_os; /* OS */ |
| 199 | __le16 s_def_resuid; /* Default uid for reserved blocks */ | 200 | __le16 s_def_resuid; /* Default uid for reserved blocks */ |
| 200 | __le16 s_def_resgid; /* Default gid for reserved blocks */ | 201 | __le16 s_def_resgid; /* Default gid for reserved blocks */ |
| 201 | __le32 s_first_ino; /* First non-reserved inode */ | 202 | __le32 s_first_ino; /* First non-reserved inode */ |
| 202 | 203 | ||
| 203 | __le16 s_inode_size; /* Size of an inode */ | 204 | /*90*/ __le16 s_inode_size; /* Size of an inode */ |
| 204 | __le16 s_dat_entry_size; /* Size of a dat entry */ | 205 | __le16 s_dat_entry_size; /* Size of a dat entry */ |
| 205 | __le16 s_checkpoint_size; /* Size of a checkpoint */ | 206 | __le16 s_checkpoint_size; /* Size of a checkpoint */ |
| 206 | __le16 s_segment_usage_size; /* Size of a segment usage */ | 207 | __le16 s_segment_usage_size; /* Size of a segment usage */ |
| 207 | 208 | ||
| 208 | __u8 s_uuid[16]; /* 128-bit uuid for volume */ | 209 | /*98*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ |
| 209 | char s_volume_name[16]; /* volume name */ | 210 | /*A8*/ char s_volume_name[80]; /* volume name */ |
| 210 | char s_last_mounted[64]; /* directory where last mounted */ | ||
| 211 | 211 | ||
| 212 | __le32 s_c_interval; /* Commit interval of segment */ | 212 | /*F8*/ __le32 s_c_interval; /* Commit interval of segment */ |
| 213 | __le32 s_c_block_max; /* Threshold of data amount for | 213 | __le32 s_c_block_max; /* Threshold of data amount for |
| 214 | the segment construction */ | 214 | the segment construction */ |
| 215 | __u32 s_reserved[192]; /* padding to the end of the block */ | 215 | /*100*/ __le64 s_feature_compat; /* Compatible feature set */ |
| 216 | __le64 s_feature_compat_ro; /* Read-only compatible feature set */ | ||
| 217 | __le64 s_feature_incompat; /* Incompatible feature set */ | ||
| 218 | __u32 s_reserved[186]; /* padding to the end of the block */ | ||
| 216 | }; | 219 | }; |
| 217 | 220 | ||
| 218 | /* | 221 | /* |
| @@ -228,6 +231,16 @@ struct nilfs_super_block { | |||
| 228 | #define NILFS_MINOR_REV 0 /* minor revision */ | 231 | #define NILFS_MINOR_REV 0 /* minor revision */ |
| 229 | 232 | ||
| 230 | /* | 233 | /* |
| 234 | * Feature set definitions | ||
| 235 | * | ||
| 236 | * If there is a bit set in the incompatible feature set that the kernel | ||
| 237 | * doesn't know about, it should refuse to mount the filesystem. | ||
| 238 | */ | ||
| 239 | #define NILFS_FEATURE_COMPAT_SUPP 0ULL | ||
| 240 | #define NILFS_FEATURE_COMPAT_RO_SUPP 0ULL | ||
| 241 | #define NILFS_FEATURE_INCOMPAT_SUPP 0ULL | ||
| 242 | |||
| 243 | /* | ||
| 231 | * Bytes count of super_block for CRC-calculation | 244 | * Bytes count of super_block for CRC-calculation |
| 232 | */ | 245 | */ |
| 233 | #define NILFS_SB_BYTES \ | 246 | #define NILFS_SB_BYTES \ |
| @@ -274,6 +287,12 @@ struct nilfs_super_block { | |||
| 274 | #define NILFS_NAME_LEN 255 | 287 | #define NILFS_NAME_LEN 255 |
| 275 | 288 | ||
| 276 | /* | 289 | /* |
| 290 | * Block size limitations | ||
| 291 | */ | ||
| 292 | #define NILFS_MIN_BLOCK_SIZE 1024 | ||
| 293 | #define NILFS_MAX_BLOCK_SIZE 65536 | ||
| 294 | |||
| 295 | /* | ||
| 277 | * The new version of the directory entry. Since V0 structures are | 296 | * The new version of the directory entry. Since V0 structures are |
| 278 | * stored in intel byte order, and the name_len field could never be | 297 | * stored in intel byte order, and the name_len field could never be |
| 279 | * bigger than 255 chars, it's safe to reclaim the extra byte for the | 298 | * bigger than 255 chars, it's safe to reclaim the extra byte for the |
| @@ -313,7 +332,25 @@ enum { | |||
| 313 | #define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1) | 332 | #define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1) |
| 314 | #define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \ | 333 | #define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \ |
| 315 | ~NILFS_DIR_ROUND) | 334 | ~NILFS_DIR_ROUND) |
| 335 | #define NILFS_MAX_REC_LEN ((1<<16)-1) | ||
| 316 | 336 | ||
| 337 | static inline unsigned nilfs_rec_len_from_disk(__le16 dlen) | ||
| 338 | { | ||
| 339 | unsigned len = le16_to_cpu(dlen); | ||
| 340 | |||
| 341 | if (len == NILFS_MAX_REC_LEN) | ||
| 342 | return 1 << 16; | ||
| 343 | return len; | ||
| 344 | } | ||
| 345 | |||
| 346 | static inline __le16 nilfs_rec_len_to_disk(unsigned len) | ||
| 347 | { | ||
| 348 | if (len == (1 << 16)) | ||
| 349 | return cpu_to_le16(NILFS_MAX_REC_LEN); | ||
| 350 | else if (len > (1 << 16)) | ||
| 351 | BUG(); | ||
| 352 | return cpu_to_le16(len); | ||
| 353 | } | ||
| 317 | 354 | ||
| 318 | /** | 355 | /** |
| 319 | * struct nilfs_finfo - file information | 356 | * struct nilfs_finfo - file information |
| @@ -376,6 +413,7 @@ union nilfs_binfo { | |||
| 376 | * @ss_nfinfo: number of finfo structures | 413 | * @ss_nfinfo: number of finfo structures |
| 377 | * @ss_sumbytes: total size of segment summary in bytes | 414 | * @ss_sumbytes: total size of segment summary in bytes |
| 378 | * @ss_pad: padding | 415 | * @ss_pad: padding |
| 416 | * @ss_cno: checkpoint number | ||
| 379 | */ | 417 | */ |
| 380 | struct nilfs_segment_summary { | 418 | struct nilfs_segment_summary { |
| 381 | __le32 ss_datasum; | 419 | __le32 ss_datasum; |
| @@ -390,6 +428,7 @@ struct nilfs_segment_summary { | |||
| 390 | __le32 ss_nfinfo; | 428 | __le32 ss_nfinfo; |
| 391 | __le32 ss_sumbytes; | 429 | __le32 ss_sumbytes; |
| 392 | __le32 ss_pad; | 430 | __le32 ss_pad; |
| 431 | __le64 ss_cno; | ||
| 393 | /* array of finfo structures */ | 432 | /* array of finfo structures */ |
| 394 | }; | 433 | }; |
| 395 | 434 | ||
| @@ -436,10 +475,10 @@ struct nilfs_palloc_group_desc { | |||
| 436 | 475 | ||
| 437 | /** | 476 | /** |
| 438 | * struct nilfs_dat_entry - disk address translation entry | 477 | * struct nilfs_dat_entry - disk address translation entry |
| 439 | * @dt_blocknr: block number | 478 | * @de_blocknr: block number |
| 440 | * @dt_start: start checkpoint number | 479 | * @de_start: start checkpoint number |
| 441 | * @dt_end: end checkpoint number | 480 | * @de_end: end checkpoint number |
| 442 | * @dt_rsv: reserved for future use | 481 | * @de_rsv: reserved for future use |
| 443 | */ | 482 | */ |
| 444 | struct nilfs_dat_entry { | 483 | struct nilfs_dat_entry { |
| 445 | __le64 de_blocknr; | 484 | __le64 de_blocknr; |
