Lines Matching +full:node +full:- +full:version
1 /* SPDX-License-Identifier: GPL-2.0 */
3 * fs/f2fs/node.h
8 /* start node id of a node block dedicated to the given node id */
11 /* node block offset on the NAT area dedicated to the given start node id */
23 /* maximum readahead size for node during getting data blocks */
34 /* control total # of node writes used for roll-fowrad recovery */
37 /* vector size for gang look-up from nat cache that consists of radix tree */
50 HAS_LAST_FSYNC, /* has the latest node fsync mark? */
56 * For node information
59 nid_t nid; /* node id */
60 nid_t ino; /* inode number of the node's owner */
61 block_t blk_addr; /* block address of the node */
62 unsigned char version; /* version of the node */ member
63 unsigned char flag; /* for node information bits */
68 struct node_info ni; /* in-memory node information */
71 #define nat_get_nid(nat) ((nat)->ni.nid)
72 #define nat_set_nid(nat, n) ((nat)->ni.nid = (n))
73 #define nat_get_blkaddr(nat) ((nat)->ni.blk_addr)
74 #define nat_set_blkaddr(nat, b) ((nat)->ni.blk_addr = (b))
75 #define nat_get_ino(nat) ((nat)->ni.ino)
76 #define nat_set_ino(nat, i) ((nat)->ni.ino = (i))
77 #define nat_get_version(nat) ((nat)->ni.version)
78 #define nat_set_version(nat, v) ((nat)->ni.version = (v))
80 #define inc_node_version(version) (++(version)) argument
85 dst->nid = src->nid; in copy_node_info()
86 dst->ino = src->ino; in copy_node_info()
87 dst->blk_addr = src->blk_addr; in copy_node_info()
88 dst->version = src->version; in copy_node_info()
96 ne->ni.flag |= BIT(type); in set_nat_flag()
98 ne->ni.flag &= ~BIT(type); in set_nat_flag()
103 return ne->ni.flag & BIT(type); in get_nat_flag()
117 ni->ino = le32_to_cpu(raw_ne->ino); in node_info_from_raw_nat()
118 ni->blk_addr = le32_to_cpu(raw_ne->block_addr); in node_info_from_raw_nat()
119 ni->version = raw_ne->version; in node_info_from_raw_nat()
125 raw_ne->ino = cpu_to_le32(ni->ino); in raw_nat_from_node_info()
126 raw_ne->block_addr = cpu_to_le32(ni->blk_addr); in raw_nat_from_node_info()
127 raw_ne->version = ni->version; in raw_nat_from_node_info()
132 return NM_I(sbi)->nat_cnt[DIRTY_NAT] >= NM_I(sbi)->max_nid * in excess_dirty_nats()
133 NM_I(sbi)->dirty_nats_ratio / 100; in excess_dirty_nats()
138 return NM_I(sbi)->nat_cnt[TOTAL_NAT] >= DEF_NAT_CACHE_THRESHOLD; in excess_cached_nats()
161 struct list_head list; /* for free node id list */
162 nid_t nid; /* node id */
171 spin_lock(&nm_i->nid_list_lock); in next_free_nid()
172 if (nm_i->nid_cnt[FREE_NID] <= 0) { in next_free_nid()
173 spin_unlock(&nm_i->nid_list_lock); in next_free_nid()
176 fnid = list_first_entry(&nm_i->free_nid_list, struct free_nid, list); in next_free_nid()
177 *nid = fnid->nid; in next_free_nid()
178 spin_unlock(&nm_i->nid_list_lock); in next_free_nid()
189 if (memcmp(nm_i->nat_bitmap, nm_i->nat_bitmap_mir, in get_nat_bitmap()
190 nm_i->bitmap_size)) in get_nat_bitmap()
193 memcpy(addr, nm_i->nat_bitmap, nm_i->bitmap_size); in get_nat_bitmap()
205 * NEW = 2 * (segment_off * 512 + off_in_segment) - off_in_segment in current_nat_addr()
209 block_addr = (pgoff_t)(nm_i->nat_blkaddr + in current_nat_addr()
210 (block_off << 1) - in current_nat_addr()
211 (block_off & (BLKS_PER_SEG(sbi) - 1))); in current_nat_addr()
213 if (f2fs_test_bit(block_off, nm_i->nat_bitmap)) in current_nat_addr()
224 block_addr -= nm_i->nat_blkaddr; in next_nat_addr()
225 block_addr ^= BIT(sbi->log_blocks_per_seg); in next_nat_addr()
226 return block_addr + nm_i->nat_blkaddr; in next_nat_addr()
233 f2fs_change_bit(block_off, nm_i->nat_bitmap); in set_to_next_nat()
235 f2fs_change_bit(block_off, nm_i->nat_bitmap_mir); in set_to_next_nat()
242 return le32_to_cpu(rn->footer.ino); in ino_of_node()
248 return le32_to_cpu(rn->footer.nid); in nid_of_node()
254 unsigned flag = le32_to_cpu(rn->footer.flag); in ofs_of_node()
261 return le64_to_cpu(rn->footer.cp_ver); in cpver_of_node()
267 return le32_to_cpu(rn->footer.next_blkaddr); in next_blkaddr_of_node()
279 old_flag = le32_to_cpu(rn->footer.flag); in fill_node_footer()
281 rn->footer.nid = cpu_to_le32(nid); in fill_node_footer()
282 rn->footer.ino = cpu_to_le32(ino); in fill_node_footer()
285 rn->footer.flag = cpu_to_le32((ofs << OFFSET_BIT_SHIFT) | in fill_node_footer()
293 memcpy(&dst_rn->footer, &src_rn->footer, sizeof(struct node_footer)); in copy_node_footer()
305 rn->footer.cp_ver = cpu_to_le64(cp_ver); in fill_node_footer_blkaddr()
306 rn->footer.next_blkaddr = cpu_to_le32(blkaddr); in fill_node_footer_blkaddr()
325 * f2fs assigns the following node offsets described as (num).
329 * |- direct node (1)
330 * |- direct node (2)
331 * |- indirect node (3)
332 * | `- direct node (4 => 4 + N - 1)
333 * |- indirect node (4 + N)
334 * | `- direct node (5 + N => 5 + 2N - 1)
335 * `- double indirect node (5 + 2N)
336 * `- indirect node (6 + 2N)
337 * `- direct node
339 * `- indirect node ((6 + 2N) + x(N + 1))
340 * `- direct node
342 * `- indirect node ((6 + 2N) + (N - 1)(N + 1))
343 * `- direct node
356 ofs -= 6 + 2 * NIDS_PER_BLOCK; in IS_DNODE()
367 f2fs_wait_on_page_writeback(p, NODE, true, true); in set_nid()
370 rn->i.i_nid[off - NODE_DIR1_BLOCK] = cpu_to_le32(nid); in set_nid()
372 rn->in.nid[off] = cpu_to_le32(nid); in set_nid()
381 return le32_to_cpu(rn->i.i_nid[off - NODE_DIR1_BLOCK]); in get_nid()
382 return le32_to_cpu(rn->in.nid[off]); in get_nid()
387 * - Mark cold files in f2fs_inode_info
388 * - Mark cold node blocks in their node footer
389 * - Mark cold data pages in page cache
395 return le32_to_cpu(rn->footer.flag) & BIT(type); in is_node()
405 unsigned int flag = le32_to_cpu(rn->footer.flag); in set_cold_node()
411 rn->footer.flag = cpu_to_le32(flag); in set_cold_node()
417 unsigned int flag = le32_to_cpu(rn->footer.flag); in set_mark()
422 rn->footer.flag = cpu_to_le32(flag); in set_mark()