/* SPDX-License-Identifier: GPL-2.0 */ /* *fs/f2fs/node.h * *Copyright(c)2012SamsungElectronicsCo.,Ltd. *http://www.samsung.com/
*/ /* start node id of a node block dedicated to the given node id */ #define START_NID(nid) (((nid) / NAT_ENTRY_PER_BLOCK) * NAT_ENTRY_PER_BLOCK)
/* node block offset on the NAT area dedicated to the given start node id */ #define NAT_BLOCK_OFFSET(start_nid) ((start_nid) / NAT_ENTRY_PER_BLOCK)
/* # of pages to perform synchronous readahead before building free nids */ #define FREE_NID_PAGES 8 #define MAX_FREE_NIDS (NAT_ENTRY_PER_BLOCK * FREE_NID_PAGES)
/* size of free nid batch when shrinking */ #define SHRINK_NID_BATCH_SIZE 8
#define DEF_RA_NID_PAGES 0/* # of nid pages to be readaheaded */
/* maximum readahead size for node during getting data blocks */ #define MAX_RA_NODE 128
/* control the memory footprint threshold (10MB per 1GB ram) */ #define DEF_RAM_THRESHOLD 1
/* control dirty nats ratio threshold (default: 10% over max nid count) */ #define DEF_DIRTY_NAT_RATIO_THRESHOLD 10 /* control total # of nats */ #define DEF_NAT_CACHE_THRESHOLD 100000
/* control total # of node writes used for roll-forward recovery */ #define DEF_RF_NODE_BLOCKS 0
/* vector size for gang look-up from nat cache that consists of radix tree */ #define NAT_VEC_SIZE 32
/* return value for read_node_page */ #define LOCKED_PAGE 1
/* check pinned file's alignment status of physical blocks */ #define FILE_NOT_ALIGNED 1
/* For flag in struct node_info */ enum {
IS_CHECKPOINTED, /* is it checkpointed before? */
HAS_FSYNCED_INODE, /* is the inode fsynced before? */
HAS_LAST_FSYNC, /* has the latest node fsync mark? */
IS_DIRTY, /* this nat entry is dirty? */
IS_PREALLOC, /* nat entry is preallocated */
};
/* For node type in __get_node_folio() */ enum node_type {
NODE_TYPE_REGULAR,
NODE_TYPE_INODE,
NODE_TYPE_XATTR,
NODE_TYPE_NON_INODE,
};
/* *Fornodeinformation
*/ struct node_info {
nid_t nid; /* node id */
nid_t ino; /* inode number of the node's owner */
block_t blk_addr; /* block address of the node */ unsignedchar version; /* version of the node */ unsignedchar flag; /* for node information bits */
};
struct nat_entry { struct list_head list; /* for clean or dirty nat list */ struct node_info ni; /* in-memory node information */
};
staticinlinevoid nat_reset_flag(struct nat_entry *ne)
{ /* these states can be set only after checkpoint was done */
set_nat_flag(ne, IS_CHECKPOINTED, true);
set_nat_flag(ne, HAS_FSYNCED_INODE, false);
set_nat_flag(ne, HAS_LAST_FSYNC, true);
}
enum mem_type {
FREE_NIDS, /* indicates the free nid list */
NAT_ENTRIES, /* indicates the cached nat entry */
DIRTY_DENTS, /* indicates dirty dentry pages */
INO_ENTRIES, /* indicates inode entries */
READ_EXTENT_CACHE, /* indicates read extent cache */
AGE_EXTENT_CACHE, /* indicates age extent cache */
DISCARD_CACHE, /* indicates memory of cached discard cmds */
COMPRESS_PAGE, /* indicates memory of cached compressed pages */
BASE_CHECK, /* check kernel status */
};
struct nat_entry_set { struct list_head set_list; /* link with other nat sets */ struct list_head entry_list; /* link with dirty nat entries */
nid_t set; /* set number*/ unsignedint entry_cnt; /* the # of nat entries in set */
};
struct free_nid { struct list_head list; /* for free node id list */
nid_t nid; /* node id */ int state; /* in use or not: FREE_NID or PREALLOC_NID */
};
if (is_dir)
flag &= ~BIT(COLD_BIT_SHIFT); else
flag |= BIT(COLD_BIT_SHIFT);
rn->footer.flag = cpu_to_le32(flag);
}
staticinlinevoid set_mark(struct folio *folio, int mark, int type)
{ struct f2fs_node *rn = F2FS_NODE(folio); unsignedint flag = le32_to_cpu(rn->footer.flag); if (mark)
flag |= BIT(type); else
flag &= ~BIT(type);
rn->footer.flag = cpu_to_le32(flag);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.