Lines Matching full:sbi
35 #define f2fs_bug_on(sbi, condition) BUG_ON(condition) argument
37 #define f2fs_bug_on(sbi, condition) \ argument
40 set_sbi_flag(sbi, SBI_NEED_FSCK); \
119 #define F2FS_OPTION(sbi) ((sbi)->mount_opt) argument
120 #define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) argument
121 #define set_opt(sbi, option) (F2FS_OPTION(sbi).opt |= F2FS_MOUNT_##option) argument
122 #define test_opt(sbi, option) (F2FS_OPTION(sbi).opt & F2FS_MOUNT_##option) argument
219 #define F2FS_HAS_FEATURE(sbi, mask) __F2FS_HAS_FEATURE(sbi->raw_super, mask) argument
670 struct list_head list; /* node in global extent list of sbi */
679 struct list_head list; /* to be used by sbi->zombie_list */
1206 struct f2fs_sb_info *sbi; /* f2fs_sb_info pointer */ member
1239 struct f2fs_sb_info *sbi; /* f2fs superblock */ member
1255 #define FDEV(i) (sbi->devs[i])
1566 unsigned long s_flag; /* flags for sbi */
1835 #define SEGS_TO_BLKS(sbi, segs) \ argument
1836 ((segs) << (sbi)->log_blocks_per_seg)
1837 #define BLKS_TO_SEGS(sbi, blks) \ argument
1838 ((blks) >> (sbi)->log_blocks_per_seg)
1840 #define BLKS_PER_SEG(sbi) ((sbi)->blocks_per_seg) argument
1841 #define BLKS_PER_SEC(sbi) (SEGS_TO_BLKS(sbi, (sbi)->segs_per_sec)) argument
1842 #define SEGS_PER_SEC(sbi) ((sbi)->segs_per_sec) argument
1845 void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate, const char *fmt, ...);
1847 #define f2fs_err(sbi, fmt, ...) \ argument
1848 f2fs_printk(sbi, false, KERN_ERR fmt, ##__VA_ARGS__)
1849 #define f2fs_warn(sbi, fmt, ...) \ argument
1850 f2fs_printk(sbi, false, KERN_WARNING fmt, ##__VA_ARGS__)
1851 #define f2fs_notice(sbi, fmt, ...) \ argument
1852 f2fs_printk(sbi, false, KERN_NOTICE fmt, ##__VA_ARGS__)
1853 #define f2fs_info(sbi, fmt, ...) \ argument
1854 f2fs_printk(sbi, false, KERN_INFO fmt, ##__VA_ARGS__)
1855 #define f2fs_debug(sbi, fmt, ...) \ argument
1856 f2fs_printk(sbi, false, KERN_DEBUG fmt, ##__VA_ARGS__)
1858 #define f2fs_err_ratelimited(sbi, fmt, ...) \ argument
1859 f2fs_printk(sbi, true, KERN_ERR fmt, ##__VA_ARGS__)
1860 #define f2fs_warn_ratelimited(sbi, fmt, ...) \ argument
1861 f2fs_printk(sbi, true, KERN_WARNING fmt, ##__VA_ARGS__)
1862 #define f2fs_info_ratelimited(sbi, fmt, ...) \ argument
1863 f2fs_printk(sbi, true, KERN_INFO fmt, ##__VA_ARGS__)
1866 #define time_to_inject(sbi, type) __time_to_inject(sbi, type, __func__, \ argument
1868 static inline bool __time_to_inject(struct f2fs_sb_info *sbi, int type, in __time_to_inject() argument
1871 struct f2fs_fault_info *ffi = &F2FS_OPTION(sbi).fault_info; in __time_to_inject()
1882 f2fs_info_ratelimited(sbi, "inject %s in %s of %pS", in __time_to_inject()
1889 static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type) in time_to_inject() argument
1897 * - For a single regular disk volume, sbi->s_ndevs is 0.
1898 * - For a single zoned disk volume, sbi->s_ndevs is 1.
1899 * - For a multi-device volume, sbi->s_ndevs is always 2 or more.
1901 static inline bool f2fs_is_multi_device(struct f2fs_sb_info *sbi) in f2fs_is_multi_device() argument
1903 return sbi->s_ndevs > 1; in f2fs_is_multi_device()
1906 static inline void f2fs_update_time(struct f2fs_sb_info *sbi, int type) in f2fs_update_time() argument
1910 sbi->last_time[type] = now; in f2fs_update_time()
1914 sbi->last_time[DISCARD_TIME] = now; in f2fs_update_time()
1915 sbi->last_time[GC_TIME] = now; in f2fs_update_time()
1919 static inline bool f2fs_time_over(struct f2fs_sb_info *sbi, int type) in f2fs_time_over() argument
1921 unsigned long interval = sbi->interval_time[type] * HZ; in f2fs_time_over()
1923 return time_after(jiffies, sbi->last_time[type] + interval); in f2fs_time_over()
1926 static inline unsigned int f2fs_time_to_wait(struct f2fs_sb_info *sbi, in f2fs_time_to_wait() argument
1929 unsigned long interval = sbi->interval_time[type] * HZ; in f2fs_time_to_wait()
1933 delta = (sbi->last_time[type] + interval) - jiffies; in f2fs_time_to_wait()
1943 static inline u32 __f2fs_crc32(struct f2fs_sb_info *sbi, u32 crc, in __f2fs_crc32() argument
1952 BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver) != sizeof(desc.ctx)); in __f2fs_crc32()
1954 desc.shash.tfm = sbi->s_chksum_driver; in __f2fs_crc32()
1963 static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, in f2fs_crc32() argument
1966 return __f2fs_crc32(sbi, F2FS_SUPER_MAGIC, address, length); in f2fs_crc32()
1969 static inline bool f2fs_crc_valid(struct f2fs_sb_info *sbi, __u32 blk_crc, in f2fs_crc_valid() argument
1972 return f2fs_crc32(sbi, buf, buf_size) == blk_crc; in f2fs_crc_valid()
1975 static inline u32 f2fs_chksum(struct f2fs_sb_info *sbi, u32 crc, in f2fs_chksum() argument
1978 return __f2fs_crc32(sbi, crc, address, length); in f2fs_chksum()
2006 static inline struct f2fs_super_block *F2FS_RAW_SUPER(struct f2fs_sb_info *sbi) in F2FS_RAW_SUPER() argument
2008 return (struct f2fs_super_block *)(sbi->raw_super); in F2FS_RAW_SUPER()
2021 static inline struct f2fs_checkpoint *F2FS_CKPT(struct f2fs_sb_info *sbi) in F2FS_CKPT() argument
2023 return (struct f2fs_checkpoint *)(sbi->ckpt); in F2FS_CKPT()
2036 static inline struct f2fs_nm_info *NM_I(struct f2fs_sb_info *sbi) in NM_I() argument
2038 return (struct f2fs_nm_info *)(sbi->nm_info); in NM_I()
2041 static inline struct f2fs_sm_info *SM_I(struct f2fs_sb_info *sbi) in SM_I() argument
2043 return (struct f2fs_sm_info *)(sbi->sm_info); in SM_I()
2046 static inline struct sit_info *SIT_I(struct f2fs_sb_info *sbi) in SIT_I() argument
2048 return (struct sit_info *)(SM_I(sbi)->sit_info); in SIT_I()
2051 static inline struct free_segmap_info *FREE_I(struct f2fs_sb_info *sbi) in FREE_I() argument
2053 return (struct free_segmap_info *)(SM_I(sbi)->free_info); in FREE_I()
2056 static inline struct dirty_seglist_info *DIRTY_I(struct f2fs_sb_info *sbi) in DIRTY_I() argument
2058 return (struct dirty_seglist_info *)(SM_I(sbi)->dirty_info); in DIRTY_I()
2061 static inline struct address_space *META_MAPPING(struct f2fs_sb_info *sbi) in META_MAPPING() argument
2063 return sbi->meta_inode->i_mapping; in META_MAPPING()
2066 static inline struct address_space *NODE_MAPPING(struct f2fs_sb_info *sbi) in NODE_MAPPING() argument
2068 return sbi->node_inode->i_mapping; in NODE_MAPPING()
2071 static inline bool is_sbi_flag_set(struct f2fs_sb_info *sbi, unsigned int type) in is_sbi_flag_set() argument
2073 return test_bit(type, &sbi->s_flag); in is_sbi_flag_set()
2076 static inline void set_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type) in set_sbi_flag() argument
2078 set_bit(type, &sbi->s_flag); in set_sbi_flag()
2081 static inline void clear_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type) in clear_sbi_flag() argument
2083 clear_bit(type, &sbi->s_flag); in clear_sbi_flag()
2111 static inline bool is_set_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f) in is_set_ckpt_flags() argument
2113 return __is_set_ckpt_flags(F2FS_CKPT(sbi), f); in is_set_ckpt_flags()
2125 static inline void set_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f) in set_ckpt_flags() argument
2129 spin_lock_irqsave(&sbi->cp_lock, flags); in set_ckpt_flags()
2130 __set_ckpt_flags(F2FS_CKPT(sbi), f); in set_ckpt_flags()
2131 spin_unlock_irqrestore(&sbi->cp_lock, flags); in set_ckpt_flags()
2143 static inline void clear_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f) in clear_ckpt_flags() argument
2147 spin_lock_irqsave(&sbi->cp_lock, flags); in clear_ckpt_flags()
2148 __clear_ckpt_flags(F2FS_CKPT(sbi), f); in clear_ckpt_flags()
2149 spin_unlock_irqrestore(&sbi->cp_lock, flags); in clear_ckpt_flags()
2230 static inline void f2fs_lock_op(struct f2fs_sb_info *sbi) in f2fs_lock_op() argument
2232 f2fs_down_read(&sbi->cp_rwsem); in f2fs_lock_op()
2235 static inline int f2fs_trylock_op(struct f2fs_sb_info *sbi) in f2fs_trylock_op() argument
2237 if (time_to_inject(sbi, FAULT_LOCK_OP)) in f2fs_trylock_op()
2239 return f2fs_down_read_trylock(&sbi->cp_rwsem); in f2fs_trylock_op()
2242 static inline void f2fs_unlock_op(struct f2fs_sb_info *sbi) in f2fs_unlock_op() argument
2244 f2fs_up_read(&sbi->cp_rwsem); in f2fs_unlock_op()
2247 static inline void f2fs_lock_all(struct f2fs_sb_info *sbi) in f2fs_lock_all() argument
2249 f2fs_down_write(&sbi->cp_rwsem); in f2fs_lock_all()
2252 static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi) in f2fs_unlock_all() argument
2254 f2fs_up_write(&sbi->cp_rwsem); in f2fs_unlock_all()
2257 static inline int __get_cp_reason(struct f2fs_sb_info *sbi) in __get_cp_reason() argument
2261 if (test_opt(sbi, FASTBOOT)) in __get_cp_reason()
2263 if (is_sbi_flag_set(sbi, SBI_IS_CLOSE)) in __get_cp_reason()
2273 static inline bool __exist_node_summaries(struct f2fs_sb_info *sbi) in __exist_node_summaries() argument
2275 return (is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG) || in __exist_node_summaries()
2276 is_set_ckpt_flags(sbi, CP_FASTBOOT_FLAG)); in __exist_node_summaries()
2294 static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi, in __allow_reserved_blocks() argument
2299 if (!test_opt(sbi, RESERVE_ROOT)) in __allow_reserved_blocks()
2303 if (uid_eq(F2FS_OPTION(sbi).s_resuid, current_fsuid())) in __allow_reserved_blocks()
2305 if (!gid_eq(F2FS_OPTION(sbi).s_resgid, GLOBAL_ROOT_GID) && in __allow_reserved_blocks()
2306 in_group_p(F2FS_OPTION(sbi).s_resgid)) in __allow_reserved_blocks()
2313 static inline unsigned int get_available_block_count(struct f2fs_sb_info *sbi, in get_available_block_count() argument
2318 avail_user_block_count = sbi->user_block_count - in get_available_block_count()
2319 sbi->current_reserved_blocks; in get_available_block_count()
2321 if (!__allow_reserved_blocks(sbi, inode, cap)) in get_available_block_count()
2322 avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks; in get_available_block_count()
2324 if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { in get_available_block_count()
2325 if (avail_user_block_count > sbi->unusable_block_count) in get_available_block_count()
2326 avail_user_block_count -= sbi->unusable_block_count; in get_available_block_count()
2335 static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, in inc_valid_block_count() argument
2346 if (time_to_inject(sbi, FAULT_BLOCK)) { in inc_valid_block_count()
2355 percpu_counter_add(&sbi->alloc_valid_block_count, (*count)); in inc_valid_block_count()
2357 spin_lock(&sbi->stat_lock); in inc_valid_block_count()
2359 avail_user_block_count = get_available_block_count(sbi, inode, true); in inc_valid_block_count()
2360 diff = (long long)sbi->total_valid_block_count + *count - in inc_valid_block_count()
2364 spin_unlock(&sbi->stat_lock); in inc_valid_block_count()
2373 spin_unlock(&sbi->stat_lock); in inc_valid_block_count()
2377 sbi->total_valid_block_count += (block_t)(*count); in inc_valid_block_count()
2379 spin_unlock(&sbi->stat_lock); in inc_valid_block_count()
2382 percpu_counter_sub(&sbi->alloc_valid_block_count, release); in inc_valid_block_count()
2389 percpu_counter_sub(&sbi->alloc_valid_block_count, release); in inc_valid_block_count()
2470 static inline void dec_valid_block_count(struct f2fs_sb_info *sbi, in dec_valid_block_count() argument
2476 spin_lock(&sbi->stat_lock); in dec_valid_block_count()
2477 f2fs_bug_on(sbi, sbi->total_valid_block_count < (block_t) count); in dec_valid_block_count()
2478 sbi->total_valid_block_count -= (block_t)count; in dec_valid_block_count()
2479 if (sbi->reserved_blocks && in dec_valid_block_count()
2480 sbi->current_reserved_blocks < sbi->reserved_blocks) in dec_valid_block_count()
2481 sbi->current_reserved_blocks = min(sbi->reserved_blocks, in dec_valid_block_count()
2482 sbi->current_reserved_blocks + count); in dec_valid_block_count()
2483 spin_unlock(&sbi->stat_lock); in dec_valid_block_count()
2485 f2fs_warn(sbi, "Inconsistent i_blocks, ino:%lu, iblocks:%llu, sectors:%llu", in dec_valid_block_count()
2489 set_sbi_flag(sbi, SBI_NEED_FSCK); in dec_valid_block_count()
2495 static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) in inc_page_count() argument
2497 atomic_inc(&sbi->nr_pages[count_type]); in inc_page_count()
2504 set_sbi_flag(sbi, SBI_IS_DIRTY); in inc_page_count()
2516 static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) in dec_page_count() argument
2518 atomic_dec(&sbi->nr_pages[count_type]); in dec_page_count()
2536 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in inc_atomic_write_cnt() local
2541 atomic64_inc(&sbi->current_atomic_write); in inc_atomic_write_cnt()
2542 current_write = atomic64_read(&sbi->current_atomic_write); in inc_atomic_write_cnt()
2543 if (current_write > sbi->peak_atomic_write) in inc_atomic_write_cnt()
2544 sbi->peak_atomic_write = current_write; in inc_atomic_write_cnt()
2549 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in release_atomic_write_cnt() local
2552 atomic64_sub(fi->atomic_write_cnt, &sbi->current_atomic_write); in release_atomic_write_cnt()
2556 static inline s64 get_pages(struct f2fs_sb_info *sbi, int count_type) in get_pages() argument
2558 return atomic_read(&sbi->nr_pages[count_type]); in get_pages()
2566 static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type) in get_blocktype_secs() argument
2568 return div_u64(get_pages(sbi, block_type) + BLKS_PER_SEC(sbi) - 1, in get_blocktype_secs()
2569 BLKS_PER_SEC(sbi)); in get_blocktype_secs()
2572 static inline block_t valid_user_blocks(struct f2fs_sb_info *sbi) in valid_user_blocks() argument
2574 return sbi->total_valid_block_count; in valid_user_blocks()
2577 static inline block_t discard_blocks(struct f2fs_sb_info *sbi) in discard_blocks() argument
2579 return sbi->discard_blks; in discard_blocks()
2582 static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag) in __bitmap_size() argument
2584 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); in __bitmap_size()
2595 static inline block_t __cp_payload(struct f2fs_sb_info *sbi) in __cp_payload() argument
2597 return le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload); in __cp_payload()
2600 static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag) in __bitmap_ptr() argument
2602 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); in __bitmap_ptr()
2606 if (is_set_ckpt_flags(sbi, CP_LARGE_NAT_BITMAP_FLAG)) { in __bitmap_ptr()
2616 if (__cp_payload(sbi) > 0) { in __bitmap_ptr()
2628 static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi) in __start_cp_addr() argument
2630 block_t start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr); in __start_cp_addr()
2632 if (sbi->cur_cp_pack == 2) in __start_cp_addr()
2633 start_addr += BLKS_PER_SEG(sbi); in __start_cp_addr()
2637 static inline block_t __start_cp_next_addr(struct f2fs_sb_info *sbi) in __start_cp_next_addr() argument
2639 block_t start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr); in __start_cp_next_addr()
2641 if (sbi->cur_cp_pack == 1) in __start_cp_next_addr()
2642 start_addr += BLKS_PER_SEG(sbi); in __start_cp_next_addr()
2646 static inline void __set_cp_next_pack(struct f2fs_sb_info *sbi) in __set_cp_next_pack() argument
2648 sbi->cur_cp_pack = (sbi->cur_cp_pack == 1) ? 2 : 1; in __set_cp_next_pack()
2651 static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi) in __start_sum_addr() argument
2653 return le32_to_cpu(F2FS_CKPT(sbi)->cp_pack_start_sum); in __start_sum_addr()
2657 static inline int inc_valid_node_count(struct f2fs_sb_info *sbi, in inc_valid_node_count() argument
2677 if (time_to_inject(sbi, FAULT_BLOCK)) in inc_valid_node_count()
2680 spin_lock(&sbi->stat_lock); in inc_valid_node_count()
2682 valid_block_count = sbi->total_valid_block_count + 1; in inc_valid_node_count()
2683 avail_user_block_count = get_available_block_count(sbi, inode, false); in inc_valid_node_count()
2686 spin_unlock(&sbi->stat_lock); in inc_valid_node_count()
2690 valid_node_count = sbi->total_valid_node_count + 1; in inc_valid_node_count()
2691 if (unlikely(valid_node_count > sbi->total_node_count)) { in inc_valid_node_count()
2692 spin_unlock(&sbi->stat_lock); in inc_valid_node_count()
2696 sbi->total_valid_node_count++; in inc_valid_node_count()
2697 sbi->total_valid_block_count++; in inc_valid_node_count()
2698 spin_unlock(&sbi->stat_lock); in inc_valid_node_count()
2707 percpu_counter_inc(&sbi->alloc_valid_block_count); in inc_valid_node_count()
2720 static inline void dec_valid_node_count(struct f2fs_sb_info *sbi, in dec_valid_node_count() argument
2723 spin_lock(&sbi->stat_lock); in dec_valid_node_count()
2725 if (unlikely(!sbi->total_valid_block_count || in dec_valid_node_count()
2726 !sbi->total_valid_node_count)) { in dec_valid_node_count()
2727 …f2fs_warn(sbi, "dec_valid_node_count: inconsistent block counts, total_valid_block:%u, total_valid… in dec_valid_node_count()
2728 sbi->total_valid_block_count, in dec_valid_node_count()
2729 sbi->total_valid_node_count); in dec_valid_node_count()
2730 set_sbi_flag(sbi, SBI_NEED_FSCK); in dec_valid_node_count()
2732 sbi->total_valid_block_count--; in dec_valid_node_count()
2733 sbi->total_valid_node_count--; in dec_valid_node_count()
2736 if (sbi->reserved_blocks && in dec_valid_node_count()
2737 sbi->current_reserved_blocks < sbi->reserved_blocks) in dec_valid_node_count()
2738 sbi->current_reserved_blocks++; in dec_valid_node_count()
2740 spin_unlock(&sbi->stat_lock); in dec_valid_node_count()
2746 f2fs_warn(sbi, "dec_valid_node_count: inconsistent i_blocks, ino:%lu, iblocks:%llu", in dec_valid_node_count()
2749 set_sbi_flag(sbi, SBI_NEED_FSCK); in dec_valid_node_count()
2756 static inline unsigned int valid_node_count(struct f2fs_sb_info *sbi) in valid_node_count() argument
2758 return sbi->total_valid_node_count; in valid_node_count()
2761 static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi) in inc_valid_inode_count() argument
2763 percpu_counter_inc(&sbi->total_valid_inode_count); in inc_valid_inode_count()
2766 static inline void dec_valid_inode_count(struct f2fs_sb_info *sbi) in dec_valid_inode_count() argument
2768 percpu_counter_dec(&sbi->total_valid_inode_count); in dec_valid_inode_count()
2771 static inline s64 valid_inode_count(struct f2fs_sb_info *sbi) in valid_inode_count() argument
2773 return percpu_counter_sum_positive(&sbi->total_valid_inode_count); in valid_inode_count()
2855 gfp_t flags, bool nofail, struct f2fs_sb_info *sbi) in f2fs_kmem_cache_alloc() argument
2860 if (time_to_inject(sbi, FAULT_SLAB_ALLOC)) in f2fs_kmem_cache_alloc()
2866 static inline bool is_inflight_io(struct f2fs_sb_info *sbi, int type) in is_inflight_io() argument
2868 if (get_pages(sbi, F2FS_RD_DATA) || get_pages(sbi, F2FS_RD_NODE) || in is_inflight_io()
2869 get_pages(sbi, F2FS_RD_META) || get_pages(sbi, F2FS_WB_DATA) || in is_inflight_io()
2870 get_pages(sbi, F2FS_WB_CP_DATA) || in is_inflight_io()
2871 get_pages(sbi, F2FS_DIO_READ) || in is_inflight_io()
2872 get_pages(sbi, F2FS_DIO_WRITE)) in is_inflight_io()
2875 if (type != DISCARD_TIME && SM_I(sbi) && SM_I(sbi)->dcc_info && in is_inflight_io()
2876 atomic_read(&SM_I(sbi)->dcc_info->queued_discard)) in is_inflight_io()
2879 if (SM_I(sbi) && SM_I(sbi)->fcc_info && in is_inflight_io()
2880 atomic_read(&SM_I(sbi)->fcc_info->queued_flush)) in is_inflight_io()
2885 static inline bool is_inflight_read_io(struct f2fs_sb_info *sbi) in is_inflight_read_io() argument
2887 return get_pages(sbi, F2FS_RD_DATA) || get_pages(sbi, F2FS_DIO_READ); in is_inflight_read_io()
2890 static inline bool is_idle(struct f2fs_sb_info *sbi, int type) in is_idle() argument
2893 F2FS_HAS_FEATURE(sbi, F2FS_FEATURE_BLKZONED)); in is_idle()
2895 if (sbi->gc_mode == GC_URGENT_HIGH) in is_idle()
2899 if (is_inflight_read_io(sbi)) in is_idle()
2902 if (is_inflight_io(sbi, type)) in is_idle()
2906 if (sbi->gc_mode == GC_URGENT_MID) in is_idle()
2909 if (sbi->gc_mode == GC_URGENT_LOW && in is_idle()
2916 return f2fs_time_over(sbi, type); in is_idle()
3382 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in f2fs_skip_inode_update() local
3384 spin_lock(&sbi->inode_lock[DIRTY_META]); in f2fs_skip_inode_update()
3386 spin_unlock(&sbi->inode_lock[DIRTY_META]); in f2fs_skip_inode_update()
3409 static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi) in f2fs_cp_error() argument
3411 return is_set_ckpt_flags(sbi, CP_ERROR_FLAG); in f2fs_cp_error()
3414 static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, in f2fs_kmalloc() argument
3417 if (time_to_inject(sbi, FAULT_KMALLOC)) in f2fs_kmalloc()
3423 static inline void *f2fs_getname(struct f2fs_sb_info *sbi) in f2fs_getname() argument
3425 if (time_to_inject(sbi, FAULT_KMALLOC)) in f2fs_getname()
3436 static inline void *f2fs_kzalloc(struct f2fs_sb_info *sbi, in f2fs_kzalloc() argument
3439 return f2fs_kmalloc(sbi, size, flags | __GFP_ZERO); in f2fs_kzalloc()
3442 static inline void *f2fs_kvmalloc(struct f2fs_sb_info *sbi, in f2fs_kvmalloc() argument
3445 if (time_to_inject(sbi, FAULT_KVMALLOC)) in f2fs_kvmalloc()
3451 static inline void *f2fs_kvzalloc(struct f2fs_sb_info *sbi, in f2fs_kvzalloc() argument
3454 return f2fs_kvmalloc(sbi, size, flags | __GFP_ZERO); in f2fs_kvzalloc()
3483 #define __is_large_section(sbi) (SEGS_PER_SEC(sbi) > 1) argument
3487 bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
3489 static inline void verify_blkaddr(struct f2fs_sb_info *sbi, in verify_blkaddr() argument
3492 if (!f2fs_is_valid_blkaddr(sbi, blkaddr, type)) in verify_blkaddr()
3493 f2fs_err(sbi, "invalid blkaddr: %u, type: %d, run fsck to fix.", in verify_blkaddr()
3518 int f2fs_do_shutdown(struct f2fs_sb_info *sbi, unsigned int flag,
3533 bool f2fs_inode_chksum_verify(struct f2fs_sb_info *sbi, struct page *page);
3534 void f2fs_inode_chksum_set(struct f2fs_sb_info *sbi, struct page *page);
3537 int f2fs_try_to_free_nats(struct f2fs_sb_info *sbi, int nr_shrink);
3547 int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name,
3630 int f2fs_enable_quota_files(struct f2fs_sb_info *sbi, bool rdonly);
3634 void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag);
3635 void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason,
3637 void f2fs_handle_error(struct f2fs_sb_info *sbi, unsigned char error);
3638 void f2fs_handle_error_async(struct f2fs_sb_info *sbi, unsigned char error);
3639 int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover);
3641 int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi);
3653 int f2fs_check_nid_range(struct f2fs_sb_info *sbi, nid_t nid);
3654 bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type);
3655 bool f2fs_in_warm_node_list(struct f2fs_sb_info *sbi, struct page *page);
3656 void f2fs_init_fsync_node_info(struct f2fs_sb_info *sbi);
3657 void f2fs_del_fsync_node_entry(struct f2fs_sb_info *sbi, struct page *page);
3658 void f2fs_reset_fsync_node_info(struct f2fs_sb_info *sbi);
3659 int f2fs_need_dentry_mark(struct f2fs_sb_info *sbi, nid_t nid);
3660 bool f2fs_is_checkpointed_node(struct f2fs_sb_info *sbi, nid_t nid);
3661 bool f2fs_need_inode_block_update(struct f2fs_sb_info *sbi, nid_t ino);
3662 int f2fs_get_node_info(struct f2fs_sb_info *sbi, nid_t nid,
3668 int f2fs_wait_on_node_pages_writeback(struct f2fs_sb_info *sbi,
3670 bool f2fs_nat_bitmap_enabled(struct f2fs_sb_info *sbi);
3674 void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid);
3675 struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid);
3678 void f2fs_flush_inline_data(struct f2fs_sb_info *sbi);
3679 int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
3682 int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
3685 int f2fs_build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount);
3686 bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid);
3687 void f2fs_alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid);
3688 void f2fs_alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid);
3689 int f2fs_try_to_free_nids(struct f2fs_sb_info *sbi, int nr_shrink);
3692 int f2fs_recover_inode_page(struct f2fs_sb_info *sbi, struct page *page);
3693 int f2fs_restore_node_summary(struct f2fs_sb_info *sbi,
3695 void f2fs_enable_nat_bits(struct f2fs_sb_info *sbi);
3696 int f2fs_flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc);
3697 int f2fs_build_node_manager(struct f2fs_sb_info *sbi);
3698 void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi);
3705 bool f2fs_need_SSR(struct f2fs_sb_info *sbi);
3708 void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need);
3709 void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg);
3710 int f2fs_issue_flush(struct f2fs_sb_info *sbi, nid_t ino);
3711 int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi);
3712 int f2fs_flush_device_cache(struct f2fs_sb_info *sbi);
3713 void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free);
3714 void f2fs_invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr);
3715 bool f2fs_is_checkpointed_data(struct f2fs_sb_info *sbi, block_t blkaddr);
3716 int f2fs_start_discard_thread(struct f2fs_sb_info *sbi);
3717 void f2fs_drop_discard_cmd(struct f2fs_sb_info *sbi);
3718 void f2fs_stop_discard_thread(struct f2fs_sb_info *sbi);
3719 bool f2fs_issue_discard_timeout(struct f2fs_sb_info *sbi);
3720 void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
3722 void f2fs_dirty_to_prefree(struct f2fs_sb_info *sbi);
3723 block_t f2fs_get_unusable_blocks(struct f2fs_sb_info *sbi);
3724 int f2fs_disable_cp_again(struct f2fs_sb_info *sbi, block_t unusable);
3725 void f2fs_release_discard_addrs(struct f2fs_sb_info *sbi);
3726 int f2fs_npages_for_summary_flush(struct f2fs_sb_info *sbi, bool for_ra);
3727 bool f2fs_segment_has_free_slot(struct f2fs_sb_info *sbi, int segno);
3728 int f2fs_init_inmem_curseg(struct f2fs_sb_info *sbi);
3729 int f2fs_reinit_atgc_curseg(struct f2fs_sb_info *sbi);
3730 void f2fs_save_inmem_curseg(struct f2fs_sb_info *sbi);
3731 void f2fs_restore_inmem_curseg(struct f2fs_sb_info *sbi);
3732 int f2fs_allocate_segment_for_resize(struct f2fs_sb_info *sbi, int type,
3734 int f2fs_allocate_new_section(struct f2fs_sb_info *sbi, int type, bool force);
3735 int f2fs_allocate_pinning_section(struct f2fs_sb_info *sbi);
3736 int f2fs_allocate_new_segments(struct f2fs_sb_info *sbi);
3737 int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range);
3738 bool f2fs_exist_trim_candidates(struct f2fs_sb_info *sbi,
3740 struct page *f2fs_get_sum_page(struct f2fs_sb_info *sbi, unsigned int segno);
3741 void f2fs_update_meta_page(struct f2fs_sb_info *sbi, void *src,
3743 void f2fs_do_write_meta_page(struct f2fs_sb_info *sbi, struct folio *folio,
3749 void f2fs_do_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
3753 void f2fs_replace_block(struct f2fs_sb_info *sbi, struct dnode_of_data *dn,
3758 int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
3762 void f2fs_update_device_state(struct f2fs_sb_info *sbi, nid_t ino,
3769 void f2fs_write_data_summaries(struct f2fs_sb_info *sbi, block_t start_blk);
3770 void f2fs_write_node_summaries(struct f2fs_sb_info *sbi, block_t start_blk);
3773 void f2fs_flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc);
3774 int f2fs_fix_curseg_write_pointer(struct f2fs_sb_info *sbi);
3775 int f2fs_check_write_pointer(struct f2fs_sb_info *sbi);
3776 int f2fs_build_segment_manager(struct f2fs_sb_info *sbi);
3777 void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi);
3780 int f2fs_rw_hint_to_seg_type(struct f2fs_sb_info *sbi, enum rw_hint hint);
3781 enum rw_hint f2fs_io_type_to_rw_hint(struct f2fs_sb_info *sbi,
3783 unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi);
3784 unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
3791 static inline bool f2fs_need_rand_seg(struct f2fs_sb_info *sbi) in f2fs_need_rand_seg() argument
3793 return F2FS_OPTION(sbi).fs_mode == FS_MODE_FRAGMENT_SEG || in f2fs_need_rand_seg()
3794 F2FS_OPTION(sbi).fs_mode == FS_MODE_FRAGMENT_BLK; in f2fs_need_rand_seg()
3800 void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io,
3802 void f2fs_flush_ckpt_thread(struct f2fs_sb_info *sbi);
3803 struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
3804 struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
3805 struct page *f2fs_get_meta_page_retry(struct f2fs_sb_info *sbi, pgoff_t index);
3806 struct page *f2fs_get_tmp_page(struct f2fs_sb_info *sbi, pgoff_t index);
3807 bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
3809 bool f2fs_is_valid_blkaddr_raw(struct f2fs_sb_info *sbi,
3811 int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
3813 void f2fs_ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index,
3815 long f2fs_sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
3817 void f2fs_add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type);
3818 void f2fs_remove_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type);
3819 void f2fs_release_ino_entry(struct f2fs_sb_info *sbi, bool all);
3820 bool f2fs_exist_written_data(struct f2fs_sb_info *sbi, nid_t ino, int mode);
3821 void f2fs_set_dirty_device(struct f2fs_sb_info *sbi, nid_t ino,
3823 bool f2fs_is_dirty_device(struct f2fs_sb_info *sbi, nid_t ino,
3825 int f2fs_acquire_orphan_inode(struct f2fs_sb_info *sbi);
3826 void f2fs_release_orphan_inode(struct f2fs_sb_info *sbi);
3828 void f2fs_remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino);
3829 int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi);
3830 int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi);
3833 int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type,
3835 void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type);
3836 u64 f2fs_get_sectors_written(struct f2fs_sb_info *sbi);
3837 int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc);
3838 void f2fs_init_ino_entry_info(struct f2fs_sb_info *sbi);
3841 int f2fs_issue_checkpoint(struct f2fs_sb_info *sbi);
3842 int f2fs_start_ckpt_thread(struct f2fs_sb_info *sbi);
3843 void f2fs_stop_ckpt_thread(struct f2fs_sb_info *sbi);
3844 void f2fs_init_ckpt_req_control(struct f2fs_sb_info *sbi);
3854 void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, struct bio *bio,
3856 int f2fs_init_write_merge_io(struct f2fs_sb_info *sbi);
3857 void f2fs_submit_merged_write(struct f2fs_sb_info *sbi, enum page_type type);
3858 void f2fs_submit_merged_write_cond(struct f2fs_sb_info *sbi,
3861 void f2fs_submit_merged_ipu_write(struct f2fs_sb_info *sbi,
3863 void f2fs_flush_merged_writes(struct f2fs_sb_info *sbi);
3867 struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi,
3869 int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr);
3903 int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi);
3904 void f2fs_destroy_post_read_wq(struct f2fs_sb_info *sbi);
3910 int f2fs_start_gc_thread(struct f2fs_sb_info *sbi);
3911 void f2fs_stop_gc_thread(struct f2fs_sb_info *sbi);
3913 int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control);
3914 void f2fs_build_gc_manager(struct f2fs_sb_info *sbi);
3915 int f2fs_gc_range(struct f2fs_sb_info *sbi,
3922 int f2fs_get_victim(struct f2fs_sb_info *sbi, unsigned int *result,
3929 int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only);
3930 bool f2fs_space_for_roll_forward(struct f2fs_sb_info *sbi);
3940 struct f2fs_sb_info *sbi; member
4003 static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) in F2FS_STAT() argument
4005 return (struct f2fs_stat_info *)sbi->stat_info; in F2FS_STAT()
4008 #define stat_inc_cp_call_count(sbi, foreground) \ argument
4009 atomic_inc(&sbi->cp_call_count[(foreground)])
4010 #define stat_inc_cp_count(sbi) (F2FS_STAT(sbi)->cp_count++) argument
4011 #define stat_io_skip_bggc_count(sbi) ((sbi)->io_skip_bggc++) argument
4012 #define stat_other_skip_bggc_count(sbi) ((sbi)->other_skip_bggc++) argument
4013 #define stat_inc_dirty_inode(sbi, type) ((sbi)->ndirty_inode[type]++) argument
4014 #define stat_dec_dirty_inode(sbi, type) ((sbi)->ndirty_inode[type]--) argument
4015 #define stat_inc_total_hit(sbi, type) (atomic64_inc(&(sbi)->total_hit_ext[type])) argument
4016 #define stat_inc_rbtree_node_hit(sbi, type) (atomic64_inc(&(sbi)->read_hit_rbtree[type])) argument
4017 #define stat_inc_largest_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_largest)) argument
4018 #define stat_inc_cached_node_hit(sbi, type) (atomic64_inc(&(sbi)->read_hit_cached[type])) argument
4071 #define stat_inc_meta_count(sbi, blkaddr) \ argument
4073 if (blkaddr < SIT_I(sbi)->sit_base_addr) \
4074 atomic_inc(&(sbi)->meta_count[META_CP]); \
4075 else if (blkaddr < NM_I(sbi)->nat_blkaddr) \
4076 atomic_inc(&(sbi)->meta_count[META_SIT]); \
4077 else if (blkaddr < SM_I(sbi)->ssa_blkaddr) \
4078 atomic_inc(&(sbi)->meta_count[META_NAT]); \
4079 else if (blkaddr < SM_I(sbi)->main_blkaddr) \
4080 atomic_inc(&(sbi)->meta_count[META_SSA]); \
4082 #define stat_inc_seg_type(sbi, curseg) \ argument
4083 ((sbi)->segment_count[(curseg)->alloc_type]++)
4084 #define stat_inc_block_count(sbi, curseg) \ argument
4085 ((sbi)->block_count[(curseg)->alloc_type]++)
4086 #define stat_inc_inplace_blocks(sbi) \ argument
4087 (atomic_inc(&(sbi)->inplace_count))
4095 #define stat_inc_gc_call_count(sbi, foreground) \ argument
4096 (F2FS_STAT(sbi)->gc_call_count[(foreground)]++)
4097 #define stat_inc_gc_sec_count(sbi, type, gc_type) \ argument
4098 (F2FS_STAT(sbi)->gc_secs[(type)][(gc_type)]++)
4099 #define stat_inc_gc_seg_count(sbi, type, gc_type) \ argument
4100 (F2FS_STAT(sbi)->gc_segs[(type)][(gc_type)]++)
4105 #define stat_inc_data_blk_count(sbi, blks, gc_type) \ argument
4107 struct f2fs_stat_info *si = F2FS_STAT(sbi); \
4113 #define stat_inc_node_blk_count(sbi, blks, gc_type) \ argument
4115 struct f2fs_stat_info *si = F2FS_STAT(sbi); \
4121 int f2fs_build_stats(struct f2fs_sb_info *sbi);
4122 void f2fs_destroy_stats(struct f2fs_sb_info *sbi);
4125 void f2fs_update_sit_info(struct f2fs_sb_info *sbi);
4127 #define stat_inc_cp_call_count(sbi, foreground) do { } while (0) argument
4128 #define stat_inc_cp_count(sbi) do { } while (0) argument
4129 #define stat_io_skip_bggc_count(sbi) do { } while (0) argument
4130 #define stat_other_skip_bggc_count(sbi) do { } while (0) argument
4131 #define stat_inc_dirty_inode(sbi, type) do { } while (0) argument
4132 #define stat_dec_dirty_inode(sbi, type) do { } while (0) argument
4133 #define stat_inc_total_hit(sbi, type) do { } while (0) argument
4134 #define stat_inc_rbtree_node_hit(sbi, type) do { } while (0) argument
4135 #define stat_inc_largest_node_hit(sbi) do { } while (0) argument
4136 #define stat_inc_cached_node_hit(sbi, type) do { } while (0) argument
4152 #define stat_inc_meta_count(sbi, blkaddr) do { } while (0) argument
4153 #define stat_inc_seg_type(sbi, curseg) do { } while (0) argument
4154 #define stat_inc_block_count(sbi, curseg) do { } while (0) argument
4155 #define stat_inc_inplace_blocks(sbi) do { } while (0) argument
4156 #define stat_inc_gc_call_count(sbi, foreground) do { } while (0) argument
4157 #define stat_inc_gc_sec_count(sbi, type, gc_type) do { } while (0) argument
4158 #define stat_inc_gc_seg_count(sbi, type, gc_type) do { } while (0) argument
4160 #define stat_inc_data_blk_count(sbi, blks, gc_type) do { } while (0) argument
4161 #define stat_inc_node_blk_count(sbi, blks, gc_type) do { } while (0) argument
4163 static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } in f2fs_build_stats() argument
4164 static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } in f2fs_destroy_stats() argument
4167 static inline void f2fs_update_sit_info(struct f2fs_sb_info *sbi) {} in f2fs_update_sit_info() argument
4221 void f2fs_join_shrinker(struct f2fs_sb_info *sbi);
4222 void f2fs_leave_shrinker(struct f2fs_sb_info *sbi);
4232 void f2fs_init_extent_cache_info(struct f2fs_sb_info *sbi);
4245 unsigned int f2fs_shrink_read_extent_tree(struct f2fs_sb_info *sbi,
4255 unsigned int f2fs_shrink_age_extent_tree(struct f2fs_sb_info *sbi,
4266 int f2fs_register_sysfs(struct f2fs_sb_info *sbi);
4267 void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi);
4358 void f2fs_init_compress_info(struct f2fs_sb_info *sbi);
4359 int f2fs_init_compress_inode(struct f2fs_sb_info *sbi);
4360 void f2fs_destroy_compress_inode(struct f2fs_sb_info *sbi);
4361 int f2fs_init_page_array_cache(struct f2fs_sb_info *sbi);
4362 void f2fs_destroy_page_array_cache(struct f2fs_sb_info *sbi);
4365 struct address_space *COMPRESS_MAPPING(struct f2fs_sb_info *sbi);
4366 void f2fs_invalidate_compress_page(struct f2fs_sb_info *sbi, block_t blkaddr);
4367 void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
4369 bool f2fs_load_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
4371 void f2fs_invalidate_compress_pages(struct f2fs_sb_info *sbi, nid_t ino);
4374 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); \
4375 sbi->compr_new_inode++; \
4379 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); \
4381 sbi->compr_written_block += blocks; \
4382 sbi->compr_saved_block += diff; \
4415 static inline int f2fs_init_compress_inode(struct f2fs_sb_info *sbi) { return 0; } in f2fs_init_compress_inode() argument
4416 static inline void f2fs_destroy_compress_inode(struct f2fs_sb_info *sbi) { } in f2fs_destroy_compress_inode() argument
4417 static inline int f2fs_init_page_array_cache(struct f2fs_sb_info *sbi) { return 0; } in f2fs_init_page_array_cache() argument
4418 static inline void f2fs_destroy_page_array_cache(struct f2fs_sb_info *sbi) { } in f2fs_destroy_page_array_cache() argument
4421 static inline void f2fs_invalidate_compress_page(struct f2fs_sb_info *sbi, in f2fs_invalidate_compress_page() argument
4423 static inline void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi, in f2fs_cache_compressed_page() argument
4425 static inline bool f2fs_load_compressed_page(struct f2fs_sb_info *sbi, in f2fs_load_compressed_page() argument
4427 static inline void f2fs_invalidate_compress_pages(struct f2fs_sb_info *sbi, in f2fs_invalidate_compress_pages() argument
4445 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); in set_compress_context() local
4448 fi->i_compress_algorithm = F2FS_OPTION(sbi).compress_algorithm; in set_compress_context()
4449 fi->i_log_cluster_size = F2FS_OPTION(sbi).compress_log_size; in set_compress_context()
4450 fi->i_compress_flag = F2FS_OPTION(sbi).compress_chksum ? in set_compress_context()
4455 F2FS_OPTION(sbi).compress_level) in set_compress_context()
4456 fi->i_compress_level = F2FS_OPTION(sbi).compress_level; in set_compress_context()
4494 static inline bool f2fs_sb_has_##name(struct f2fs_sb_info *sbi) \
4496 return F2FS_HAS_FEATURE(sbi, F2FS_FEATURE_##flagname); \
4515 static inline bool f2fs_blkz_is_seq(struct f2fs_sb_info *sbi, int devi, in f2fs_blkz_is_seq() argument
4518 unsigned int zno = blkaddr / sbi->blocks_per_blkz; in f2fs_blkz_is_seq()
4524 static inline int f2fs_bdev_index(struct f2fs_sb_info *sbi, in f2fs_bdev_index() argument
4529 if (!f2fs_is_multi_device(sbi)) in f2fs_bdev_index()
4532 for (i = 0; i < sbi->s_ndevs; i++) in f2fs_bdev_index()
4540 static inline bool f2fs_hw_should_discard(struct f2fs_sb_info *sbi) in f2fs_hw_should_discard() argument
4542 return f2fs_sb_has_blkzoned(sbi); in f2fs_hw_should_discard()
4550 static inline bool f2fs_hw_support_discard(struct f2fs_sb_info *sbi) in f2fs_hw_support_discard() argument
4554 if (!f2fs_is_multi_device(sbi)) in f2fs_hw_support_discard()
4555 return f2fs_bdev_support_discard(sbi->sb->s_bdev); in f2fs_hw_support_discard()
4557 for (i = 0; i < sbi->s_ndevs; i++) in f2fs_hw_support_discard()
4563 static inline bool f2fs_realtime_discard_enable(struct f2fs_sb_info *sbi) in f2fs_realtime_discard_enable() argument
4565 return (test_opt(sbi, DISCARD) && f2fs_hw_support_discard(sbi)) || in f2fs_realtime_discard_enable()
4566 f2fs_hw_should_discard(sbi); in f2fs_realtime_discard_enable()
4569 static inline bool f2fs_hw_is_readonly(struct f2fs_sb_info *sbi) in f2fs_hw_is_readonly() argument
4573 if (!f2fs_is_multi_device(sbi)) in f2fs_hw_is_readonly()
4574 return bdev_read_only(sbi->sb->s_bdev); in f2fs_hw_is_readonly()
4576 for (i = 0; i < sbi->s_ndevs; i++) in f2fs_hw_is_readonly()
4582 static inline bool f2fs_dev_is_readonly(struct f2fs_sb_info *sbi) in f2fs_dev_is_readonly() argument
4584 return f2fs_sb_has_readonly(sbi) || f2fs_hw_is_readonly(sbi); in f2fs_dev_is_readonly()
4587 static inline bool f2fs_lfs_mode(struct f2fs_sb_info *sbi) in f2fs_lfs_mode() argument
4589 return F2FS_OPTION(sbi).fs_mode == FS_MODE_LFS; in f2fs_lfs_mode()
4592 static inline bool f2fs_valid_pinned_area(struct f2fs_sb_info *sbi, in f2fs_valid_pinned_area() argument
4595 if (f2fs_sb_has_blkzoned(sbi)) { in f2fs_valid_pinned_area()
4596 int devi = f2fs_target_device_index(sbi, blkaddr); in f2fs_valid_pinned_area()
4603 static inline bool f2fs_low_mem_mode(struct f2fs_sb_info *sbi) in f2fs_low_mem_mode() argument
4605 return F2FS_OPTION(sbi).memory_mode == MEMORY_MODE_LOW; in f2fs_low_mem_mode()
4637 static inline bool f2fs_allow_multi_device_dio(struct f2fs_sb_info *sbi, in f2fs_allow_multi_device_dio() argument
4640 if (!f2fs_is_multi_device(sbi)) in f2fs_allow_multi_device_dio()
4644 return sbi->aligned_blksize; in f2fs_allow_multi_device_dio()
4654 extern int f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned long rate,
4657 static inline int f2fs_build_fault_attr(struct f2fs_sb_info *sbi, in f2fs_build_fault_attr() argument
4664 static inline bool is_journalled_quota(struct f2fs_sb_info *sbi) in is_journalled_quota() argument
4667 if (f2fs_sb_has_quota_ino(sbi)) in is_journalled_quota()
4669 if (F2FS_OPTION(sbi).s_qf_names[USRQUOTA] || in is_journalled_quota()
4670 F2FS_OPTION(sbi).s_qf_names[GRPQUOTA] || in is_journalled_quota()
4671 F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]) in is_journalled_quota()
4677 static inline bool f2fs_block_unit_discard(struct f2fs_sb_info *sbi) in f2fs_block_unit_discard() argument
4679 return F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_BLOCK; in f2fs_block_unit_discard()
4688 static inline void f2fs_handle_page_eio(struct f2fs_sb_info *sbi, in f2fs_handle_page_eio() argument
4693 if (unlikely(f2fs_cp_error(sbi))) in f2fs_handle_page_eio()
4696 if (ofs == sbi->page_eio_ofs[type]) { in f2fs_handle_page_eio()
4697 if (sbi->page_eio_cnt[type]++ == MAX_RETRY_PAGE_EIO) in f2fs_handle_page_eio()
4698 set_ckpt_flags(sbi, CP_ERROR_FLAG); in f2fs_handle_page_eio()
4700 sbi->page_eio_ofs[type] = ofs; in f2fs_handle_page_eio()
4701 sbi->page_eio_cnt[type] = 0; in f2fs_handle_page_eio()
4705 static inline bool f2fs_is_readonly(struct f2fs_sb_info *sbi) in f2fs_is_readonly() argument
4707 return f2fs_sb_has_readonly(sbi) || f2fs_readonly(sbi->sb); in f2fs_is_readonly()
4710 static inline void f2fs_truncate_meta_inode_pages(struct f2fs_sb_info *sbi, in f2fs_truncate_meta_inode_pages() argument
4719 page = find_get_page(META_MAPPING(sbi), blkaddr + i); in f2fs_truncate_meta_inode_pages()
4728 f2fs_submit_merged_write_cond(sbi, sbi->meta_inode, in f2fs_truncate_meta_inode_pages()
4731 truncate_inode_pages_range(META_MAPPING(sbi), in f2fs_truncate_meta_inode_pages()
4736 static inline void f2fs_invalidate_internal_cache(struct f2fs_sb_info *sbi, in f2fs_invalidate_internal_cache() argument
4739 f2fs_truncate_meta_inode_pages(sbi, blkaddr, 1); in f2fs_invalidate_internal_cache()
4740 f2fs_invalidate_compress_page(sbi, blkaddr); in f2fs_invalidate_internal_cache()