^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) * fs/f2fs/node.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2012 Samsung Electronics Co., Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * http://www.samsung.com/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) /* start node id of a node block dedicated to the given node id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define START_NID(nid) (((nid) / NAT_ENTRY_PER_BLOCK) * NAT_ENTRY_PER_BLOCK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /* node block offset on the NAT area dedicated to the given start node id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define NAT_BLOCK_OFFSET(start_nid) ((start_nid) / NAT_ENTRY_PER_BLOCK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /* # of pages to perform synchronous readahead before building free nids */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define FREE_NID_PAGES 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define MAX_FREE_NIDS (NAT_ENTRY_PER_BLOCK * FREE_NID_PAGES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /* size of free nid batch when shrinking */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define SHRINK_NID_BATCH_SIZE 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define DEF_RA_NID_PAGES 0 /* # of nid pages to be readaheaded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /* maximum readahead size for node during getting data blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define MAX_RA_NODE 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* control the memory footprint threshold (10MB per 1GB ram) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define DEF_RAM_THRESHOLD 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* control dirty nats ratio threshold (default: 10% over max nid count) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define DEF_DIRTY_NAT_RATIO_THRESHOLD 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* control total # of nats */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define DEF_NAT_CACHE_THRESHOLD 100000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* vector size for gang look-up from nat cache that consists of radix tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define NATVEC_SIZE 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define SETVEC_SIZE 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* return value for read_node_page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define LOCKED_PAGE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* check pinned file's alignment status of physical blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define FILE_NOT_ALIGNED 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /* For flag in struct node_info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) IS_CHECKPOINTED, /* is it checkpointed before? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) HAS_FSYNCED_INODE, /* is the inode fsynced before? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) HAS_LAST_FSYNC, /* has the latest node fsync mark? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) IS_DIRTY, /* this nat entry is dirty? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) IS_PREALLOC, /* nat entry is preallocated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * For node information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct node_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) nid_t nid; /* node id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) nid_t ino; /* inode number of the node's owner */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) block_t blk_addr; /* block address of the node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) unsigned char version; /* version of the node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) unsigned char flag; /* for node information bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) struct nat_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct list_head list; /* for clean or dirty nat list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct node_info ni; /* in-memory node information */
^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) #define nat_get_nid(nat) ((nat)->ni.nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define nat_set_nid(nat, n) ((nat)->ni.nid = (n))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define nat_get_blkaddr(nat) ((nat)->ni.blk_addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define nat_set_blkaddr(nat, b) ((nat)->ni.blk_addr = (b))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define nat_get_ino(nat) ((nat)->ni.ino)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define nat_set_ino(nat, i) ((nat)->ni.ino = (i))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define nat_get_version(nat) ((nat)->ni.version)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define nat_set_version(nat, v) ((nat)->ni.version = (v))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #define inc_node_version(version) (++(version))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) static inline void copy_node_info(struct node_info *dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) struct node_info *src)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) dst->nid = src->nid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) dst->ino = src->ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) dst->blk_addr = src->blk_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) dst->version = src->version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) /* should not copy flag here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) static inline void set_nat_flag(struct nat_entry *ne,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) unsigned int type, bool set)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) unsigned char mask = 0x01 << type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) if (set)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) ne->ni.flag |= mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) ne->ni.flag &= ~mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) static inline bool get_nat_flag(struct nat_entry *ne, unsigned int type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) unsigned char mask = 0x01 << type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) return ne->ni.flag & mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) static inline void nat_reset_flag(struct nat_entry *ne)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /* these states can be set only after checkpoint was done */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) set_nat_flag(ne, IS_CHECKPOINTED, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) set_nat_flag(ne, HAS_FSYNCED_INODE, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) set_nat_flag(ne, HAS_LAST_FSYNC, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) static inline void node_info_from_raw_nat(struct node_info *ni,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct f2fs_nat_entry *raw_ne)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) ni->ino = le32_to_cpu(raw_ne->ino);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) ni->blk_addr = le32_to_cpu(raw_ne->block_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) ni->version = raw_ne->version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static inline void raw_nat_from_node_info(struct f2fs_nat_entry *raw_ne,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct node_info *ni)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) raw_ne->ino = cpu_to_le32(ni->ino);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) raw_ne->block_addr = cpu_to_le32(ni->blk_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) raw_ne->version = ni->version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static inline bool excess_dirty_nats(struct f2fs_sb_info *sbi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) return NM_I(sbi)->nat_cnt[DIRTY_NAT] >= NM_I(sbi)->max_nid *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) NM_I(sbi)->dirty_nats_ratio / 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static inline bool excess_cached_nats(struct f2fs_sb_info *sbi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) return NM_I(sbi)->nat_cnt[TOTAL_NAT] >= DEF_NAT_CACHE_THRESHOLD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) static inline bool excess_dirty_nodes(struct f2fs_sb_info *sbi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return get_pages(sbi, F2FS_DIRTY_NODES) >= sbi->blocks_per_seg * 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) enum mem_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) FREE_NIDS, /* indicates the free nid list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) NAT_ENTRIES, /* indicates the cached nat entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) DIRTY_DENTS, /* indicates dirty dentry pages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) INO_ENTRIES, /* indicates inode entries */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) EXTENT_CACHE, /* indicates extent cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) INMEM_PAGES, /* indicates inmemory pages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) DISCARD_CACHE, /* indicates memory of cached discard cmds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) COMPRESS_PAGE, /* indicates memory of cached compressed pages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) BASE_CHECK, /* check kernel status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) struct nat_entry_set {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct list_head set_list; /* link with other nat sets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) struct list_head entry_list; /* link with dirty nat entries */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) nid_t set; /* set number*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) unsigned int entry_cnt; /* the # of nat entries in set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct free_nid {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) struct list_head list; /* for free node id list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) nid_t nid; /* node id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int state; /* in use or not: FREE_NID or PREALLOC_NID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static inline void next_free_nid(struct f2fs_sb_info *sbi, nid_t *nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) struct f2fs_nm_info *nm_i = NM_I(sbi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) struct free_nid *fnid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) spin_lock(&nm_i->nid_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) if (nm_i->nid_cnt[FREE_NID] <= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) spin_unlock(&nm_i->nid_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) fnid = list_first_entry(&nm_i->free_nid_list, struct free_nid, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) *nid = fnid->nid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) spin_unlock(&nm_i->nid_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * inline functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) static inline void get_nat_bitmap(struct f2fs_sb_info *sbi, void *addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) struct f2fs_nm_info *nm_i = NM_I(sbi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #ifdef CONFIG_F2FS_CHECK_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) if (memcmp(nm_i->nat_bitmap, nm_i->nat_bitmap_mir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) nm_i->bitmap_size))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) f2fs_bug_on(sbi, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) memcpy(addr, nm_i->nat_bitmap, nm_i->bitmap_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) static inline pgoff_t current_nat_addr(struct f2fs_sb_info *sbi, nid_t start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) struct f2fs_nm_info *nm_i = NM_I(sbi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) pgoff_t block_off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) pgoff_t block_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * block_off = segment_off * 512 + off_in_segment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * OLD = (segment_off * 512) * 2 + off_in_segment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) * NEW = 2 * (segment_off * 512 + off_in_segment) - off_in_segment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) block_off = NAT_BLOCK_OFFSET(start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) block_addr = (pgoff_t)(nm_i->nat_blkaddr +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) (block_off << 1) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) (block_off & (sbi->blocks_per_seg - 1)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) if (f2fs_test_bit(block_off, nm_i->nat_bitmap))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) block_addr += sbi->blocks_per_seg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) return block_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static inline pgoff_t next_nat_addr(struct f2fs_sb_info *sbi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) pgoff_t block_addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct f2fs_nm_info *nm_i = NM_I(sbi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) block_addr -= nm_i->nat_blkaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) block_addr ^= 1 << sbi->log_blocks_per_seg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) return block_addr + nm_i->nat_blkaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static inline void set_to_next_nat(struct f2fs_nm_info *nm_i, nid_t start_nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) unsigned int block_off = NAT_BLOCK_OFFSET(start_nid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) f2fs_change_bit(block_off, nm_i->nat_bitmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) #ifdef CONFIG_F2FS_CHECK_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) f2fs_change_bit(block_off, nm_i->nat_bitmap_mir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) static inline nid_t ino_of_node(struct page *node_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) struct f2fs_node *rn = F2FS_NODE(node_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) return le32_to_cpu(rn->footer.ino);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) static inline nid_t nid_of_node(struct page *node_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) struct f2fs_node *rn = F2FS_NODE(node_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) return le32_to_cpu(rn->footer.nid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) static inline unsigned int ofs_of_node(struct page *node_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) struct f2fs_node *rn = F2FS_NODE(node_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) unsigned flag = le32_to_cpu(rn->footer.flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) return flag >> OFFSET_BIT_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) static inline __u64 cpver_of_node(struct page *node_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) struct f2fs_node *rn = F2FS_NODE(node_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) return le64_to_cpu(rn->footer.cp_ver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) static inline block_t next_blkaddr_of_node(struct page *node_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) struct f2fs_node *rn = F2FS_NODE(node_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) return le32_to_cpu(rn->footer.next_blkaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) static inline void fill_node_footer(struct page *page, nid_t nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) nid_t ino, unsigned int ofs, bool reset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) struct f2fs_node *rn = F2FS_NODE(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) unsigned int old_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) if (reset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) memset(rn, 0, sizeof(*rn));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) old_flag = le32_to_cpu(rn->footer.flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) rn->footer.nid = cpu_to_le32(nid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) rn->footer.ino = cpu_to_le32(ino);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) /* should remain old flag bits such as COLD_BIT_SHIFT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) rn->footer.flag = cpu_to_le32((ofs << OFFSET_BIT_SHIFT) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) (old_flag & OFFSET_BIT_MASK));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) static inline void copy_node_footer(struct page *dst, struct page *src)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) struct f2fs_node *src_rn = F2FS_NODE(src);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) struct f2fs_node *dst_rn = F2FS_NODE(dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) memcpy(&dst_rn->footer, &src_rn->footer, sizeof(struct node_footer));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) static inline void fill_node_footer_blkaddr(struct page *page, block_t blkaddr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) struct f2fs_checkpoint *ckpt = F2FS_CKPT(F2FS_P_SB(page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) struct f2fs_node *rn = F2FS_NODE(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) __u64 cp_ver = cur_cp_version(ckpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) cp_ver |= (cur_cp_crc(ckpt) << 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) rn->footer.cp_ver = cpu_to_le64(cp_ver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) rn->footer.next_blkaddr = cpu_to_le32(blkaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) static inline bool is_recoverable_dnode(struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) struct f2fs_checkpoint *ckpt = F2FS_CKPT(F2FS_P_SB(page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) __u64 cp_ver = cur_cp_version(ckpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) /* Don't care crc part, if fsck.f2fs sets it. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) if (__is_set_ckpt_flags(ckpt, CP_NOCRC_RECOVERY_FLAG))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) return (cp_ver << 32) == (cpver_of_node(page) << 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) cp_ver |= (cur_cp_crc(ckpt) << 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) return cp_ver == cpver_of_node(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) * f2fs assigns the following node offsets described as (num).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) * N = NIDS_PER_BLOCK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) * Inode block (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) * |- direct node (1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) * |- direct node (2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) * |- indirect node (3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) * | `- direct node (4 => 4 + N - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) * |- indirect node (4 + N)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) * | `- direct node (5 + N => 5 + 2N - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) * `- double indirect node (5 + 2N)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * `- indirect node (6 + 2N)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * `- direct node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * ......
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * `- indirect node ((6 + 2N) + x(N + 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * `- direct node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * ......
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) * `- indirect node ((6 + 2N) + (N - 1)(N + 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) * `- direct node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) static inline bool IS_DNODE(struct page *node_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) unsigned int ofs = ofs_of_node(node_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) if (f2fs_has_xattr_block(ofs))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) if (ofs == 3 || ofs == 4 + NIDS_PER_BLOCK ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) ofs == 5 + 2 * NIDS_PER_BLOCK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) if (ofs >= 6 + 2 * NIDS_PER_BLOCK) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) ofs -= 6 + 2 * NIDS_PER_BLOCK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) if (!((long int)ofs % (NIDS_PER_BLOCK + 1)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) static inline int set_nid(struct page *p, int off, nid_t nid, bool i)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) struct f2fs_node *rn = F2FS_NODE(p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) f2fs_wait_on_page_writeback(p, NODE, true, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) if (i)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) rn->i.i_nid[off - NODE_DIR1_BLOCK] = cpu_to_le32(nid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) rn->in.nid[off] = cpu_to_le32(nid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) return set_page_dirty(p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) static inline nid_t get_nid(struct page *p, int off, bool i)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) struct f2fs_node *rn = F2FS_NODE(p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) if (i)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) return le32_to_cpu(rn->i.i_nid[off - NODE_DIR1_BLOCK]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) return le32_to_cpu(rn->in.nid[off]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) * Coldness identification:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) * - Mark cold files in f2fs_inode_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) * - Mark cold node blocks in their node footer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) * - Mark cold data pages in page cache
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) static inline int is_node(struct page *page, int type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) struct f2fs_node *rn = F2FS_NODE(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) return le32_to_cpu(rn->footer.flag) & (1 << type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) #define is_cold_node(page) is_node(page, COLD_BIT_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) #define is_fsync_dnode(page) is_node(page, FSYNC_BIT_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) #define is_dent_dnode(page) is_node(page, DENT_BIT_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) static inline void set_cold_node(struct page *page, bool is_dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) struct f2fs_node *rn = F2FS_NODE(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) unsigned int flag = le32_to_cpu(rn->footer.flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) if (is_dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) flag &= ~(0x1 << COLD_BIT_SHIFT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) flag |= (0x1 << COLD_BIT_SHIFT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) rn->footer.flag = cpu_to_le32(flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) static inline void set_mark(struct page *page, int mark, int type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) struct f2fs_node *rn = F2FS_NODE(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) unsigned int flag = le32_to_cpu(rn->footer.flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) if (mark)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) flag |= (0x1 << type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) flag &= ~(0x1 << type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) rn->footer.flag = cpu_to_le32(flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) #ifdef CONFIG_F2FS_CHECK_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) f2fs_inode_chksum_set(F2FS_P_SB(page), page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) #define set_dentry_mark(page, mark) set_mark(page, mark, DENT_BIT_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) #define set_fsync_mark(page, mark) set_mark(page, mark, FSYNC_BIT_SHIFT)