f2fs.h (c7d77a7980e434c3af17de19e3348157f9b9ccce) | f2fs.h (67f8cf3cee6f398d05de8333c04fea2ddb59c805) |
---|---|
1/* 2 * fs/f2fs/f2fs.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 5 unchanged lines hidden (view full) --- 14#include <linux/types.h> 15#include <linux/page-flags.h> 16#include <linux/buffer_head.h> 17#include <linux/slab.h> 18#include <linux/crc32.h> 19#include <linux/magic.h> 20#include <linux/kobject.h> 21#include <linux/sched.h> | 1/* 2 * fs/f2fs/f2fs.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 5 unchanged lines hidden (view full) --- 14#include <linux/types.h> 15#include <linux/page-flags.h> 16#include <linux/buffer_head.h> 17#include <linux/slab.h> 18#include <linux/crc32.h> 19#include <linux/magic.h> 20#include <linux/kobject.h> 21#include <linux/sched.h> |
22#include <linux/vmalloc.h> |
|
22#include <linux/bio.h> 23 24#ifdef CONFIG_F2FS_CHECK_FS 25#define f2fs_bug_on(sbi, condition) BUG_ON(condition) 26#define f2fs_down_write(x, y) down_write_nest_lock(x, y) 27#else 28#define f2fs_bug_on(sbi, condition) \ 29 do { \ --- 17 unchanged lines hidden (view full) --- 47#define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000040 48#define F2FS_MOUNT_INLINE_XATTR 0x00000080 49#define F2FS_MOUNT_INLINE_DATA 0x00000100 50#define F2FS_MOUNT_INLINE_DENTRY 0x00000200 51#define F2FS_MOUNT_FLUSH_MERGE 0x00000400 52#define F2FS_MOUNT_NOBARRIER 0x00000800 53#define F2FS_MOUNT_FASTBOOT 0x00001000 54#define F2FS_MOUNT_EXTENT_CACHE 0x00002000 | 23#include <linux/bio.h> 24 25#ifdef CONFIG_F2FS_CHECK_FS 26#define f2fs_bug_on(sbi, condition) BUG_ON(condition) 27#define f2fs_down_write(x, y) down_write_nest_lock(x, y) 28#else 29#define f2fs_bug_on(sbi, condition) \ 30 do { \ --- 17 unchanged lines hidden (view full) --- 48#define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000040 49#define F2FS_MOUNT_INLINE_XATTR 0x00000080 50#define F2FS_MOUNT_INLINE_DATA 0x00000100 51#define F2FS_MOUNT_INLINE_DENTRY 0x00000200 52#define F2FS_MOUNT_FLUSH_MERGE 0x00000400 53#define F2FS_MOUNT_NOBARRIER 0x00000800 54#define F2FS_MOUNT_FASTBOOT 0x00001000 55#define F2FS_MOUNT_EXTENT_CACHE 0x00002000 |
56#define F2FS_MOUNT_FORCE_FG_GC 0x00004000 |
|
55 56#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) 57#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) 58#define test_opt(sbi, option) (sbi->mount_opt.opt & F2FS_MOUNT_##option) 59 60#define ver_after(a, b) (typecheck(unsigned long long, a) && \ 61 typecheck(unsigned long long, b) && \ 62 ((long long)((a) - (b)) > 0)) --- 54 unchanged lines hidden (view full) --- 117 CP_DISCARD, 118}; 119 120#define DEF_BATCHED_TRIM_SECTIONS 32 121#define BATCHED_TRIM_SEGMENTS(sbi) \ 122 (SM_I(sbi)->trim_sections * (sbi)->segs_per_sec) 123#define BATCHED_TRIM_BLOCKS(sbi) \ 124 (BATCHED_TRIM_SEGMENTS(sbi) << (sbi)->log_blocks_per_seg) | 57 58#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) 59#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) 60#define test_opt(sbi, option) (sbi->mount_opt.opt & F2FS_MOUNT_##option) 61 62#define ver_after(a, b) (typecheck(unsigned long long, a) && \ 63 typecheck(unsigned long long, b) && \ 64 ((long long)((a) - (b)) > 0)) --- 54 unchanged lines hidden (view full) --- 119 CP_DISCARD, 120}; 121 122#define DEF_BATCHED_TRIM_SECTIONS 32 123#define BATCHED_TRIM_SEGMENTS(sbi) \ 124 (SM_I(sbi)->trim_sections * (sbi)->segs_per_sec) 125#define BATCHED_TRIM_BLOCKS(sbi) \ 126 (BATCHED_TRIM_SEGMENTS(sbi) << (sbi)->log_blocks_per_seg) |
127#define DEF_CP_INTERVAL 60 /* 60 secs */ |
|
125 126struct cp_control { 127 int reason; 128 __u64 trim_start; 129 __u64 trim_end; 130 __u64 trim_minlen; 131 __u64 trimmed; 132}; --- 92 unchanged lines hidden (view full) --- 225 226#define F2FS_IOCTL_MAGIC 0xf5 227#define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1) 228#define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2) 229#define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3) 230#define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) 231#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) 232#define F2FS_IOC_GARBAGE_COLLECT _IO(F2FS_IOCTL_MAGIC, 6) | 128 129struct cp_control { 130 int reason; 131 __u64 trim_start; 132 __u64 trim_end; 133 __u64 trim_minlen; 134 __u64 trimmed; 135}; --- 92 unchanged lines hidden (view full) --- 228 229#define F2FS_IOCTL_MAGIC 0xf5 230#define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1) 231#define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2) 232#define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3) 233#define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) 234#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) 235#define F2FS_IOC_GARBAGE_COLLECT _IO(F2FS_IOCTL_MAGIC, 6) |
236#define F2FS_IOC_WRITE_CHECKPOINT _IO(F2FS_IOCTL_MAGIC, 7) |
|
233 234#define F2FS_IOC_SET_ENCRYPTION_POLICY \ 235 _IOR('f', 19, struct f2fs_encryption_policy) 236#define F2FS_IOC_GET_ENCRYPTION_PWSALT \ 237 _IOW('f', 20, __u8[16]) 238#define F2FS_IOC_GET_ENCRYPTION_POLICY \ 239 _IOW('f', 21, struct f2fs_encryption_policy) 240 241/* 242 * should be same as XFS_IOC_GOINGDOWN. 243 * Flags for going down operation used by FS_IOC_GOINGDOWN 244 */ 245#define F2FS_IOC_SHUTDOWN _IOR('X', 125, __u32) /* Shutdown */ 246#define F2FS_GOING_DOWN_FULLSYNC 0x0 /* going down with full sync */ 247#define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ 248#define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ | 237 238#define F2FS_IOC_SET_ENCRYPTION_POLICY \ 239 _IOR('f', 19, struct f2fs_encryption_policy) 240#define F2FS_IOC_GET_ENCRYPTION_PWSALT \ 241 _IOW('f', 20, __u8[16]) 242#define F2FS_IOC_GET_ENCRYPTION_POLICY \ 243 _IOW('f', 21, struct f2fs_encryption_policy) 244 245/* 246 * should be same as XFS_IOC_GOINGDOWN. 247 * Flags for going down operation used by FS_IOC_GOINGDOWN 248 */ 249#define F2FS_IOC_SHUTDOWN _IOR('X', 125, __u32) /* Shutdown */ 250#define F2FS_GOING_DOWN_FULLSYNC 0x0 /* going down with full sync */ 251#define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ 252#define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ |
253#define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ |
|
249 250#if defined(__KERNEL__) && defined(CONFIG_COMPAT) 251/* 252 * ioctl commands in 32 bit emulation 253 */ 254#define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS 255#define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS 256#endif --- 230 unchanged lines hidden (view full) --- 487} 488 489static inline bool __is_front_mergeable(struct extent_info *cur, 490 struct extent_info *front) 491{ 492 return __is_extent_mergeable(cur, front); 493} 494 | 254 255#if defined(__KERNEL__) && defined(CONFIG_COMPAT) 256/* 257 * ioctl commands in 32 bit emulation 258 */ 259#define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS 260#define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS 261#endif --- 230 unchanged lines hidden (view full) --- 492} 493 494static inline bool __is_front_mergeable(struct extent_info *cur, 495 struct extent_info *front) 496{ 497 return __is_extent_mergeable(cur, front); 498} 499 |
500static inline void __try_update_largest_extent(struct extent_tree *et, 501 struct extent_node *en) 502{ 503 if (en->ei.len > et->largest.len) 504 et->largest = en->ei; 505} 506 |
|
495struct f2fs_nm_info { 496 block_t nat_blkaddr; /* base disk address of NAT */ 497 nid_t max_nid; /* maximum possible node ids */ 498 nid_t available_nids; /* maximum available node ids */ 499 nid_t next_scan_nid; /* the next nid to be scanned */ 500 unsigned int ram_thresh; /* control the memory footprint */ | 507struct f2fs_nm_info { 508 block_t nat_blkaddr; /* base disk address of NAT */ 509 nid_t max_nid; /* maximum possible node ids */ 510 nid_t available_nids; /* maximum available node ids */ 511 nid_t next_scan_nid; /* the next nid to be scanned */ 512 unsigned int ram_thresh; /* control the memory footprint */ |
513 unsigned int ra_nid_pages; /* # of nid pages to be readaheaded */ |
|
501 502 /* NAT cache management */ 503 struct radix_tree_root nat_root;/* root of the nat entry cache */ 504 struct radix_tree_root nat_set_root;/* root of the nat set cache */ 505 struct rw_semaphore nat_tree_lock; /* protect nat_tree_lock */ 506 struct list_head nat_entries; /* cached nat entry list (clean) */ 507 unsigned int nat_cnt; /* the # of cached nat entries */ 508 unsigned int dirty_nat_cnt; /* total num of nat entries in set */ --- 210 unchanged lines hidden (view full) --- 719 /* for checkpoint */ 720 struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */ 721 struct inode *meta_inode; /* cache meta blocks */ 722 struct mutex cp_mutex; /* checkpoint procedure lock */ 723 struct rw_semaphore cp_rwsem; /* blocking FS operations */ 724 struct rw_semaphore node_write; /* locking node writes */ 725 struct mutex writepages; /* mutex for writepages() */ 726 wait_queue_head_t cp_wait; | 514 515 /* NAT cache management */ 516 struct radix_tree_root nat_root;/* root of the nat entry cache */ 517 struct radix_tree_root nat_set_root;/* root of the nat set cache */ 518 struct rw_semaphore nat_tree_lock; /* protect nat_tree_lock */ 519 struct list_head nat_entries; /* cached nat entry list (clean) */ 520 unsigned int nat_cnt; /* the # of cached nat entries */ 521 unsigned int dirty_nat_cnt; /* total num of nat entries in set */ --- 210 unchanged lines hidden (view full) --- 732 /* for checkpoint */ 733 struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */ 734 struct inode *meta_inode; /* cache meta blocks */ 735 struct mutex cp_mutex; /* checkpoint procedure lock */ 736 struct rw_semaphore cp_rwsem; /* blocking FS operations */ 737 struct rw_semaphore node_write; /* locking node writes */ 738 struct mutex writepages; /* mutex for writepages() */ 739 wait_queue_head_t cp_wait; |
740 long cp_expires, cp_interval; /* next expected periodic cp */ |
|
727 728 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ 729 730 /* for orphan inode, use 0'th array */ 731 unsigned int max_orphans; /* max orphan inodes */ 732 733 /* for directory inode management */ 734 struct list_head dir_inode_list; /* dir inode list */ --- 47 unchanged lines hidden (view full) --- 782 * for stat information. 783 * one is for the LFS mode, and the other is for the SSR mode. 784 */ 785#ifdef CONFIG_F2FS_STAT_FS 786 struct f2fs_stat_info *stat_info; /* FS status information */ 787 unsigned int segment_count[2]; /* # of allocated segments */ 788 unsigned int block_count[2]; /* # of allocated blocks */ 789 atomic_t inplace_count; /* # of inplace update */ | 741 742 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ 743 744 /* for orphan inode, use 0'th array */ 745 unsigned int max_orphans; /* max orphan inodes */ 746 747 /* for directory inode management */ 748 struct list_head dir_inode_list; /* dir inode list */ --- 47 unchanged lines hidden (view full) --- 796 * for stat information. 797 * one is for the LFS mode, and the other is for the SSR mode. 798 */ 799#ifdef CONFIG_F2FS_STAT_FS 800 struct f2fs_stat_info *stat_info; /* FS status information */ 801 unsigned int segment_count[2]; /* # of allocated segments */ 802 unsigned int block_count[2]; /* # of allocated blocks */ 803 atomic_t inplace_count; /* # of inplace update */ |
790 atomic_t total_hit_ext; /* # of lookup extent cache */ 791 atomic_t read_hit_rbtree; /* # of hit rbtree extent node */ 792 atomic_t read_hit_largest; /* # of hit largest extent node */ 793 atomic_t read_hit_cached; /* # of hit cached extent node */ | 804 atomic64_t total_hit_ext; /* # of lookup extent cache */ 805 atomic64_t read_hit_rbtree; /* # of hit rbtree extent node */ 806 atomic64_t read_hit_largest; /* # of hit largest extent node */ 807 atomic64_t read_hit_cached; /* # of hit cached extent node */ |
794 atomic_t inline_xattr; /* # of inline_xattr inodes */ 795 atomic_t inline_inode; /* # of inline_data inodes */ 796 atomic_t inline_dir; /* # of inline_dentry inodes */ 797 int bg_gc; /* background gc calls */ 798 unsigned int n_dirty_dirs; /* # of dir inodes */ 799#endif 800 unsigned int last_victim[2]; /* last victim segment # */ 801 spinlock_t stat_lock; /* lock for stat operations */ --- 413 unchanged lines hidden (view full) --- 1215 spin_unlock(&sbi->stat_lock); 1216} 1217 1218static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi) 1219{ 1220 return sbi->total_valid_inode_count; 1221} 1222 | 808 atomic_t inline_xattr; /* # of inline_xattr inodes */ 809 atomic_t inline_inode; /* # of inline_data inodes */ 810 atomic_t inline_dir; /* # of inline_dentry inodes */ 811 int bg_gc; /* background gc calls */ 812 unsigned int n_dirty_dirs; /* # of dir inodes */ 813#endif 814 unsigned int last_victim[2]; /* last victim segment # */ 815 spinlock_t stat_lock; /* lock for stat operations */ --- 413 unchanged lines hidden (view full) --- 1229 spin_unlock(&sbi->stat_lock); 1230} 1231 1232static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi) 1233{ 1234 return sbi->total_valid_inode_count; 1235} 1236 |
1237static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, 1238 pgoff_t index, bool for_write) 1239{ 1240 if (!for_write) 1241 return grab_cache_page(mapping, index); 1242 return grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS); 1243} 1244 1245static inline void f2fs_copy_page(struct page *src, struct page *dst) 1246{ 1247 char *src_kaddr = kmap(src); 1248 char *dst_kaddr = kmap(dst); 1249 1250 memcpy(dst_kaddr, src_kaddr, PAGE_SIZE); 1251 kunmap(dst); 1252 kunmap(src); 1253} 1254 |
|
1223static inline void f2fs_put_page(struct page *page, int unlock) 1224{ 1225 if (!page) 1226 return; 1227 1228 if (unlock) { 1229 f2fs_bug_on(F2FS_P_SB(page), !PageLocked(page)); 1230 unlock_page(page); --- 343 unchanged lines hidden (view full) --- 1574 1575 if (!test_opt(F2FS_I_SB(inode), EXTENT_CACHE) || 1576 is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT)) 1577 return false; 1578 1579 return S_ISREG(mode); 1580} 1581 | 1255static inline void f2fs_put_page(struct page *page, int unlock) 1256{ 1257 if (!page) 1258 return; 1259 1260 if (unlock) { 1261 f2fs_bug_on(F2FS_P_SB(page), !PageLocked(page)); 1262 unlock_page(page); --- 343 unchanged lines hidden (view full) --- 1606 1607 if (!test_opt(F2FS_I_SB(inode), EXTENT_CACHE) || 1608 is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT)) 1609 return false; 1610 1611 return S_ISREG(mode); 1612} 1613 |
1614static inline void *f2fs_kvmalloc(size_t size, gfp_t flags) 1615{ 1616 void *ret; 1617 1618 ret = kmalloc(size, flags | __GFP_NOWARN); 1619 if (!ret) 1620 ret = __vmalloc(size, flags, PAGE_KERNEL); 1621 return ret; 1622} 1623 1624static inline void *f2fs_kvzalloc(size_t size, gfp_t flags) 1625{ 1626 void *ret; 1627 1628 ret = kzalloc(size, flags | __GFP_NOWARN); 1629 if (!ret) 1630 ret = __vmalloc(size, flags | __GFP_ZERO, PAGE_KERNEL); 1631 return ret; 1632} 1633 |
|
1582#define get_inode_mode(i) \ 1583 ((is_inode_flag_set(F2FS_I(i), FI_ACL_MODE)) ? \ 1584 (F2FS_I(i)->i_acl_mode) : ((i)->i_mode)) 1585 1586/* get offset of first page in next direct node */ 1587#define PGOFS_OF_NEXT_DNODE(pgofs, fi) \ 1588 ((pgofs < ADDRS_PER_INODE(fi)) ? ADDRS_PER_INODE(fi) : \ 1589 (pgofs - ADDRS_PER_INODE(fi) + ADDRS_PER_BLOCK) / \ --- 126 unchanged lines hidden (view full) --- 1716void register_inmem_page(struct inode *, struct page *); 1717int commit_inmem_pages(struct inode *, bool); 1718void f2fs_balance_fs(struct f2fs_sb_info *); 1719void f2fs_balance_fs_bg(struct f2fs_sb_info *); 1720int f2fs_issue_flush(struct f2fs_sb_info *); 1721int create_flush_cmd_control(struct f2fs_sb_info *); 1722void destroy_flush_cmd_control(struct f2fs_sb_info *); 1723void invalidate_blocks(struct f2fs_sb_info *, block_t); | 1634#define get_inode_mode(i) \ 1635 ((is_inode_flag_set(F2FS_I(i), FI_ACL_MODE)) ? \ 1636 (F2FS_I(i)->i_acl_mode) : ((i)->i_mode)) 1637 1638/* get offset of first page in next direct node */ 1639#define PGOFS_OF_NEXT_DNODE(pgofs, fi) \ 1640 ((pgofs < ADDRS_PER_INODE(fi)) ? ADDRS_PER_INODE(fi) : \ 1641 (pgofs - ADDRS_PER_INODE(fi) + ADDRS_PER_BLOCK) / \ --- 126 unchanged lines hidden (view full) --- 1768void register_inmem_page(struct inode *, struct page *); 1769int commit_inmem_pages(struct inode *, bool); 1770void f2fs_balance_fs(struct f2fs_sb_info *); 1771void f2fs_balance_fs_bg(struct f2fs_sb_info *); 1772int f2fs_issue_flush(struct f2fs_sb_info *); 1773int create_flush_cmd_control(struct f2fs_sb_info *); 1774void destroy_flush_cmd_control(struct f2fs_sb_info *); 1775void invalidate_blocks(struct f2fs_sb_info *, block_t); |
1776bool is_checkpointed_data(struct f2fs_sb_info *, block_t); |
|
1724void refresh_sit_entry(struct f2fs_sb_info *, block_t, block_t); 1725void clear_prefree_segments(struct f2fs_sb_info *, struct cp_control *); 1726void release_discard_addrs(struct f2fs_sb_info *); 1727bool discard_next_dnode(struct f2fs_sb_info *, block_t); 1728int npages_for_summary_flush(struct f2fs_sb_info *, bool); 1729void allocate_new_segments(struct f2fs_sb_info *); 1730int f2fs_trim_fs(struct f2fs_sb_info *, struct fstrim_range *); 1731struct page *get_sum_page(struct f2fs_sb_info *, unsigned int); 1732void update_meta_page(struct f2fs_sb_info *, void *, block_t); 1733void write_meta_page(struct f2fs_sb_info *, struct page *); 1734void write_node_page(unsigned int, struct f2fs_io_info *); 1735void write_data_page(struct dnode_of_data *, struct f2fs_io_info *); 1736void rewrite_data_page(struct f2fs_io_info *); 1737void f2fs_replace_block(struct f2fs_sb_info *, struct dnode_of_data *, 1738 block_t, block_t, unsigned char, bool); 1739void allocate_data_block(struct f2fs_sb_info *, struct page *, 1740 block_t, block_t *, struct f2fs_summary *, int); 1741void f2fs_wait_on_page_writeback(struct page *, enum page_type); | 1777void refresh_sit_entry(struct f2fs_sb_info *, block_t, block_t); 1778void clear_prefree_segments(struct f2fs_sb_info *, struct cp_control *); 1779void release_discard_addrs(struct f2fs_sb_info *); 1780bool discard_next_dnode(struct f2fs_sb_info *, block_t); 1781int npages_for_summary_flush(struct f2fs_sb_info *, bool); 1782void allocate_new_segments(struct f2fs_sb_info *); 1783int f2fs_trim_fs(struct f2fs_sb_info *, struct fstrim_range *); 1784struct page *get_sum_page(struct f2fs_sb_info *, unsigned int); 1785void update_meta_page(struct f2fs_sb_info *, void *, block_t); 1786void write_meta_page(struct f2fs_sb_info *, struct page *); 1787void write_node_page(unsigned int, struct f2fs_io_info *); 1788void write_data_page(struct dnode_of_data *, struct f2fs_io_info *); 1789void rewrite_data_page(struct f2fs_io_info *); 1790void f2fs_replace_block(struct f2fs_sb_info *, struct dnode_of_data *, 1791 block_t, block_t, unsigned char, bool); 1792void allocate_data_block(struct f2fs_sb_info *, struct page *, 1793 block_t, block_t *, struct f2fs_summary *, int); 1794void f2fs_wait_on_page_writeback(struct page *, enum page_type); |
1795void f2fs_wait_on_encrypted_page_writeback(struct f2fs_sb_info *, block_t); |
|
1742void write_data_summaries(struct f2fs_sb_info *, block_t); 1743void write_node_summaries(struct f2fs_sb_info *, block_t); 1744int lookup_journal_in_cursum(struct f2fs_summary_block *, 1745 int, unsigned int, int); 1746void flush_sit_entries(struct f2fs_sb_info *, struct cp_control *); 1747int build_segment_manager(struct f2fs_sb_info *); 1748void destroy_segment_manager(struct f2fs_sb_info *); 1749int __init create_segment_manager_caches(void); 1750void destroy_segment_manager_caches(void); 1751 1752/* 1753 * checkpoint.c 1754 */ 1755struct page *grab_meta_page(struct f2fs_sb_info *, pgoff_t); 1756struct page *get_meta_page(struct f2fs_sb_info *, pgoff_t); | 1796void write_data_summaries(struct f2fs_sb_info *, block_t); 1797void write_node_summaries(struct f2fs_sb_info *, block_t); 1798int lookup_journal_in_cursum(struct f2fs_summary_block *, 1799 int, unsigned int, int); 1800void flush_sit_entries(struct f2fs_sb_info *, struct cp_control *); 1801int build_segment_manager(struct f2fs_sb_info *); 1802void destroy_segment_manager(struct f2fs_sb_info *); 1803int __init create_segment_manager_caches(void); 1804void destroy_segment_manager_caches(void); 1805 1806/* 1807 * checkpoint.c 1808 */ 1809struct page *grab_meta_page(struct f2fs_sb_info *, pgoff_t); 1810struct page *get_meta_page(struct f2fs_sb_info *, pgoff_t); |
1811struct page *get_tmp_page(struct f2fs_sb_info *, pgoff_t); |
|
1757bool is_valid_blkaddr(struct f2fs_sb_info *, block_t, int); | 1812bool is_valid_blkaddr(struct f2fs_sb_info *, block_t, int); |
1758int ra_meta_pages(struct f2fs_sb_info *, block_t, int, int); | 1813int ra_meta_pages(struct f2fs_sb_info *, block_t, int, int, bool); |
1759void ra_meta_pages_cond(struct f2fs_sb_info *, pgoff_t); 1760long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long); 1761void add_dirty_inode(struct f2fs_sb_info *, nid_t, int type); 1762void remove_dirty_inode(struct f2fs_sb_info *, nid_t, int type); 1763void release_dirty_inode(struct f2fs_sb_info *); 1764bool exist_written_data(struct f2fs_sb_info *, nid_t, int); 1765int acquire_orphan_inode(struct f2fs_sb_info *); 1766void release_orphan_inode(struct f2fs_sb_info *); --- 15 unchanged lines hidden (view full) --- 1782 */ 1783void f2fs_submit_merged_bio(struct f2fs_sb_info *, enum page_type, int); 1784int f2fs_submit_page_bio(struct f2fs_io_info *); 1785void f2fs_submit_page_mbio(struct f2fs_io_info *); 1786void set_data_blkaddr(struct dnode_of_data *); 1787int reserve_new_block(struct dnode_of_data *); 1788int f2fs_get_block(struct dnode_of_data *, pgoff_t); 1789int f2fs_reserve_block(struct dnode_of_data *, pgoff_t); | 1814void ra_meta_pages_cond(struct f2fs_sb_info *, pgoff_t); 1815long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long); 1816void add_dirty_inode(struct f2fs_sb_info *, nid_t, int type); 1817void remove_dirty_inode(struct f2fs_sb_info *, nid_t, int type); 1818void release_dirty_inode(struct f2fs_sb_info *); 1819bool exist_written_data(struct f2fs_sb_info *, nid_t, int); 1820int acquire_orphan_inode(struct f2fs_sb_info *); 1821void release_orphan_inode(struct f2fs_sb_info *); --- 15 unchanged lines hidden (view full) --- 1837 */ 1838void f2fs_submit_merged_bio(struct f2fs_sb_info *, enum page_type, int); 1839int f2fs_submit_page_bio(struct f2fs_io_info *); 1840void f2fs_submit_page_mbio(struct f2fs_io_info *); 1841void set_data_blkaddr(struct dnode_of_data *); 1842int reserve_new_block(struct dnode_of_data *); 1843int f2fs_get_block(struct dnode_of_data *, pgoff_t); 1844int f2fs_reserve_block(struct dnode_of_data *, pgoff_t); |
1790struct page *get_read_data_page(struct inode *, pgoff_t, int); | 1845struct page *get_read_data_page(struct inode *, pgoff_t, int, bool); |
1791struct page *find_data_page(struct inode *, pgoff_t); | 1846struct page *find_data_page(struct inode *, pgoff_t); |
1792struct page *get_lock_data_page(struct inode *, pgoff_t); | 1847struct page *get_lock_data_page(struct inode *, pgoff_t, bool); |
1793struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool); 1794int do_write_data_page(struct f2fs_io_info *); 1795int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *, u64, u64); 1796void f2fs_invalidate_page(struct page *, unsigned int, unsigned int); 1797int f2fs_release_page(struct page *, gfp_t); 1798 1799/* 1800 * gc.c 1801 */ 1802int start_gc_thread(struct f2fs_sb_info *); 1803void stop_gc_thread(struct f2fs_sb_info *); 1804block_t start_bidx_of_node(unsigned int, struct f2fs_inode_info *); | 1848struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool); 1849int do_write_data_page(struct f2fs_io_info *); 1850int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *, u64, u64); 1851void f2fs_invalidate_page(struct page *, unsigned int, unsigned int); 1852int f2fs_release_page(struct page *, gfp_t); 1853 1854/* 1855 * gc.c 1856 */ 1857int start_gc_thread(struct f2fs_sb_info *); 1858void stop_gc_thread(struct f2fs_sb_info *); 1859block_t start_bidx_of_node(unsigned int, struct f2fs_inode_info *); |
1805int f2fs_gc(struct f2fs_sb_info *); | 1860int f2fs_gc(struct f2fs_sb_info *, bool); |
1806void build_gc_manager(struct f2fs_sb_info *); 1807 1808/* 1809 * recovery.c 1810 */ 1811int recover_fsync_data(struct f2fs_sb_info *); 1812bool space_for_roll_forward(struct f2fs_sb_info *); 1813 1814/* 1815 * debug.c 1816 */ 1817#ifdef CONFIG_F2FS_STAT_FS 1818struct f2fs_stat_info { 1819 struct list_head stat_list; 1820 struct f2fs_sb_info *sbi; 1821 int all_area_segs, sit_area_segs, nat_area_segs, ssa_area_segs; 1822 int main_area_segs, main_area_sections, main_area_zones; | 1861void build_gc_manager(struct f2fs_sb_info *); 1862 1863/* 1864 * recovery.c 1865 */ 1866int recover_fsync_data(struct f2fs_sb_info *); 1867bool space_for_roll_forward(struct f2fs_sb_info *); 1868 1869/* 1870 * debug.c 1871 */ 1872#ifdef CONFIG_F2FS_STAT_FS 1873struct f2fs_stat_info { 1874 struct list_head stat_list; 1875 struct f2fs_sb_info *sbi; 1876 int all_area_segs, sit_area_segs, nat_area_segs, ssa_area_segs; 1877 int main_area_segs, main_area_sections, main_area_zones; |
1823 int hit_largest, hit_cached, hit_rbtree, hit_total, total_ext; | 1878 unsigned long long hit_largest, hit_cached, hit_rbtree; 1879 unsigned long long hit_total, total_ext; |
1824 int ext_tree, ext_node; 1825 int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta; 1826 int nats, dirty_nats, sits, dirty_sits, fnids; 1827 int total_count, utilization; 1828 int bg_gc, inmem_pages, wb_pages; 1829 int inline_xattr, inline_inode, inline_dir; 1830 unsigned int valid_count, valid_node_count, valid_inode_count; 1831 unsigned int bimodal, avg_vblocks; --- 7 unchanged lines hidden (view full) --- 1839 int bg_data_blks, bg_node_blks; 1840 int curseg[NR_CURSEG_TYPE]; 1841 int cursec[NR_CURSEG_TYPE]; 1842 int curzone[NR_CURSEG_TYPE]; 1843 1844 unsigned int segment_count[2]; 1845 unsigned int block_count[2]; 1846 unsigned int inplace_count; | 1880 int ext_tree, ext_node; 1881 int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta; 1882 int nats, dirty_nats, sits, dirty_sits, fnids; 1883 int total_count, utilization; 1884 int bg_gc, inmem_pages, wb_pages; 1885 int inline_xattr, inline_inode, inline_dir; 1886 unsigned int valid_count, valid_node_count, valid_inode_count; 1887 unsigned int bimodal, avg_vblocks; --- 7 unchanged lines hidden (view full) --- 1895 int bg_data_blks, bg_node_blks; 1896 int curseg[NR_CURSEG_TYPE]; 1897 int cursec[NR_CURSEG_TYPE]; 1898 int curzone[NR_CURSEG_TYPE]; 1899 1900 unsigned int segment_count[2]; 1901 unsigned int block_count[2]; 1902 unsigned int inplace_count; |
1847 unsigned base_mem, cache_mem, page_mem; | 1903 unsigned long long base_mem, cache_mem, page_mem; |
1848}; 1849 1850static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) 1851{ 1852 return (struct f2fs_stat_info *)sbi->stat_info; 1853} 1854 1855#define stat_inc_cp_count(si) ((si)->cp_count++) 1856#define stat_inc_call_count(si) ((si)->call_count++) 1857#define stat_inc_bggc_count(sbi) ((sbi)->bg_gc++) 1858#define stat_inc_dirty_dir(sbi) ((sbi)->n_dirty_dirs++) 1859#define stat_dec_dirty_dir(sbi) ((sbi)->n_dirty_dirs--) | 1904}; 1905 1906static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) 1907{ 1908 return (struct f2fs_stat_info *)sbi->stat_info; 1909} 1910 1911#define stat_inc_cp_count(si) ((si)->cp_count++) 1912#define stat_inc_call_count(si) ((si)->call_count++) 1913#define stat_inc_bggc_count(sbi) ((sbi)->bg_gc++) 1914#define stat_inc_dirty_dir(sbi) ((sbi)->n_dirty_dirs++) 1915#define stat_dec_dirty_dir(sbi) ((sbi)->n_dirty_dirs--) |
1860#define stat_inc_total_hit(sbi) (atomic_inc(&(sbi)->total_hit_ext)) 1861#define stat_inc_rbtree_node_hit(sbi) (atomic_inc(&(sbi)->read_hit_rbtree)) 1862#define stat_inc_largest_node_hit(sbi) (atomic_inc(&(sbi)->read_hit_largest)) 1863#define stat_inc_cached_node_hit(sbi) (atomic_inc(&(sbi)->read_hit_cached)) | 1916#define stat_inc_total_hit(sbi) (atomic64_inc(&(sbi)->total_hit_ext)) 1917#define stat_inc_rbtree_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_rbtree)) 1918#define stat_inc_largest_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_largest)) 1919#define stat_inc_cached_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_cached)) |
1864#define stat_inc_inline_xattr(inode) \ 1865 do { \ 1866 if (f2fs_has_inline_xattr(inode)) \ 1867 (atomic_inc(&F2FS_I_SB(inode)->inline_xattr)); \ 1868 } while (0) 1869#define stat_dec_inline_xattr(inode) \ 1870 do { \ 1871 if (f2fs_has_inline_xattr(inode)) \ --- 121 unchanged lines hidden (view full) --- 1993int make_empty_inline_dir(struct inode *inode, struct inode *, struct page *); 1994int f2fs_add_inline_entry(struct inode *, const struct qstr *, struct inode *, 1995 nid_t, umode_t); 1996void f2fs_delete_inline_entry(struct f2fs_dir_entry *, struct page *, 1997 struct inode *, struct inode *); 1998bool f2fs_empty_inline_dir(struct inode *); 1999int f2fs_read_inline_dir(struct file *, struct dir_context *, 2000 struct f2fs_str *); | 1920#define stat_inc_inline_xattr(inode) \ 1921 do { \ 1922 if (f2fs_has_inline_xattr(inode)) \ 1923 (atomic_inc(&F2FS_I_SB(inode)->inline_xattr)); \ 1924 } while (0) 1925#define stat_dec_inline_xattr(inode) \ 1926 do { \ 1927 if (f2fs_has_inline_xattr(inode)) \ --- 121 unchanged lines hidden (view full) --- 2049int make_empty_inline_dir(struct inode *inode, struct inode *, struct page *); 2050int f2fs_add_inline_entry(struct inode *, const struct qstr *, struct inode *, 2051 nid_t, umode_t); 2052void f2fs_delete_inline_entry(struct f2fs_dir_entry *, struct page *, 2053 struct inode *, struct inode *); 2054bool f2fs_empty_inline_dir(struct inode *); 2055int f2fs_read_inline_dir(struct file *, struct dir_context *, 2056 struct f2fs_str *); |
2057int f2fs_inline_data_fiemap(struct inode *, 2058 struct fiemap_extent_info *, __u64, __u64); |
|
2001 2002/* 2003 * shrinker.c 2004 */ 2005unsigned long f2fs_shrink_count(struct shrinker *, struct shrink_control *); 2006unsigned long f2fs_shrink_scan(struct shrinker *, struct shrink_control *); 2007void f2fs_join_shrinker(struct f2fs_sb_info *); 2008void f2fs_leave_shrinker(struct f2fs_sb_info *); --- 148 unchanged lines hidden --- | 2059 2060/* 2061 * shrinker.c 2062 */ 2063unsigned long f2fs_shrink_count(struct shrinker *, struct shrink_control *); 2064unsigned long f2fs_shrink_scan(struct shrinker *, struct shrink_control *); 2065void f2fs_join_shrinker(struct f2fs_sb_info *); 2066void f2fs_leave_shrinker(struct f2fs_sb_info *); --- 148 unchanged lines hidden --- |