f2fs针对SSD介质,根据数据读写的频繁程度,实现了冷热数据的分离。

多路日志的原理

多路日志的相关数据结构

/*
 * For SIT manager
 *
 * By default, there are 6 active log areas across the whole main area.
 * When considering hot and cold data separation to reduce cleaning overhead,
 * we split 3 for data logs and 3 for node logs as hot, warm, and cold types,
 * respectively.
 * In the current design, you should not change the numbers intentionally.
 * Instead, as a mount option such as active_logs=x, you can use 2, 4, and 6
 * logs individually according to the underlying devices. (default: 6)
 * Just in case, on-disk layout covers maximum 16 logs that consist of 8 for
 * data and 8 for node logs.
 */
#define NR_CURSEG_DATA_TYPE     (3)
#define NR_CURSEG_NODE_TYPE     (3)
#define NR_CURSEG_TYPE  (NR_CURSEG_DATA_TYPE + NR_CURSEG_NODE_TYPE)

enum {
        CURSEG_HOT_DATA = 0,    /* directory entry blocks */
        CURSEG_WARM_DATA,       /* data blocks */
        CURSEG_COLD_DATA,       /* multimedia or GCed data blocks */
        CURSEG_HOT_NODE,        /* direct node blocks of directory files */
        CURSEG_WARM_NODE,       /* direct node blocks of normal files */
        CURSEG_COLD_NODE,       /* indirect node blocks */
        NO_CHECK_TYPE,
};

多路日志的