Lines Matching +full:block +full:- +full:size

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 */
21 #define F2FS_EXTENSION_LEN 8 /* max size of extension */
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
116 __le32 log_sectorsize; /* log2 sector size in bytes */
117 __le32 log_sectors_per_block; /* log2 # of sectors per block */
118 __le32 log_blocksize; /* log2 block size in bytes */
122 __le32 checksum_offset; /* checksum offset inside super block */
131 __le32 segment0_blkaddr; /* start block address of segment 0 */
132 __le32 cp_blkaddr; /* start block address of checkpoint */
133 __le32 sit_blkaddr; /* start block address of SIT */
134 __le32 nat_blkaddr; /* start block address of NAT */
135 __le32 ssa_blkaddr; /* start block address of SSA */
136 __le32 main_blkaddr; /* start block address of main area */
140 __u8 uuid[16]; /* 128-bit uuid for volume */
183 __le64 checkpoint_ver; /* checkpoint block version number */
198 __le32 cp_pack_start_sum; /* start block number of data summary */
204 __le32 checksum_offset; /* checksum offset inside cp block */
213 #define CP_CHKSUM_OFFSET (F2FS_BLKSIZE - sizeof(__le32)) /* default chksum offset in checkpoint */
220 #define F2FS_ORPHANS_PER_BLOCK ((F2FS_BLKSIZE - 4 * sizeof(__le32)) / sizeof(__le32))
222 #define GET_ORPHAN_BLOCKS(n) (((n) + F2FS_ORPHANS_PER_BLOCK - 1) / \
228 __le16 blk_addr; /* block index in current CP */
231 __le32 check_sum; /* CRC32 for orphan inode block */
239 __le32 blk; /* start block address of the extent */
255 __le32 next_blkaddr; /* next node page block address */
259 #define DEF_ADDRS_PER_INODE ((F2FS_BLKSIZE - OFFSET_OF_END_OF_I_EXT \
260 - SIZE_OF_I_NID \
261 - sizeof(struct node_footer)) / sizeof(__le32))
262 #define CUR_ADDRS_PER_INODE(inode) (DEF_ADDRS_PER_INODE - \
266 /* Address Pointers in a Direct Block */
267 #define DEF_ADDRS_PER_BLOCK ((F2FS_BLKSIZE - sizeof(struct node_footer)) / sizeof(__le32))
269 /* Node IDs in an Indirect Block */
270 #define NIDS_PER_BLOCK ((F2FS_BLKSIZE - sizeof(struct node_footer)) / sizeof(__le32))
296 __le64 i_size; /* file size in bytes */
297 __le64 i_blocks; /* file size in blocks */
323 __le16 i_extra_isize; /* extra inode attribute size */
324 __le16 i_inline_xattr_size; /* inline xattr size, unit: 4 bytes */
331 __u8 i_log_cluster_size; /* log of cluster size */
336 __le32 i_extra_end[0]; /* for attribute size calculation */
345 __le32 addr[DEF_ADDRS_PER_BLOCK]; /* array of data block address */
349 __le32 nid[NIDS_PER_BLOCK]; /* array of data block address */
359 #define OFFSET_BIT_MASK GENMASK(OFFSET_BIT_SHIFT - 1, 0)
379 __le32 block_addr; /* block address */
389 * A validity bitmap of 64 bytes covers 512 blocks of area. For a 4K page size,
390 * this results in a segment size of 2MB. For 16k pages, the default segment size
398 * F2FS uses 4 bytes to represent block address. As a result, supported size of
399 * disk is 16 TB for a 4K page size and 64 TB for a 16K page size and it equals
405 * Note that f2fs_sit_entry->vblocks has the following bit-field information.
407 * [9:0] : valid block count
410 #define SIT_VBLOCKS_MASK ((1 << SIT_VBLOCKS_SHIFT) - 1)
412 (le16_to_cpu((raw_sit)->vblocks) & SIT_VBLOCKS_MASK)
414 ((le16_to_cpu((raw_sit)->vblocks) & ~SIT_VBLOCKS_MASK) \
430 * One summary block with 4KB size contains exactly 512 summary entries, which
431 * represents exactly one segment with 2MB size.
432 * Similarly, in the case of block with 16KB size, it represents one segment with 8MB size.
437 * - If data page, nid represents dnode's nid
438 * - If node page, nid represents the node page's nid.
441 * from node's page's beginning to get a data block address.
449 /* a summary entry for a block in a segment */
456 __le16 ofs_in_node; /* block index in parent node */
461 /* summary block type, node or data, is stored to the summary_footer */
470 #define SUM_JOURNAL_SIZE (F2FS_BLKSIZE - SUM_FOOTER_SIZE -\
472 #define NAT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
474 #define NAT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) %\
476 #define SIT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
478 #define SIT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) %\
481 /* Reserved area should make size of f2fs_extra_info equals to
484 #define EXTRA_INFO_RESERVED (SUM_JOURNAL_SIZE - 2 - 8)
533 /* Block-sized summary block structure */
550 /* One directory entry slot covers 8bytes-long file name */
554 #define GET_DENTRY_SLOTS(x) (((x) + F2FS_SLOT_LEN - 1) >> F2FS_SLOT_LEN_BITS)
560 #define MAX_DIR_BUCKETS BIT((MAX_DIR_HASH_DEPTH / 2) - 1)
564 * when block size is 4KB.
576 /* the number of dentry in a block */
580 #define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
582 #define SIZE_OF_RESERVED (F2FS_BLKSIZE - ((SIZE_OF_DIR_ENTRY + \
587 /* One directory entry slot representing F2FS_SLOT_LEN-sized file name */
595 /* Block-sized directory entry block */
597 /* validity bitmap for directory entries in each block */