mirror of
https://github.com/LuckfoxTECH/luckfox-pico.git
synced 2026-01-19 09:52:31 +01:00
project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
@@ -86,7 +86,7 @@ extern const char *f2fs_fault_name[FAULT_MAX];
|
||||
#define F2FS_MOUNT_FLUSH_MERGE 0x00000400
|
||||
#define F2FS_MOUNT_NOBARRIER 0x00000800
|
||||
#define F2FS_MOUNT_FASTBOOT 0x00001000
|
||||
#define F2FS_MOUNT_EXTENT_CACHE 0x00002000
|
||||
#define F2FS_MOUNT_READ_EXTENT_CACHE 0x00002000
|
||||
#define F2FS_MOUNT_DATA_FLUSH 0x00008000
|
||||
#define F2FS_MOUNT_FAULT_INJECTION 0x00010000
|
||||
#define F2FS_MOUNT_USRQUOTA 0x00080000
|
||||
@@ -101,6 +101,7 @@ extern const char *f2fs_fault_name[FAULT_MAX];
|
||||
#define F2FS_MOUNT_MERGE_CHECKPOINT 0x10000000
|
||||
#define F2FS_MOUNT_GC_MERGE 0x20000000
|
||||
#define F2FS_MOUNT_COMPRESS_CACHE 0x40000000
|
||||
#define F2FS_MOUNT_AGE_EXTENT_CACHE 0x80000000
|
||||
|
||||
#define F2FS_OPTION(sbi) ((sbi)->mount_opt)
|
||||
#define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)
|
||||
@@ -153,6 +154,7 @@ struct f2fs_mount_info {
|
||||
int fsync_mode; /* fsync policy */
|
||||
int fs_mode; /* fs mode: LFS or ADAPTIVE */
|
||||
int bggc_mode; /* bggc mode: off, on or sync */
|
||||
int memory_mode; /* memory mode */
|
||||
struct fscrypt_dummy_policy dummy_enc_policy; /* test dummy encryption */
|
||||
block_t unusable_cap_perc; /* percentage for cap */
|
||||
block_t unusable_cap; /* Amount of space allowed to be
|
||||
@@ -253,6 +255,10 @@ enum {
|
||||
* condition of read on truncated area
|
||||
* by extent_cache
|
||||
*/
|
||||
DATA_GENERIC_ENHANCE_UPDATE, /*
|
||||
* strong check on range and segment
|
||||
* bitmap for update case
|
||||
*/
|
||||
META_GENERIC,
|
||||
};
|
||||
|
||||
@@ -492,11 +498,11 @@ struct f2fs_filename {
|
||||
#ifdef CONFIG_UNICODE
|
||||
/*
|
||||
* For casefolded directories: the casefolded name, but it's left NULL
|
||||
* if the original name is not valid Unicode, if the directory is both
|
||||
* casefolded and encrypted and its encryption key is unavailable, or if
|
||||
* the filesystem is doing an internal operation where usr_fname is also
|
||||
* NULL. In all these cases we fall back to treating the name as an
|
||||
* opaque byte sequence.
|
||||
* if the original name is not valid Unicode, if the original name is
|
||||
* "." or "..", if the directory is both casefolded and encrypted and
|
||||
* its encryption key is unavailable, or if the filesystem is doing an
|
||||
* internal operation where usr_fname is also NULL. In all these cases
|
||||
* we fall back to treating the name as an opaque byte sequence.
|
||||
*/
|
||||
struct fscrypt_str cf_name;
|
||||
#endif
|
||||
@@ -570,7 +576,26 @@ enum {
|
||||
#define F2FS_MIN_EXTENT_LEN 64 /* minimum extent length */
|
||||
|
||||
/* number of extent info in extent cache we try to shrink */
|
||||
#define EXTENT_CACHE_SHRINK_NUMBER 128
|
||||
#define READ_EXTENT_CACHE_SHRINK_NUMBER 128
|
||||
|
||||
/* number of age extent info in extent cache we try to shrink */
|
||||
#define AGE_EXTENT_CACHE_SHRINK_NUMBER 128
|
||||
#define LAST_AGE_WEIGHT 30
|
||||
#define SAME_AGE_REGION 1024
|
||||
|
||||
/*
|
||||
* Define data block with age less than 1GB as hot data
|
||||
* define data block with age less than 10GB but more than 1GB as warm data
|
||||
*/
|
||||
#define DEF_HOT_DATA_AGE_THRESHOLD 262144
|
||||
#define DEF_WARM_DATA_AGE_THRESHOLD 2621440
|
||||
|
||||
/* extent cache type */
|
||||
enum extent_type {
|
||||
EX_READ,
|
||||
EX_BLOCK_AGE,
|
||||
NR_EXTENT_CACHES,
|
||||
};
|
||||
|
||||
struct rb_entry {
|
||||
struct rb_node rb_node; /* rb node located in rb-tree */
|
||||
@@ -586,7 +611,24 @@ struct rb_entry {
|
||||
struct extent_info {
|
||||
unsigned int fofs; /* start offset in a file */
|
||||
unsigned int len; /* length of the extent */
|
||||
u32 blk; /* start block address of the extent */
|
||||
union {
|
||||
/* read extent_cache */
|
||||
struct {
|
||||
/* start block address of the extent */
|
||||
block_t blk;
|
||||
#ifdef CONFIG_F2FS_FS_COMPRESSION
|
||||
/* physical extent length of compressed blocks */
|
||||
unsigned int c_len;
|
||||
#endif
|
||||
};
|
||||
/* block age extent_cache */
|
||||
struct {
|
||||
/* block age of the extent */
|
||||
unsigned long long age;
|
||||
/* last total blocks allocated */
|
||||
unsigned long long last_blocks;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
struct extent_node {
|
||||
@@ -598,13 +640,25 @@ struct extent_node {
|
||||
|
||||
struct extent_tree {
|
||||
nid_t ino; /* inode number */
|
||||
enum extent_type type; /* keep the extent tree type */
|
||||
struct rb_root_cached root; /* root of extent info rb-tree */
|
||||
struct extent_node *cached_en; /* recently accessed extent node */
|
||||
struct extent_info largest; /* largested extent info */
|
||||
struct list_head list; /* to be used by sbi->zombie_list */
|
||||
rwlock_t lock; /* protect extent info rb-tree */
|
||||
atomic_t node_cnt; /* # of extent node in rb-tree*/
|
||||
bool largest_updated; /* largest extent updated */
|
||||
struct extent_info largest; /* largest cached extent for EX_READ */
|
||||
};
|
||||
|
||||
struct extent_tree_info {
|
||||
struct radix_tree_root extent_tree_root;/* cache extent cache entries */
|
||||
struct mutex extent_tree_lock; /* locking extent radix tree */
|
||||
struct list_head extent_list; /* lru list for shrinker */
|
||||
spinlock_t extent_lock; /* locking extent lru list */
|
||||
atomic_t total_ext_tree; /* extent tree count */
|
||||
struct list_head zombie_list; /* extent zombie tree list */
|
||||
atomic_t total_zombie_tree; /* extent zombie tree count */
|
||||
atomic_t total_ext_node; /* extent info count */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -709,7 +763,8 @@ enum {
|
||||
FI_DROP_CACHE, /* drop dirty page cache */
|
||||
FI_DATA_EXIST, /* indicate data exists */
|
||||
FI_INLINE_DOTS, /* indicate inline dot dentries */
|
||||
FI_DO_DEFRAG, /* indicate defragment is running */
|
||||
FI_SKIP_WRITES, /* should skip data page writeback */
|
||||
FI_OPU_WRITE, /* used for opu per file */
|
||||
FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */
|
||||
FI_NO_PREALLOC, /* indicate skipped preallocated blocks */
|
||||
FI_HOT_DATA, /* indicate file is hot */
|
||||
@@ -746,6 +801,7 @@ struct f2fs_inode_info {
|
||||
unsigned int clevel; /* maximum level of given file name */
|
||||
struct task_struct *task; /* lookup and create consistency */
|
||||
struct task_struct *cp_task; /* separate cp/wb IO stats*/
|
||||
struct task_struct *wb_task; /* indicate inode is in context of writeback */
|
||||
nid_t i_xattr_nid; /* node id that contains xattrs */
|
||||
loff_t last_disk_size; /* lastly written file size */
|
||||
spinlock_t i_size_lock; /* protect last_disk_size */
|
||||
@@ -762,7 +818,8 @@ struct f2fs_inode_info {
|
||||
struct list_head inmem_pages; /* inmemory pages managed by f2fs */
|
||||
struct task_struct *inmem_task; /* store inmemory task */
|
||||
struct mutex inmem_lock; /* lock for inmemory pages */
|
||||
struct extent_tree *extent_tree; /* cached extent_tree entry */
|
||||
struct extent_tree *extent_tree[NR_EXTENT_CACHES];
|
||||
/* cached extent_tree entry */
|
||||
|
||||
/* avoid racing between foreground op and gc */
|
||||
struct f2fs_rwsem i_gc_rwsem[2];
|
||||
@@ -784,7 +841,7 @@ struct f2fs_inode_info {
|
||||
unsigned int i_cluster_size; /* cluster size */
|
||||
};
|
||||
|
||||
static inline void get_extent_info(struct extent_info *ext,
|
||||
static inline void get_read_extent_info(struct extent_info *ext,
|
||||
struct f2fs_extent *i_ext)
|
||||
{
|
||||
ext->fofs = le32_to_cpu(i_ext->fofs);
|
||||
@@ -792,7 +849,7 @@ static inline void get_extent_info(struct extent_info *ext,
|
||||
ext->len = le32_to_cpu(i_ext->len);
|
||||
}
|
||||
|
||||
static inline void set_raw_extent(struct extent_info *ext,
|
||||
static inline void set_raw_read_extent(struct extent_info *ext,
|
||||
struct f2fs_extent *i_ext)
|
||||
{
|
||||
i_ext->fofs = cpu_to_le32(ext->fofs);
|
||||
@@ -800,14 +857,6 @@ static inline void set_raw_extent(struct extent_info *ext,
|
||||
i_ext->len = cpu_to_le32(ext->len);
|
||||
}
|
||||
|
||||
static inline void set_extent_info(struct extent_info *ei, unsigned int fofs,
|
||||
u32 blk, unsigned int len)
|
||||
{
|
||||
ei->fofs = fofs;
|
||||
ei->blk = blk;
|
||||
ei->len = len;
|
||||
}
|
||||
|
||||
static inline bool __is_discard_mergeable(struct discard_info *back,
|
||||
struct discard_info *front, unsigned int max_len)
|
||||
{
|
||||
@@ -827,35 +876,6 @@ static inline bool __is_discard_front_mergeable(struct discard_info *cur,
|
||||
return __is_discard_mergeable(cur, front, max_len);
|
||||
}
|
||||
|
||||
static inline bool __is_extent_mergeable(struct extent_info *back,
|
||||
struct extent_info *front)
|
||||
{
|
||||
return (back->fofs + back->len == front->fofs &&
|
||||
back->blk + back->len == front->blk);
|
||||
}
|
||||
|
||||
static inline bool __is_back_mergeable(struct extent_info *cur,
|
||||
struct extent_info *back)
|
||||
{
|
||||
return __is_extent_mergeable(back, cur);
|
||||
}
|
||||
|
||||
static inline bool __is_front_mergeable(struct extent_info *cur,
|
||||
struct extent_info *front)
|
||||
{
|
||||
return __is_extent_mergeable(cur, front);
|
||||
}
|
||||
|
||||
extern void f2fs_mark_inode_dirty_sync(struct inode *inode, bool sync);
|
||||
static inline void __try_update_largest_extent(struct extent_tree *et,
|
||||
struct extent_node *en)
|
||||
{
|
||||
if (en->ei.len > et->largest.len) {
|
||||
et->largest = en->ei;
|
||||
et->largest_updated = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For free nid management
|
||||
*/
|
||||
@@ -1072,8 +1092,8 @@ enum count_type {
|
||||
*/
|
||||
#define PAGE_TYPE_OF_BIO(type) ((type) > META ? META : (type))
|
||||
enum page_type {
|
||||
DATA,
|
||||
NODE,
|
||||
DATA = 0,
|
||||
NODE = 1, /* should not change this */
|
||||
META,
|
||||
NR_PAGE_TYPE,
|
||||
META_FLUSH,
|
||||
@@ -1163,6 +1183,7 @@ struct f2fs_io_info {
|
||||
bool retry; /* need to reallocate block address */
|
||||
int compr_blocks; /* # of compressed block addresses */
|
||||
bool encrypted; /* indicate file is encrypted */
|
||||
bool post_read; /* require post read */
|
||||
enum iostat_type io_type; /* io type */
|
||||
struct writeback_control *io_wbc; /* writeback control */
|
||||
struct bio **bio; /* bio for ipu */
|
||||
@@ -1247,6 +1268,7 @@ enum {
|
||||
SBI_QUOTA_SKIP_FLUSH, /* skip flushing quota in current CP */
|
||||
SBI_QUOTA_NEED_REPAIR, /* quota file may be corrupted */
|
||||
SBI_IS_RESIZEFS, /* resizefs is in process */
|
||||
SBI_IS_FREEZING, /* freezefs is in process */
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -1312,6 +1334,11 @@ enum {
|
||||
*/
|
||||
};
|
||||
|
||||
enum {
|
||||
MEMORY_MODE_NORMAL, /* memory mode for normal devices */
|
||||
MEMORY_MODE_LOW, /* memory mode for low memry devices */
|
||||
};
|
||||
|
||||
static inline int f2fs_test_bit(unsigned int nr, char *addr);
|
||||
static inline void f2fs_set_bit(unsigned int nr, char *addr);
|
||||
static inline void f2fs_clear_bit(unsigned int nr, char *addr);
|
||||
@@ -1531,6 +1558,7 @@ struct decompress_io_ctx {
|
||||
void *private; /* payload buffer for specified decompression algorithm */
|
||||
void *private2; /* extra payload buffer */
|
||||
struct work_struct verity_work; /* work to verify the decompressed pages */
|
||||
struct work_struct free_work; /* work for late free this structure itself */
|
||||
};
|
||||
|
||||
#define NULL_CLUSTER ((unsigned int)(~0))
|
||||
@@ -1595,14 +1623,13 @@ struct f2fs_sb_info {
|
||||
struct mutex flush_lock; /* for flush exclusion */
|
||||
|
||||
/* for extent tree cache */
|
||||
struct radix_tree_root extent_tree_root;/* cache extent cache entries */
|
||||
struct mutex extent_tree_lock; /* locking extent radix tree */
|
||||
struct list_head extent_list; /* lru list for shrinker */
|
||||
spinlock_t extent_lock; /* locking extent lru list */
|
||||
atomic_t total_ext_tree; /* extent tree count */
|
||||
struct list_head zombie_list; /* extent zombie tree list */
|
||||
atomic_t total_zombie_tree; /* extent zombie tree count */
|
||||
atomic_t total_ext_node; /* extent info count */
|
||||
struct extent_tree_info extent_tree[NR_EXTENT_CACHES];
|
||||
atomic64_t allocated_data_blocks; /* for block age extent_cache */
|
||||
|
||||
/* The threshold used for hot and warm data seperation*/
|
||||
unsigned int hot_data_age_threshold;
|
||||
unsigned int warm_data_age_threshold;
|
||||
unsigned int last_age_weight;
|
||||
|
||||
/* basic filesystem units */
|
||||
unsigned int log_sectors_per_block; /* log2 sectors per block */
|
||||
@@ -1685,10 +1712,14 @@ struct f2fs_sb_info {
|
||||
unsigned int segment_count[2]; /* # of allocated segments */
|
||||
unsigned int block_count[2]; /* # of allocated blocks */
|
||||
atomic_t inplace_count; /* # of inplace update */
|
||||
atomic64_t total_hit_ext; /* # of lookup extent cache */
|
||||
atomic64_t read_hit_rbtree; /* # of hit rbtree extent node */
|
||||
atomic64_t read_hit_largest; /* # of hit largest extent node */
|
||||
atomic64_t read_hit_cached; /* # of hit cached extent node */
|
||||
/* # of lookup extent cache */
|
||||
atomic64_t total_hit_ext[NR_EXTENT_CACHES];
|
||||
/* # of hit rbtree extent node */
|
||||
atomic64_t read_hit_rbtree[NR_EXTENT_CACHES];
|
||||
/* # of hit cached extent node */
|
||||
atomic64_t read_hit_cached[NR_EXTENT_CACHES];
|
||||
/* # of hit largest extent node in read extent cache */
|
||||
atomic64_t read_hit_largest;
|
||||
atomic_t inline_xattr; /* # of inline_xattr inodes */
|
||||
atomic_t inline_inode; /* # of inline_data inodes */
|
||||
atomic_t inline_dir; /* # of inline_dentry inodes */
|
||||
@@ -2481,6 +2512,7 @@ static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi)
|
||||
return le32_to_cpu(F2FS_CKPT(sbi)->cp_pack_start_sum);
|
||||
}
|
||||
|
||||
extern void f2fs_mark_inode_dirty_sync(struct inode *inode, bool sync);
|
||||
static inline int inc_valid_node_count(struct f2fs_sb_info *sbi,
|
||||
struct inode *inode, bool is_inode)
|
||||
{
|
||||
@@ -2561,11 +2593,17 @@ static inline void dec_valid_node_count(struct f2fs_sb_info *sbi,
|
||||
{
|
||||
spin_lock(&sbi->stat_lock);
|
||||
|
||||
f2fs_bug_on(sbi, !sbi->total_valid_block_count);
|
||||
f2fs_bug_on(sbi, !sbi->total_valid_node_count);
|
||||
if (unlikely(!sbi->total_valid_block_count ||
|
||||
!sbi->total_valid_node_count)) {
|
||||
f2fs_warn(sbi, "dec_valid_node_count: inconsistent block counts, total_valid_block:%u, total_valid_node:%u",
|
||||
sbi->total_valid_block_count,
|
||||
sbi->total_valid_node_count);
|
||||
set_sbi_flag(sbi, SBI_NEED_FSCK);
|
||||
} else {
|
||||
sbi->total_valid_block_count--;
|
||||
sbi->total_valid_node_count--;
|
||||
}
|
||||
|
||||
sbi->total_valid_node_count--;
|
||||
sbi->total_valid_block_count--;
|
||||
if (sbi->reserved_blocks &&
|
||||
sbi->current_reserved_blocks < sbi->reserved_blocks)
|
||||
sbi->current_reserved_blocks++;
|
||||
@@ -3477,6 +3515,7 @@ int f2fs_enable_quota_files(struct f2fs_sb_info *sbi, bool rdonly);
|
||||
int f2fs_quota_sync(struct super_block *sb, int type);
|
||||
loff_t max_file_blocks(struct inode *inode);
|
||||
void f2fs_quota_off_umount(struct super_block *sb);
|
||||
void f2fs_handle_stop(struct f2fs_sb_info *sbi, unsigned char reason);
|
||||
int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover);
|
||||
int f2fs_sync_fs(struct super_block *sb, int sync);
|
||||
int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi);
|
||||
@@ -3626,7 +3665,9 @@ unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
|
||||
/*
|
||||
* checkpoint.c
|
||||
*/
|
||||
void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io);
|
||||
void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io,
|
||||
unsigned char reason);
|
||||
void f2fs_flush_ckpt_thread(struct f2fs_sb_info *sbi);
|
||||
struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
|
||||
struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
|
||||
struct page *f2fs_get_meta_page_retry(struct f2fs_sb_info *sbi, pgoff_t index);
|
||||
@@ -3655,7 +3696,8 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi);
|
||||
int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi);
|
||||
void f2fs_update_dirty_page(struct inode *inode, struct page *page);
|
||||
void f2fs_remove_dirty_inode(struct inode *inode);
|
||||
int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type);
|
||||
int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type,
|
||||
bool from_cp);
|
||||
void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type);
|
||||
u64 f2fs_get_sectors_written(struct f2fs_sb_info *sbi);
|
||||
int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc);
|
||||
@@ -3761,9 +3803,19 @@ struct f2fs_stat_info {
|
||||
struct f2fs_sb_info *sbi;
|
||||
int all_area_segs, sit_area_segs, nat_area_segs, ssa_area_segs;
|
||||
int main_area_segs, main_area_sections, main_area_zones;
|
||||
unsigned long long hit_largest, hit_cached, hit_rbtree;
|
||||
unsigned long long hit_total, total_ext;
|
||||
int ext_tree, zombie_tree, ext_node;
|
||||
unsigned long long hit_cached[NR_EXTENT_CACHES];
|
||||
unsigned long long hit_rbtree[NR_EXTENT_CACHES];
|
||||
unsigned long long total_ext[NR_EXTENT_CACHES];
|
||||
unsigned long long hit_total[NR_EXTENT_CACHES];
|
||||
int ext_tree[NR_EXTENT_CACHES];
|
||||
int zombie_tree[NR_EXTENT_CACHES];
|
||||
int ext_node[NR_EXTENT_CACHES];
|
||||
/* to count memory footprint */
|
||||
unsigned long long ext_mem[NR_EXTENT_CACHES];
|
||||
/* for read extent cache */
|
||||
unsigned long long hit_largest;
|
||||
/* for block age extent cache */
|
||||
unsigned long long allocated_data_blocks;
|
||||
int ndirty_node, ndirty_dent, ndirty_meta, ndirty_imeta;
|
||||
int ndirty_data, ndirty_qdata;
|
||||
int inmem_pages;
|
||||
@@ -3824,10 +3876,10 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
|
||||
#define stat_other_skip_bggc_count(sbi) ((sbi)->other_skip_bggc++)
|
||||
#define stat_inc_dirty_inode(sbi, type) ((sbi)->ndirty_inode[type]++)
|
||||
#define stat_dec_dirty_inode(sbi, type) ((sbi)->ndirty_inode[type]--)
|
||||
#define stat_inc_total_hit(sbi) (atomic64_inc(&(sbi)->total_hit_ext))
|
||||
#define stat_inc_rbtree_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_rbtree))
|
||||
#define stat_inc_total_hit(sbi, type) (atomic64_inc(&(sbi)->total_hit_ext[type]))
|
||||
#define stat_inc_rbtree_node_hit(sbi, type) (atomic64_inc(&(sbi)->read_hit_rbtree[type]))
|
||||
#define stat_inc_largest_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_largest))
|
||||
#define stat_inc_cached_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_cached))
|
||||
#define stat_inc_cached_node_hit(sbi, type) (atomic64_inc(&(sbi)->read_hit_cached[type]))
|
||||
#define stat_inc_inline_xattr(inode) \
|
||||
do { \
|
||||
if (f2fs_has_inline_xattr(inode)) \
|
||||
@@ -3953,10 +4005,10 @@ void f2fs_update_sit_info(struct f2fs_sb_info *sbi);
|
||||
#define stat_other_skip_bggc_count(sbi) do { } while (0)
|
||||
#define stat_inc_dirty_inode(sbi, type) do { } while (0)
|
||||
#define stat_dec_dirty_inode(sbi, type) do { } while (0)
|
||||
#define stat_inc_total_hit(sbi) do { } while (0)
|
||||
#define stat_inc_rbtree_node_hit(sbi) do { } while (0)
|
||||
#define stat_inc_total_hit(sbi, type) do { } while (0)
|
||||
#define stat_inc_rbtree_node_hit(sbi, type) do { } while (0)
|
||||
#define stat_inc_largest_node_hit(sbi) do { } while (0)
|
||||
#define stat_inc_cached_node_hit(sbi) do { } while (0)
|
||||
#define stat_inc_cached_node_hit(sbi, type) do { } while (0)
|
||||
#define stat_inc_inline_xattr(inode) do { } while (0)
|
||||
#define stat_dec_inline_xattr(inode) do { } while (0)
|
||||
#define stat_inc_inline_inode(inode) do { } while (0)
|
||||
@@ -4003,6 +4055,7 @@ extern struct kmem_cache *f2fs_inode_entry_slab;
|
||||
* inline.c
|
||||
*/
|
||||
bool f2fs_may_inline_data(struct inode *inode);
|
||||
bool f2fs_sanity_check_inline_data(struct inode *inode);
|
||||
bool f2fs_may_inline_dentry(struct inode *inode);
|
||||
void f2fs_do_read_inline_data(struct page *page, struct page *ipage);
|
||||
void f2fs_truncate_inline_inode(struct inode *inode,
|
||||
@@ -4060,20 +4113,34 @@ struct rb_entry *f2fs_lookup_rb_tree_ret(struct rb_root_cached *root,
|
||||
bool force, bool *leftmost);
|
||||
bool f2fs_check_rb_tree_consistence(struct f2fs_sb_info *sbi,
|
||||
struct rb_root_cached *root, bool check_key);
|
||||
unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *sbi, int nr_shrink);
|
||||
void f2fs_init_extent_tree(struct inode *inode, struct page *ipage);
|
||||
void f2fs_init_extent_tree(struct inode *inode);
|
||||
void f2fs_drop_extent_tree(struct inode *inode);
|
||||
unsigned int f2fs_destroy_extent_node(struct inode *inode);
|
||||
void f2fs_destroy_extent_node(struct inode *inode);
|
||||
void f2fs_destroy_extent_tree(struct inode *inode);
|
||||
bool f2fs_lookup_extent_cache(struct inode *inode, pgoff_t pgofs,
|
||||
struct extent_info *ei);
|
||||
void f2fs_update_extent_cache(struct dnode_of_data *dn);
|
||||
void f2fs_update_extent_cache_range(struct dnode_of_data *dn,
|
||||
pgoff_t fofs, block_t blkaddr, unsigned int len);
|
||||
void f2fs_init_extent_cache_info(struct f2fs_sb_info *sbi);
|
||||
int __init f2fs_create_extent_cache(void);
|
||||
void f2fs_destroy_extent_cache(void);
|
||||
|
||||
/* read extent cache ops */
|
||||
void f2fs_init_read_extent_tree(struct inode *inode, struct page *ipage);
|
||||
bool f2fs_lookup_read_extent_cache(struct inode *inode, pgoff_t pgofs,
|
||||
struct extent_info *ei);
|
||||
void f2fs_update_read_extent_cache(struct dnode_of_data *dn);
|
||||
void f2fs_update_read_extent_cache_range(struct dnode_of_data *dn,
|
||||
pgoff_t fofs, block_t blkaddr, unsigned int len);
|
||||
unsigned int f2fs_shrink_read_extent_tree(struct f2fs_sb_info *sbi,
|
||||
int nr_shrink);
|
||||
|
||||
/* block age extent cache ops */
|
||||
void f2fs_init_age_extent_tree(struct inode *inode);
|
||||
bool f2fs_lookup_age_extent_cache(struct inode *inode, pgoff_t pgofs,
|
||||
struct extent_info *ei);
|
||||
void f2fs_update_age_extent_cache(struct dnode_of_data *dn);
|
||||
void f2fs_update_age_extent_cache_range(struct dnode_of_data *dn,
|
||||
pgoff_t fofs, unsigned int len);
|
||||
unsigned int f2fs_shrink_age_extent_tree(struct f2fs_sb_info *sbi,
|
||||
int nr_shrink);
|
||||
|
||||
/*
|
||||
* sysfs.c
|
||||
*/
|
||||
@@ -4126,9 +4193,9 @@ void f2fs_compress_write_end_io(struct bio *bio, struct page *page);
|
||||
bool f2fs_is_compress_backend_ready(struct inode *inode);
|
||||
int f2fs_init_compress_mempool(void);
|
||||
void f2fs_destroy_compress_mempool(void);
|
||||
void f2fs_decompress_cluster(struct decompress_io_ctx *dic);
|
||||
void f2fs_decompress_cluster(struct decompress_io_ctx *dic, bool in_task);
|
||||
void f2fs_end_read_compressed_page(struct page *page, bool failed,
|
||||
block_t blkaddr);
|
||||
block_t blkaddr, bool in_task);
|
||||
bool f2fs_cluster_is_empty(struct compress_ctx *cc);
|
||||
bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index);
|
||||
void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page);
|
||||
@@ -4137,12 +4204,17 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
|
||||
struct writeback_control *wbc,
|
||||
enum iostat_type io_type);
|
||||
int f2fs_is_compressed_cluster(struct inode *inode, pgoff_t index);
|
||||
void f2fs_update_read_extent_tree_range_compressed(struct inode *inode,
|
||||
pgoff_t fofs, block_t blkaddr,
|
||||
unsigned int llen, unsigned int c_len);
|
||||
int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
|
||||
unsigned nr_pages, sector_t *last_block_in_bio,
|
||||
bool is_readahead, bool for_write);
|
||||
struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc);
|
||||
void f2fs_decompress_end_io(struct decompress_io_ctx *dic, bool failed);
|
||||
void f2fs_put_page_dic(struct page *page);
|
||||
void f2fs_decompress_end_io(struct decompress_io_ctx *dic, bool failed,
|
||||
bool in_task);
|
||||
void f2fs_put_page_dic(struct page *page, bool in_task);
|
||||
unsigned int f2fs_cluster_blocks_are_contiguous(struct dnode_of_data *dn);
|
||||
int f2fs_init_compress_ctx(struct compress_ctx *cc);
|
||||
void f2fs_destroy_compress_ctx(struct compress_ctx *cc, bool reuse);
|
||||
void f2fs_init_compress_info(struct f2fs_sb_info *sbi);
|
||||
@@ -4187,16 +4259,18 @@ static inline struct page *f2fs_compress_control_page(struct page *page)
|
||||
}
|
||||
static inline int f2fs_init_compress_mempool(void) { return 0; }
|
||||
static inline void f2fs_destroy_compress_mempool(void) { }
|
||||
static inline void f2fs_decompress_cluster(struct decompress_io_ctx *dic) { }
|
||||
static inline void f2fs_decompress_cluster(struct decompress_io_ctx *dic,
|
||||
bool in_task) { }
|
||||
static inline void f2fs_end_read_compressed_page(struct page *page,
|
||||
bool failed, block_t blkaddr)
|
||||
bool failed, block_t blkaddr, bool in_task)
|
||||
{
|
||||
WARN_ON_ONCE(1);
|
||||
}
|
||||
static inline void f2fs_put_page_dic(struct page *page)
|
||||
static inline void f2fs_put_page_dic(struct page *page, bool in_task)
|
||||
{
|
||||
WARN_ON_ONCE(1);
|
||||
}
|
||||
static inline unsigned int f2fs_cluster_blocks_are_contiguous(struct dnode_of_data *dn) { return 0; }
|
||||
static inline int f2fs_init_compress_inode(struct f2fs_sb_info *sbi) { return 0; }
|
||||
static inline void f2fs_destroy_compress_inode(struct f2fs_sb_info *sbi) { }
|
||||
static inline int f2fs_init_page_array_cache(struct f2fs_sb_info *sbi) { return 0; }
|
||||
@@ -4212,10 +4286,15 @@ static inline bool f2fs_load_compressed_page(struct f2fs_sb_info *sbi,
|
||||
static inline void f2fs_invalidate_compress_pages(struct f2fs_sb_info *sbi,
|
||||
nid_t ino) { }
|
||||
#define inc_compr_inode_stat(inode) do { } while (0)
|
||||
static inline void f2fs_update_read_extent_tree_range_compressed(
|
||||
struct inode *inode,
|
||||
pgoff_t fofs, block_t blkaddr,
|
||||
unsigned int llen, unsigned int c_len) { }
|
||||
#endif
|
||||
|
||||
static inline void set_compress_context(struct inode *inode)
|
||||
static inline int set_compress_context(struct inode *inode)
|
||||
{
|
||||
#ifdef CONFIG_F2FS_FS_COMPRESSION
|
||||
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
||||
|
||||
F2FS_I(inode)->i_compress_algorithm =
|
||||
@@ -4237,6 +4316,10 @@ static inline void set_compress_context(struct inode *inode)
|
||||
stat_inc_compr_inode(inode);
|
||||
inc_compr_inode_stat(inode);
|
||||
f2fs_mark_inode_dirty_sync(inode, true);
|
||||
return 0;
|
||||
#else
|
||||
return -EOPNOTSUPP;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool f2fs_disable_compressed_file(struct inode *inode)
|
||||
@@ -4276,26 +4359,6 @@ F2FS_FEATURE_FUNCS(casefold, CASEFOLD);
|
||||
F2FS_FEATURE_FUNCS(compression, COMPRESSION);
|
||||
F2FS_FEATURE_FUNCS(readonly, RO);
|
||||
|
||||
static inline bool f2fs_may_extent_tree(struct inode *inode)
|
||||
{
|
||||
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
||||
|
||||
if (!test_opt(sbi, EXTENT_CACHE) ||
|
||||
is_inode_flag_set(inode, FI_NO_EXTENT) ||
|
||||
(is_inode_flag_set(inode, FI_COMPRESSED_FILE) &&
|
||||
!f2fs_sb_has_readonly(sbi)))
|
||||
return false;
|
||||
|
||||
/*
|
||||
* for recovered files during mount do not create extents
|
||||
* if shrinker is not registered.
|
||||
*/
|
||||
if (list_empty(&sbi->s_list))
|
||||
return false;
|
||||
|
||||
return S_ISREG(inode->i_mode);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_ZONED
|
||||
static inline bool f2fs_blkz_is_seq(struct f2fs_sb_info *sbi, int devi,
|
||||
block_t blkaddr)
|
||||
@@ -4354,6 +4417,11 @@ static inline bool f2fs_lfs_mode(struct f2fs_sb_info *sbi)
|
||||
return F2FS_OPTION(sbi).fs_mode == FS_MODE_LFS;
|
||||
}
|
||||
|
||||
static inline bool f2fs_low_mem_mode(struct f2fs_sb_info *sbi)
|
||||
{
|
||||
return F2FS_OPTION(sbi).memory_mode == MEMORY_MODE_LOW;
|
||||
}
|
||||
|
||||
static inline bool f2fs_may_compress(struct inode *inode)
|
||||
{
|
||||
if (IS_SWAPFILE(inode) || f2fs_is_pinned_file(inode) ||
|
||||
|
||||
Reference in New Issue
Block a user