Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #ifndef __FAST_COMMIT_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #define __FAST_COMMIT_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) /* Fast commit tags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define EXT4_FC_TAG_ADD_RANGE		0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define EXT4_FC_TAG_DEL_RANGE		0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define EXT4_FC_TAG_CREAT		0x0003
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #define EXT4_FC_TAG_LINK		0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define EXT4_FC_TAG_UNLINK		0x0005
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define EXT4_FC_TAG_INODE		0x0006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define EXT4_FC_TAG_PAD			0x0007
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define EXT4_FC_TAG_TAIL		0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define EXT4_FC_TAG_HEAD		0x0009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define EXT4_FC_SUPPORTED_FEATURES	0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) /* On disk fast commit tlv value structures */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /* Fast commit on disk tag length structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) struct ext4_fc_tl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	__le16 fc_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	__le16 fc_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) /* Value structure for tag EXT4_FC_TAG_HEAD. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) struct ext4_fc_head {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	__le32 fc_features;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	__le32 fc_tid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) /* Value structure for EXT4_FC_TAG_ADD_RANGE. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) struct ext4_fc_add_range {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	__le32 fc_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	__u8 fc_ex[12];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) /* Value structure for tag EXT4_FC_TAG_DEL_RANGE. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) struct ext4_fc_del_range {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	__le32 fc_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	__le32 fc_lblk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	__le32 fc_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * This is the value structure for tags EXT4_FC_TAG_CREAT, EXT4_FC_TAG_LINK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * and EXT4_FC_TAG_UNLINK.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) struct ext4_fc_dentry_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	__le32 fc_parent_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	__le32 fc_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	u8 fc_dname[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) /* Value structure for EXT4_FC_TAG_INODE and EXT4_FC_TAG_INODE_PARTIAL. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) struct ext4_fc_inode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	__le32 fc_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	__u8 fc_raw_inode[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) /* Value structure for tag EXT4_FC_TAG_TAIL. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) struct ext4_fc_tail {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	__le32 fc_tid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	__le32 fc_crc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * In memory list of dentry updates that are performed on the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  * system used by fast commit code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) struct ext4_fc_dentry_update {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	int fcd_op;		/* Type of update create / unlink / link */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	int fcd_parent;		/* Parent inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	int fcd_ino;		/* Inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	struct qstr fcd_name;	/* Dirent name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	unsigned char fcd_iname[DNAME_INLINE_LEN];	/* Dirent name string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	struct list_head fcd_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * Fast commit reason codes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	 * Commit status codes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	EXT4_FC_REASON_OK = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	EXT4_FC_REASON_INELIGIBLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	EXT4_FC_REASON_ALREADY_COMMITTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	EXT4_FC_REASON_FC_START_FAILED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	EXT4_FC_REASON_FC_FAILED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	 * Fast commit ineligiblity reasons:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	EXT4_FC_REASON_XATTR = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	EXT4_FC_REASON_CROSS_RENAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	EXT4_FC_REASON_JOURNAL_FLAG_CHANGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	EXT4_FC_REASON_NOMEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	EXT4_FC_REASON_SWAP_BOOT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	EXT4_FC_REASON_RESIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	EXT4_FC_REASON_RENAME_DIR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	EXT4_FC_REASON_FALLOC_RANGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	EXT4_FC_REASON_INODE_JOURNAL_DATA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	EXT4_FC_COMMIT_FAILED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	EXT4_FC_REASON_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct ext4_fc_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	unsigned int fc_ineligible_reason_count[EXT4_FC_REASON_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	unsigned long fc_num_commits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	unsigned long fc_ineligible_commits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	unsigned long fc_numblks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #define EXT4_FC_REPLAY_REALLOC_INCREMENT	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  * Physical block regions added to different inodes due to fast commit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * recovery. These are set during the SCAN phase. During the replay phase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * our allocator excludes these from its allocation. This ensures that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * we don't accidentally allocating a block that is going to be used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * another inode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct ext4_fc_alloc_region {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	ext4_lblk_t lblk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	ext4_fsblk_t pblk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	int ino, len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * Fast commit replay state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) struct ext4_fc_replay_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	int fc_replay_num_tags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	int fc_replay_expected_off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	int fc_current_pass;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	int fc_cur_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	int fc_crc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	struct ext4_fc_alloc_region *fc_regions;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	int fc_regions_size, fc_regions_used, fc_regions_valid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	int *fc_modified_inodes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	int fc_modified_inodes_used, fc_modified_inodes_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #define region_last(__region) (((__region)->lblk) + ((__region)->len) - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #endif /* __FAST_COMMIT_H__ */