Lines Matching +full:block +full:- +full:number

1 // SPDX-License-Identifier: GPL-2.0
14 #define F2FS_SUPER_OFFSET 1024 /* byte-size offset */
16 #define F2FS_MAX_LOG_SECTOR_SIZE PAGE_SHIFT /* Max is Block Size */
17 #define F2FS_LOG_SECTORS_PER_BLOCK (PAGE_SHIFT - 9) /* log number for sector/blk */
18 #define F2FS_BLKSIZE PAGE_SIZE /* support only block == page */
24 #define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
25 #define COMPRESS_ADDR ((block_t)-2) /* used as compressed data flag */
27 #define F2FS_BLKSIZE_MASK (F2FS_BLKSIZE - 1)
30 #define F2FS_BLK_END_BYTES(blk) (F2FS_BLK_TO_BYTES(blk + 1) - 1)
31 #define F2FS_BLK_ALIGN(x) (F2FS_BYTES_TO_BLK((x) + F2FS_BLKSIZE - 1))
36 #define F2FS_ROOT_INO(sbi) ((sbi)->root_ino_num)
37 #define F2FS_NODE_INO(sbi) ((sbi)->node_ino_num)
38 #define F2FS_META_INO(sbi) ((sbi)->meta_ino_num)
39 #define F2FS_COMPRESS_INO(sbi) (NM_I(sbi)->max_nid)
49 * For further optimization on multi-head logs, on-disk layout supports maximum
50 * 16 logs by default. The number, 16, is expected to cover all the cases
112 __le32 magic; /* Magic Number */
116 __le32 log_sectors_per_block; /* log2 # of sectors per block */
117 __le32 log_blocksize; /* log2 block size in bytes */
121 __le32 checksum_offset; /* checksum offset inside super block */
130 __le32 segment0_blkaddr; /* start block address of segment 0 */
131 __le32 cp_blkaddr; /* start block address of checkpoint */
132 __le32 sit_blkaddr; /* start block address of SIT */
133 __le32 nat_blkaddr; /* start block address of NAT */
134 __le32 ssa_blkaddr; /* start block address of SSA */
135 __le32 main_blkaddr; /* start block address of main area */
136 __le32 root_ino; /* root inode number */
137 __le32 node_ino; /* node inode number */
138 __le32 meta_ino; /* meta inode number */
139 __u8 uuid[16]; /* 128-bit uuid for volume */
182 __le64 checkpoint_ver; /* checkpoint block version number */
197 __le32 cp_pack_start_sum; /* start block number of data summary */
198 __le32 valid_node_count; /* Total number of valid nodes */
199 __le32 valid_inode_count; /* Total number of valid inodes */
200 __le32 next_free_nid; /* Next free node number */
203 __le32 checksum_offset; /* checksum offset inside cp block */
212 #define CP_CHKSUM_OFFSET (F2FS_BLKSIZE - sizeof(__le32)) /* default chksum offset in checkpoint */
219 #define F2FS_ORPHANS_PER_BLOCK ((F2FS_BLKSIZE - 4 * sizeof(__le32)) / sizeof(__le32))
221 #define GET_ORPHAN_BLOCKS(n) (((n) + F2FS_ORPHANS_PER_BLOCK - 1) / \
227 __le16 blk_addr; /* block index in current CP */
228 __le16 blk_count; /* Number of orphan inode blocks in CP */
229 __le32 entry_count; /* Total number of orphan nodes in current CP */
230 __le32 check_sum; /* CRC32 for orphan inode block */
238 __le32 blk; /* start block address of the extent */
251 __le32 ino; /* inode number */
254 __le32 next_blkaddr; /* next node page block address */
258 #define DEF_ADDRS_PER_INODE ((F2FS_BLKSIZE - OFFSET_OF_END_OF_I_EXT \
259 - SIZE_OF_I_NID \
260 - sizeof(struct node_footer)) / sizeof(__le32))
261 #define CUR_ADDRS_PER_INODE(inode) (DEF_ADDRS_PER_INODE - \
265 /* Address Pointers in a Direct Block */
266 #define DEF_ADDRS_PER_BLOCK ((F2FS_BLKSIZE - sizeof(struct node_footer)) / sizeof(__le32))
268 /* Node IDs in an Indirect Block */
269 #define NIDS_PER_BLOCK ((F2FS_BLKSIZE - sizeof(struct node_footer)) / sizeof(__le32))
313 __le32 i_pino; /* parent inode number */
344 __le32 addr[DEF_ADDRS_PER_BLOCK]; /* array of data block address */
348 __le32 nid[NIDS_PER_BLOCK]; /* array of data block address */
358 #define OFFSET_BIT_MASK GENMASK(OFFSET_BIT_SHIFT - 1, 0)
377 __le32 ino; /* inode number */
378 __le32 block_addr; /* block address */
397 * F2FS uses 4 bytes to represent block address. As a result, supported size of
404 * Note that f2fs_sit_entry->vblocks has the following bit-field information.
406 * [9:0] : valid block count
409 #define SIT_VBLOCKS_MASK ((1 << SIT_VBLOCKS_SHIFT) - 1)
411 (le16_to_cpu((raw_sit)->vblocks) & SIT_VBLOCKS_MASK)
413 ((le16_to_cpu((raw_sit)->vblocks) & ~SIT_VBLOCKS_MASK) \
429 * One summary block with 4KB size contains exactly 512 summary entries, which
431 * Similarly, in the case of block with 16KB size, it represents one segment with 8MB size.
436 * - If data page, nid represents dnode's nid
437 * - If node page, nid represents the node page's nid.
440 * from node's page's beginning to get a data block address.
448 /* a summary entry for a block in a segment */
454 __u8 version; /* node version number */
455 __le16 ofs_in_node; /* block index in parent node */
460 /* summary block type, node or data, is stored to the summary_footer */
469 #define SUM_JOURNAL_SIZE (F2FS_BLKSIZE - SUM_FOOTER_SIZE -\
471 #define NAT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
473 #define NAT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) %\
475 #define SIT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
477 #define SIT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) %\
483 #define EXTRA_INFO_RESERVED (SUM_JOURNAL_SIZE - 2 - 8)
532 /* Block-sized summary block structure */
549 /* One directory entry slot covers 8bytes-long file name */
553 #define GET_DENTRY_SLOTS(x) (((x) + F2FS_SLOT_LEN - 1) >> F2FS_SLOT_LEN_BITS)
559 #define MAX_DIR_BUCKETS BIT((MAX_DIR_HASH_DEPTH / 2) - 1)
563 * when block size is 4KB.
575 /* the number of dentry in a block */
579 #define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
581 #define SIZE_OF_RESERVED (F2FS_BLKSIZE - ((SIZE_OF_DIR_ENTRY + \
586 /* One directory entry slot representing F2FS_SLOT_LEN-sized file name */
589 __le32 ino; /* inode number */
594 /* Block-sized directory entry block */
596 /* validity bitmap for directory entries in each block */