f2fs.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151
  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
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _LINUX_F2FS_H
  12. #define _LINUX_F2FS_H
  13. #include <linux/types.h>
  14. #include <linux/page-flags.h>
  15. #include <linux/buffer_head.h>
  16. #include <linux/slab.h>
  17. #include <linux/crc32.h>
  18. #include <linux/magic.h>
  19. /*
  20. * For mount options
  21. */
  22. #define F2FS_MOUNT_BG_GC 0x00000001
  23. #define F2FS_MOUNT_DISABLE_ROLL_FORWARD 0x00000002
  24. #define F2FS_MOUNT_DISCARD 0x00000004
  25. #define F2FS_MOUNT_NOHEAP 0x00000008
  26. #define F2FS_MOUNT_XATTR_USER 0x00000010
  27. #define F2FS_MOUNT_POSIX_ACL 0x00000020
  28. #define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000040
  29. #define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
  30. #define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option)
  31. #define test_opt(sbi, option) (sbi->mount_opt.opt & F2FS_MOUNT_##option)
  32. #define ver_after(a, b) (typecheck(unsigned long long, a) && \
  33. typecheck(unsigned long long, b) && \
  34. ((long long)((a) - (b)) > 0))
  35. typedef u64 block_t;
  36. typedef u32 nid_t;
  37. struct f2fs_mount_info {
  38. unsigned int opt;
  39. };
  40. static inline __u32 f2fs_crc32(void *buff, size_t len)
  41. {
  42. return crc32_le(F2FS_SUPER_MAGIC, buff, len);
  43. }
  44. static inline bool f2fs_crc_valid(__u32 blk_crc, void *buff, size_t buff_size)
  45. {
  46. return f2fs_crc32(buff, buff_size) == blk_crc;
  47. }
  48. /*
  49. * For checkpoint manager
  50. */
  51. enum {
  52. NAT_BITMAP,
  53. SIT_BITMAP
  54. };
  55. /* for the list of orphan inodes */
  56. struct orphan_inode_entry {
  57. struct list_head list; /* list head */
  58. nid_t ino; /* inode number */
  59. };
  60. /* for the list of directory inodes */
  61. struct dir_inode_entry {
  62. struct list_head list; /* list head */
  63. struct inode *inode; /* vfs inode pointer */
  64. };
  65. /* for the list of fsync inodes, used only during recovery */
  66. struct fsync_inode_entry {
  67. struct list_head list; /* list head */
  68. struct inode *inode; /* vfs inode pointer */
  69. block_t blkaddr; /* block address locating the last inode */
  70. };
  71. #define nats_in_cursum(sum) (le16_to_cpu(sum->n_nats))
  72. #define sits_in_cursum(sum) (le16_to_cpu(sum->n_sits))
  73. #define nat_in_journal(sum, i) (sum->nat_j.entries[i].ne)
  74. #define nid_in_journal(sum, i) (sum->nat_j.entries[i].nid)
  75. #define sit_in_journal(sum, i) (sum->sit_j.entries[i].se)
  76. #define segno_in_journal(sum, i) (sum->sit_j.entries[i].segno)
  77. static inline int update_nats_in_cursum(struct f2fs_summary_block *rs, int i)
  78. {
  79. int before = nats_in_cursum(rs);
  80. rs->n_nats = cpu_to_le16(before + i);
  81. return before;
  82. }
  83. static inline int update_sits_in_cursum(struct f2fs_summary_block *rs, int i)
  84. {
  85. int before = sits_in_cursum(rs);
  86. rs->n_sits = cpu_to_le16(before + i);
  87. return before;
  88. }
  89. /*
  90. * ioctl commands
  91. */
  92. #define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS
  93. #define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS
  94. #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
  95. /*
  96. * ioctl commands in 32 bit emulation
  97. */
  98. #define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS
  99. #define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS
  100. #endif
  101. /*
  102. * For INODE and NODE manager
  103. */
  104. #define XATTR_NODE_OFFSET (-1) /*
  105. * store xattrs to one node block per
  106. * file keeping -1 as its node offset to
  107. * distinguish from index node blocks.
  108. */
  109. enum {
  110. ALLOC_NODE, /* allocate a new node page if needed */
  111. LOOKUP_NODE, /* look up a node without readahead */
  112. LOOKUP_NODE_RA, /*
  113. * look up a node with readahead called
  114. * by get_datablock_ro.
  115. */
  116. };
  117. #define F2FS_LINK_MAX 32000 /* maximum link count per file */
  118. /* for in-memory extent cache entry */
  119. struct extent_info {
  120. rwlock_t ext_lock; /* rwlock for consistency */
  121. unsigned int fofs; /* start offset in a file */
  122. u32 blk_addr; /* start block address of the extent */
  123. unsigned int len; /* length of the extent */
  124. };
  125. /*
  126. * i_advise uses FADVISE_XXX_BIT. We can add additional hints later.
  127. */
  128. #define FADVISE_COLD_BIT 0x01
  129. #define FADVISE_CP_BIT 0x02
  130. struct f2fs_inode_info {
  131. struct inode vfs_inode; /* serve a vfs inode */
  132. unsigned long i_flags; /* keep an inode flags for ioctl */
  133. unsigned char i_advise; /* use to give file attribute hints */
  134. unsigned int i_current_depth; /* use only in directory structure */
  135. unsigned int i_pino; /* parent inode number */
  136. umode_t i_acl_mode; /* keep file acl mode temporarily */
  137. /* Use below internally in f2fs*/
  138. unsigned long flags; /* use to pass per-file flags */
  139. atomic_t dirty_dents; /* # of dirty dentry pages */
  140. f2fs_hash_t chash; /* hash value of given file name */
  141. unsigned int clevel; /* maximum level of given file name */
  142. nid_t i_xattr_nid; /* node id that contains xattrs */
  143. struct extent_info ext; /* in-memory extent cache entry */
  144. };
  145. static inline void get_extent_info(struct extent_info *ext,
  146. struct f2fs_extent i_ext)
  147. {
  148. write_lock(&ext->ext_lock);
  149. ext->fofs = le32_to_cpu(i_ext.fofs);
  150. ext->blk_addr = le32_to_cpu(i_ext.blk_addr);
  151. ext->len = le32_to_cpu(i_ext.len);
  152. write_unlock(&ext->ext_lock);
  153. }
  154. static inline void set_raw_extent(struct extent_info *ext,
  155. struct f2fs_extent *i_ext)
  156. {
  157. read_lock(&ext->ext_lock);
  158. i_ext->fofs = cpu_to_le32(ext->fofs);
  159. i_ext->blk_addr = cpu_to_le32(ext->blk_addr);
  160. i_ext->len = cpu_to_le32(ext->len);
  161. read_unlock(&ext->ext_lock);
  162. }
  163. struct f2fs_nm_info {
  164. block_t nat_blkaddr; /* base disk address of NAT */
  165. nid_t max_nid; /* maximum possible node ids */
  166. nid_t next_scan_nid; /* the next nid to be scanned */
  167. /* NAT cache management */
  168. struct radix_tree_root nat_root;/* root of the nat entry cache */
  169. rwlock_t nat_tree_lock; /* protect nat_tree_lock */
  170. unsigned int nat_cnt; /* the # of cached nat entries */
  171. struct list_head nat_entries; /* cached nat entry list (clean) */
  172. struct list_head dirty_nat_entries; /* cached nat entry list (dirty) */
  173. /* free node ids management */
  174. struct list_head free_nid_list; /* a list for free nids */
  175. spinlock_t free_nid_list_lock; /* protect free nid list */
  176. unsigned int fcnt; /* the number of free node id */
  177. struct mutex build_lock; /* lock for build free nids */
  178. /* for checkpoint */
  179. char *nat_bitmap; /* NAT bitmap pointer */
  180. int bitmap_size; /* bitmap size */
  181. };
  182. /*
  183. * this structure is used as one of function parameters.
  184. * all the information are dedicated to a given direct node block determined
  185. * by the data offset in a file.
  186. */
  187. struct dnode_of_data {
  188. struct inode *inode; /* vfs inode pointer */
  189. struct page *inode_page; /* its inode page, NULL is possible */
  190. struct page *node_page; /* cached direct node page */
  191. nid_t nid; /* node id of the direct node block */
  192. unsigned int ofs_in_node; /* data offset in the node page */
  193. bool inode_page_locked; /* inode page is locked or not */
  194. block_t data_blkaddr; /* block address of the node block */
  195. };
  196. static inline void set_new_dnode(struct dnode_of_data *dn, struct inode *inode,
  197. struct page *ipage, struct page *npage, nid_t nid)
  198. {
  199. memset(dn, 0, sizeof(*dn));
  200. dn->inode = inode;
  201. dn->inode_page = ipage;
  202. dn->node_page = npage;
  203. dn->nid = nid;
  204. }
  205. /*
  206. * For SIT manager
  207. *
  208. * By default, there are 6 active log areas across the whole main area.
  209. * When considering hot and cold data separation to reduce cleaning overhead,
  210. * we split 3 for data logs and 3 for node logs as hot, warm, and cold types,
  211. * respectively.
  212. * In the current design, you should not change the numbers intentionally.
  213. * Instead, as a mount option such as active_logs=x, you can use 2, 4, and 6
  214. * logs individually according to the underlying devices. (default: 6)
  215. * Just in case, on-disk layout covers maximum 16 logs that consist of 8 for
  216. * data and 8 for node logs.
  217. */
  218. #define NR_CURSEG_DATA_TYPE (3)
  219. #define NR_CURSEG_NODE_TYPE (3)
  220. #define NR_CURSEG_TYPE (NR_CURSEG_DATA_TYPE + NR_CURSEG_NODE_TYPE)
  221. enum {
  222. CURSEG_HOT_DATA = 0, /* directory entry blocks */
  223. CURSEG_WARM_DATA, /* data blocks */
  224. CURSEG_COLD_DATA, /* multimedia or GCed data blocks */
  225. CURSEG_HOT_NODE, /* direct node blocks of directory files */
  226. CURSEG_WARM_NODE, /* direct node blocks of normal files */
  227. CURSEG_COLD_NODE, /* indirect node blocks */
  228. NO_CHECK_TYPE
  229. };
  230. struct f2fs_sm_info {
  231. struct sit_info *sit_info; /* whole segment information */
  232. struct free_segmap_info *free_info; /* free segment information */
  233. struct dirty_seglist_info *dirty_info; /* dirty segment information */
  234. struct curseg_info *curseg_array; /* active segment information */
  235. struct list_head wblist_head; /* list of under-writeback pages */
  236. spinlock_t wblist_lock; /* lock for checkpoint */
  237. block_t seg0_blkaddr; /* block address of 0'th segment */
  238. block_t main_blkaddr; /* start block address of main area */
  239. block_t ssa_blkaddr; /* start block address of SSA area */
  240. unsigned int segment_count; /* total # of segments */
  241. unsigned int main_segments; /* # of segments in main area */
  242. unsigned int reserved_segments; /* # of reserved segments */
  243. unsigned int ovp_segments; /* # of overprovision segments */
  244. };
  245. /*
  246. * For directory operation
  247. */
  248. #define NODE_DIR1_BLOCK (ADDRS_PER_INODE + 1)
  249. #define NODE_DIR2_BLOCK (ADDRS_PER_INODE + 2)
  250. #define NODE_IND1_BLOCK (ADDRS_PER_INODE + 3)
  251. #define NODE_IND2_BLOCK (ADDRS_PER_INODE + 4)
  252. #define NODE_DIND_BLOCK (ADDRS_PER_INODE + 5)
  253. /*
  254. * For superblock
  255. */
  256. /*
  257. * COUNT_TYPE for monitoring
  258. *
  259. * f2fs monitors the number of several block types such as on-writeback,
  260. * dirty dentry blocks, dirty node blocks, and dirty meta blocks.
  261. */
  262. enum count_type {
  263. F2FS_WRITEBACK,
  264. F2FS_DIRTY_DENTS,
  265. F2FS_DIRTY_NODES,
  266. F2FS_DIRTY_META,
  267. NR_COUNT_TYPE,
  268. };
  269. /*
  270. * Uses as sbi->fs_lock[NR_GLOBAL_LOCKS].
  271. * The checkpoint procedure blocks all the locks in this fs_lock array.
  272. * Some FS operations grab free locks, and if there is no free lock,
  273. * then wait to grab a lock in a round-robin manner.
  274. */
  275. #define NR_GLOBAL_LOCKS 8
  276. /*
  277. * The below are the page types of bios used in submti_bio().
  278. * The available types are:
  279. * DATA User data pages. It operates as async mode.
  280. * NODE Node pages. It operates as async mode.
  281. * META FS metadata pages such as SIT, NAT, CP.
  282. * NR_PAGE_TYPE The number of page types.
  283. * META_FLUSH Make sure the previous pages are written
  284. * with waiting the bio's completion
  285. * ... Only can be used with META.
  286. */
  287. enum page_type {
  288. DATA,
  289. NODE,
  290. META,
  291. NR_PAGE_TYPE,
  292. META_FLUSH,
  293. };
  294. struct f2fs_sb_info {
  295. struct super_block *sb; /* pointer to VFS super block */
  296. struct buffer_head *raw_super_buf; /* buffer head of raw sb */
  297. struct f2fs_super_block *raw_super; /* raw super block pointer */
  298. int s_dirty; /* dirty flag for checkpoint */
  299. /* for node-related operations */
  300. struct f2fs_nm_info *nm_info; /* node manager */
  301. struct inode *node_inode; /* cache node blocks */
  302. /* for segment-related operations */
  303. struct f2fs_sm_info *sm_info; /* segment manager */
  304. struct bio *bio[NR_PAGE_TYPE]; /* bios to merge */
  305. sector_t last_block_in_bio[NR_PAGE_TYPE]; /* last block number */
  306. struct rw_semaphore bio_sem; /* IO semaphore */
  307. /* for checkpoint */
  308. struct f2fs_checkpoint *ckpt; /* raw checkpoint pointer */
  309. struct inode *meta_inode; /* cache meta blocks */
  310. struct mutex cp_mutex; /* checkpoint procedure lock */
  311. struct mutex fs_lock[NR_GLOBAL_LOCKS]; /* blocking FS operations */
  312. struct mutex node_write; /* locking node writes */
  313. struct mutex writepages; /* mutex for writepages() */
  314. unsigned char next_lock_num; /* round-robin global locks */
  315. int por_doing; /* recovery is doing or not */
  316. int on_build_free_nids; /* build_free_nids is doing */
  317. /* for orphan inode management */
  318. struct list_head orphan_inode_list; /* orphan inode list */
  319. struct mutex orphan_inode_mutex; /* for orphan inode list */
  320. unsigned int n_orphans; /* # of orphan inodes */
  321. /* for directory inode management */
  322. struct list_head dir_inode_list; /* dir inode list */
  323. spinlock_t dir_inode_lock; /* for dir inode list lock */
  324. unsigned int n_dirty_dirs; /* # of dir inodes */
  325. /* basic file system units */
  326. unsigned int log_sectors_per_block; /* log2 sectors per block */
  327. unsigned int log_blocksize; /* log2 block size */
  328. unsigned int blocksize; /* block size */
  329. unsigned int root_ino_num; /* root inode number*/
  330. unsigned int node_ino_num; /* node inode number*/
  331. unsigned int meta_ino_num; /* meta inode number*/
  332. unsigned int log_blocks_per_seg; /* log2 blocks per segment */
  333. unsigned int blocks_per_seg; /* blocks per segment */
  334. unsigned int segs_per_sec; /* segments per section */
  335. unsigned int secs_per_zone; /* sections per zone */
  336. unsigned int total_sections; /* total section count */
  337. unsigned int total_node_count; /* total node block count */
  338. unsigned int total_valid_node_count; /* valid node block count */
  339. unsigned int total_valid_inode_count; /* valid inode count */
  340. int active_logs; /* # of active logs */
  341. block_t user_block_count; /* # of user blocks */
  342. block_t total_valid_block_count; /* # of valid blocks */
  343. block_t alloc_valid_block_count; /* # of allocated blocks */
  344. block_t last_valid_block_count; /* for recovery */
  345. u32 s_next_generation; /* for NFS support */
  346. atomic_t nr_pages[NR_COUNT_TYPE]; /* # of pages, see count_type */
  347. struct f2fs_mount_info mount_opt; /* mount options */
  348. /* for cleaning operations */
  349. struct mutex gc_mutex; /* mutex for GC */
  350. struct f2fs_gc_kthread *gc_thread; /* GC thread */
  351. unsigned int cur_victim_sec; /* current victim section num */
  352. /*
  353. * for stat information.
  354. * one is for the LFS mode, and the other is for the SSR mode.
  355. */
  356. struct f2fs_stat_info *stat_info; /* FS status information */
  357. unsigned int segment_count[2]; /* # of allocated segments */
  358. unsigned int block_count[2]; /* # of allocated blocks */
  359. unsigned int last_victim[2]; /* last victim segment # */
  360. int total_hit_ext, read_hit_ext; /* extent cache hit ratio */
  361. int bg_gc; /* background gc calls */
  362. spinlock_t stat_lock; /* lock for stat operations */
  363. };
  364. /*
  365. * Inline functions
  366. */
  367. static inline struct f2fs_inode_info *F2FS_I(struct inode *inode)
  368. {
  369. return container_of(inode, struct f2fs_inode_info, vfs_inode);
  370. }
  371. static inline struct f2fs_sb_info *F2FS_SB(struct super_block *sb)
  372. {
  373. return sb->s_fs_info;
  374. }
  375. static inline struct f2fs_super_block *F2FS_RAW_SUPER(struct f2fs_sb_info *sbi)
  376. {
  377. return (struct f2fs_super_block *)(sbi->raw_super);
  378. }
  379. static inline struct f2fs_checkpoint *F2FS_CKPT(struct f2fs_sb_info *sbi)
  380. {
  381. return (struct f2fs_checkpoint *)(sbi->ckpt);
  382. }
  383. static inline struct f2fs_nm_info *NM_I(struct f2fs_sb_info *sbi)
  384. {
  385. return (struct f2fs_nm_info *)(sbi->nm_info);
  386. }
  387. static inline struct f2fs_sm_info *SM_I(struct f2fs_sb_info *sbi)
  388. {
  389. return (struct f2fs_sm_info *)(sbi->sm_info);
  390. }
  391. static inline struct sit_info *SIT_I(struct f2fs_sb_info *sbi)
  392. {
  393. return (struct sit_info *)(SM_I(sbi)->sit_info);
  394. }
  395. static inline struct free_segmap_info *FREE_I(struct f2fs_sb_info *sbi)
  396. {
  397. return (struct free_segmap_info *)(SM_I(sbi)->free_info);
  398. }
  399. static inline struct dirty_seglist_info *DIRTY_I(struct f2fs_sb_info *sbi)
  400. {
  401. return (struct dirty_seglist_info *)(SM_I(sbi)->dirty_info);
  402. }
  403. static inline void F2FS_SET_SB_DIRT(struct f2fs_sb_info *sbi)
  404. {
  405. sbi->s_dirty = 1;
  406. }
  407. static inline void F2FS_RESET_SB_DIRT(struct f2fs_sb_info *sbi)
  408. {
  409. sbi->s_dirty = 0;
  410. }
  411. static inline bool is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
  412. {
  413. unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
  414. return ckpt_flags & f;
  415. }
  416. static inline void set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
  417. {
  418. unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
  419. ckpt_flags |= f;
  420. cp->ckpt_flags = cpu_to_le32(ckpt_flags);
  421. }
  422. static inline void clear_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
  423. {
  424. unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
  425. ckpt_flags &= (~f);
  426. cp->ckpt_flags = cpu_to_le32(ckpt_flags);
  427. }
  428. static inline void mutex_lock_all(struct f2fs_sb_info *sbi)
  429. {
  430. int i;
  431. for (i = 0; i < NR_GLOBAL_LOCKS; i++) {
  432. /*
  433. * This is the only time we take multiple fs_lock[]
  434. * instances; the order is immaterial since we
  435. * always hold cp_mutex, which serializes multiple
  436. * such operations.
  437. */
  438. mutex_lock_nest_lock(&sbi->fs_lock[i], &sbi->cp_mutex);
  439. }
  440. }
  441. static inline void mutex_unlock_all(struct f2fs_sb_info *sbi)
  442. {
  443. int i = 0;
  444. for (; i < NR_GLOBAL_LOCKS; i++)
  445. mutex_unlock(&sbi->fs_lock[i]);
  446. }
  447. static inline int mutex_lock_op(struct f2fs_sb_info *sbi)
  448. {
  449. unsigned char next_lock = sbi->next_lock_num % NR_GLOBAL_LOCKS;
  450. int i = 0;
  451. for (; i < NR_GLOBAL_LOCKS; i++)
  452. if (mutex_trylock(&sbi->fs_lock[i]))
  453. return i;
  454. mutex_lock(&sbi->fs_lock[next_lock]);
  455. sbi->next_lock_num++;
  456. return next_lock;
  457. }
  458. static inline void mutex_unlock_op(struct f2fs_sb_info *sbi, int ilock)
  459. {
  460. if (ilock < 0)
  461. return;
  462. BUG_ON(ilock >= NR_GLOBAL_LOCKS);
  463. mutex_unlock(&sbi->fs_lock[ilock]);
  464. }
  465. /*
  466. * Check whether the given nid is within node id range.
  467. */
  468. static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid)
  469. {
  470. WARN_ON((nid >= NM_I(sbi)->max_nid));
  471. if (nid >= NM_I(sbi)->max_nid)
  472. return -EINVAL;
  473. return 0;
  474. }
  475. #define F2FS_DEFAULT_ALLOCATED_BLOCKS 1
  476. /*
  477. * Check whether the inode has blocks or not
  478. */
  479. static inline int F2FS_HAS_BLOCKS(struct inode *inode)
  480. {
  481. if (F2FS_I(inode)->i_xattr_nid)
  482. return (inode->i_blocks > F2FS_DEFAULT_ALLOCATED_BLOCKS + 1);
  483. else
  484. return (inode->i_blocks > F2FS_DEFAULT_ALLOCATED_BLOCKS);
  485. }
  486. static inline bool inc_valid_block_count(struct f2fs_sb_info *sbi,
  487. struct inode *inode, blkcnt_t count)
  488. {
  489. block_t valid_block_count;
  490. spin_lock(&sbi->stat_lock);
  491. valid_block_count =
  492. sbi->total_valid_block_count + (block_t)count;
  493. if (valid_block_count > sbi->user_block_count) {
  494. spin_unlock(&sbi->stat_lock);
  495. return false;
  496. }
  497. inode->i_blocks += count;
  498. sbi->total_valid_block_count = valid_block_count;
  499. sbi->alloc_valid_block_count += (block_t)count;
  500. spin_unlock(&sbi->stat_lock);
  501. return true;
  502. }
  503. static inline int dec_valid_block_count(struct f2fs_sb_info *sbi,
  504. struct inode *inode,
  505. blkcnt_t count)
  506. {
  507. spin_lock(&sbi->stat_lock);
  508. BUG_ON(sbi->total_valid_block_count < (block_t) count);
  509. BUG_ON(inode->i_blocks < count);
  510. inode->i_blocks -= count;
  511. sbi->total_valid_block_count -= (block_t)count;
  512. spin_unlock(&sbi->stat_lock);
  513. return 0;
  514. }
  515. static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type)
  516. {
  517. atomic_inc(&sbi->nr_pages[count_type]);
  518. F2FS_SET_SB_DIRT(sbi);
  519. }
  520. static inline void inode_inc_dirty_dents(struct inode *inode)
  521. {
  522. atomic_inc(&F2FS_I(inode)->dirty_dents);
  523. }
  524. static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type)
  525. {
  526. atomic_dec(&sbi->nr_pages[count_type]);
  527. }
  528. static inline void inode_dec_dirty_dents(struct inode *inode)
  529. {
  530. atomic_dec(&F2FS_I(inode)->dirty_dents);
  531. }
  532. static inline int get_pages(struct f2fs_sb_info *sbi, int count_type)
  533. {
  534. return atomic_read(&sbi->nr_pages[count_type]);
  535. }
  536. static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type)
  537. {
  538. unsigned int pages_per_sec = sbi->segs_per_sec *
  539. (1 << sbi->log_blocks_per_seg);
  540. return ((get_pages(sbi, block_type) + pages_per_sec - 1)
  541. >> sbi->log_blocks_per_seg) / sbi->segs_per_sec;
  542. }
  543. static inline block_t valid_user_blocks(struct f2fs_sb_info *sbi)
  544. {
  545. block_t ret;
  546. spin_lock(&sbi->stat_lock);
  547. ret = sbi->total_valid_block_count;
  548. spin_unlock(&sbi->stat_lock);
  549. return ret;
  550. }
  551. static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag)
  552. {
  553. struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
  554. /* return NAT or SIT bitmap */
  555. if (flag == NAT_BITMAP)
  556. return le32_to_cpu(ckpt->nat_ver_bitmap_bytesize);
  557. else if (flag == SIT_BITMAP)
  558. return le32_to_cpu(ckpt->sit_ver_bitmap_bytesize);
  559. return 0;
  560. }
  561. static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag)
  562. {
  563. struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
  564. int offset = (flag == NAT_BITMAP) ?
  565. le32_to_cpu(ckpt->sit_ver_bitmap_bytesize) : 0;
  566. return &ckpt->sit_nat_version_bitmap + offset;
  567. }
  568. static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi)
  569. {
  570. block_t start_addr;
  571. struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
  572. unsigned long long ckpt_version = le64_to_cpu(ckpt->checkpoint_ver);
  573. start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
  574. /*
  575. * odd numbered checkpoint should at cp segment 0
  576. * and even segent must be at cp segment 1
  577. */
  578. if (!(ckpt_version & 1))
  579. start_addr += sbi->blocks_per_seg;
  580. return start_addr;
  581. }
  582. static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi)
  583. {
  584. return le32_to_cpu(F2FS_CKPT(sbi)->cp_pack_start_sum);
  585. }
  586. static inline bool inc_valid_node_count(struct f2fs_sb_info *sbi,
  587. struct inode *inode,
  588. unsigned int count)
  589. {
  590. block_t valid_block_count;
  591. unsigned int valid_node_count;
  592. spin_lock(&sbi->stat_lock);
  593. valid_block_count = sbi->total_valid_block_count + (block_t)count;
  594. sbi->alloc_valid_block_count += (block_t)count;
  595. valid_node_count = sbi->total_valid_node_count + count;
  596. if (valid_block_count > sbi->user_block_count) {
  597. spin_unlock(&sbi->stat_lock);
  598. return false;
  599. }
  600. if (valid_node_count > sbi->total_node_count) {
  601. spin_unlock(&sbi->stat_lock);
  602. return false;
  603. }
  604. if (inode)
  605. inode->i_blocks += count;
  606. sbi->total_valid_node_count = valid_node_count;
  607. sbi->total_valid_block_count = valid_block_count;
  608. spin_unlock(&sbi->stat_lock);
  609. return true;
  610. }
  611. static inline void dec_valid_node_count(struct f2fs_sb_info *sbi,
  612. struct inode *inode,
  613. unsigned int count)
  614. {
  615. spin_lock(&sbi->stat_lock);
  616. BUG_ON(sbi->total_valid_block_count < count);
  617. BUG_ON(sbi->total_valid_node_count < count);
  618. BUG_ON(inode->i_blocks < count);
  619. inode->i_blocks -= count;
  620. sbi->total_valid_node_count -= count;
  621. sbi->total_valid_block_count -= (block_t)count;
  622. spin_unlock(&sbi->stat_lock);
  623. }
  624. static inline unsigned int valid_node_count(struct f2fs_sb_info *sbi)
  625. {
  626. unsigned int ret;
  627. spin_lock(&sbi->stat_lock);
  628. ret = sbi->total_valid_node_count;
  629. spin_unlock(&sbi->stat_lock);
  630. return ret;
  631. }
  632. static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi)
  633. {
  634. spin_lock(&sbi->stat_lock);
  635. BUG_ON(sbi->total_valid_inode_count == sbi->total_node_count);
  636. sbi->total_valid_inode_count++;
  637. spin_unlock(&sbi->stat_lock);
  638. }
  639. static inline int dec_valid_inode_count(struct f2fs_sb_info *sbi)
  640. {
  641. spin_lock(&sbi->stat_lock);
  642. BUG_ON(!sbi->total_valid_inode_count);
  643. sbi->total_valid_inode_count--;
  644. spin_unlock(&sbi->stat_lock);
  645. return 0;
  646. }
  647. static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi)
  648. {
  649. unsigned int ret;
  650. spin_lock(&sbi->stat_lock);
  651. ret = sbi->total_valid_inode_count;
  652. spin_unlock(&sbi->stat_lock);
  653. return ret;
  654. }
  655. static inline void f2fs_put_page(struct page *page, int unlock)
  656. {
  657. if (!page || IS_ERR(page))
  658. return;
  659. if (unlock) {
  660. BUG_ON(!PageLocked(page));
  661. unlock_page(page);
  662. }
  663. page_cache_release(page);
  664. }
  665. static inline void f2fs_put_dnode(struct dnode_of_data *dn)
  666. {
  667. if (dn->node_page)
  668. f2fs_put_page(dn->node_page, 1);
  669. if (dn->inode_page && dn->node_page != dn->inode_page)
  670. f2fs_put_page(dn->inode_page, 0);
  671. dn->node_page = NULL;
  672. dn->inode_page = NULL;
  673. }
  674. static inline struct kmem_cache *f2fs_kmem_cache_create(const char *name,
  675. size_t size, void (*ctor)(void *))
  676. {
  677. return kmem_cache_create(name, size, 0, SLAB_RECLAIM_ACCOUNT, ctor);
  678. }
  679. #define RAW_IS_INODE(p) ((p)->footer.nid == (p)->footer.ino)
  680. static inline bool IS_INODE(struct page *page)
  681. {
  682. struct f2fs_node *p = (struct f2fs_node *)page_address(page);
  683. return RAW_IS_INODE(p);
  684. }
  685. static inline __le32 *blkaddr_in_node(struct f2fs_node *node)
  686. {
  687. return RAW_IS_INODE(node) ? node->i.i_addr : node->dn.addr;
  688. }
  689. static inline block_t datablock_addr(struct page *node_page,
  690. unsigned int offset)
  691. {
  692. struct f2fs_node *raw_node;
  693. __le32 *addr_array;
  694. raw_node = (struct f2fs_node *)page_address(node_page);
  695. addr_array = blkaddr_in_node(raw_node);
  696. return le32_to_cpu(addr_array[offset]);
  697. }
  698. static inline int f2fs_test_bit(unsigned int nr, char *addr)
  699. {
  700. int mask;
  701. addr += (nr >> 3);
  702. mask = 1 << (7 - (nr & 0x07));
  703. return mask & *addr;
  704. }
  705. static inline int f2fs_set_bit(unsigned int nr, char *addr)
  706. {
  707. int mask;
  708. int ret;
  709. addr += (nr >> 3);
  710. mask = 1 << (7 - (nr & 0x07));
  711. ret = mask & *addr;
  712. *addr |= mask;
  713. return ret;
  714. }
  715. static inline int f2fs_clear_bit(unsigned int nr, char *addr)
  716. {
  717. int mask;
  718. int ret;
  719. addr += (nr >> 3);
  720. mask = 1 << (7 - (nr & 0x07));
  721. ret = mask & *addr;
  722. *addr &= ~mask;
  723. return ret;
  724. }
  725. /* used for f2fs_inode_info->flags */
  726. enum {
  727. FI_NEW_INODE, /* indicate newly allocated inode */
  728. FI_INC_LINK, /* need to increment i_nlink */
  729. FI_ACL_MODE, /* indicate acl mode */
  730. FI_NO_ALLOC, /* should not allocate any blocks */
  731. FI_DELAY_IPUT, /* used for the recovery */
  732. };
  733. static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag)
  734. {
  735. set_bit(flag, &fi->flags);
  736. }
  737. static inline int is_inode_flag_set(struct f2fs_inode_info *fi, int flag)
  738. {
  739. return test_bit(flag, &fi->flags);
  740. }
  741. static inline void clear_inode_flag(struct f2fs_inode_info *fi, int flag)
  742. {
  743. clear_bit(flag, &fi->flags);
  744. }
  745. static inline void set_acl_inode(struct f2fs_inode_info *fi, umode_t mode)
  746. {
  747. fi->i_acl_mode = mode;
  748. set_inode_flag(fi, FI_ACL_MODE);
  749. }
  750. static inline int cond_clear_inode_flag(struct f2fs_inode_info *fi, int flag)
  751. {
  752. if (is_inode_flag_set(fi, FI_ACL_MODE)) {
  753. clear_inode_flag(fi, FI_ACL_MODE);
  754. return 1;
  755. }
  756. return 0;
  757. }
  758. static inline int f2fs_readonly(struct super_block *sb)
  759. {
  760. return sb->s_flags & MS_RDONLY;
  761. }
  762. /*
  763. * file.c
  764. */
  765. int f2fs_sync_file(struct file *, loff_t, loff_t, int);
  766. void truncate_data_blocks(struct dnode_of_data *);
  767. void f2fs_truncate(struct inode *);
  768. int f2fs_setattr(struct dentry *, struct iattr *);
  769. int truncate_hole(struct inode *, pgoff_t, pgoff_t);
  770. int truncate_data_blocks_range(struct dnode_of_data *, int);
  771. long f2fs_ioctl(struct file *, unsigned int, unsigned long);
  772. long f2fs_compat_ioctl(struct file *, unsigned int, unsigned long);
  773. /*
  774. * inode.c
  775. */
  776. void f2fs_set_inode_flags(struct inode *);
  777. struct inode *f2fs_iget(struct super_block *, unsigned long);
  778. void update_inode(struct inode *, struct page *);
  779. int update_inode_page(struct inode *);
  780. int f2fs_write_inode(struct inode *, struct writeback_control *);
  781. void f2fs_evict_inode(struct inode *);
  782. /*
  783. * namei.c
  784. */
  785. struct dentry *f2fs_get_parent(struct dentry *child);
  786. /*
  787. * dir.c
  788. */
  789. struct f2fs_dir_entry *f2fs_find_entry(struct inode *, struct qstr *,
  790. struct page **);
  791. struct f2fs_dir_entry *f2fs_parent_dir(struct inode *, struct page **);
  792. ino_t f2fs_inode_by_name(struct inode *, struct qstr *);
  793. void f2fs_set_link(struct inode *, struct f2fs_dir_entry *,
  794. struct page *, struct inode *);
  795. int __f2fs_add_link(struct inode *, const struct qstr *, struct inode *);
  796. void f2fs_delete_entry(struct f2fs_dir_entry *, struct page *, struct inode *);
  797. int f2fs_make_empty(struct inode *, struct inode *);
  798. bool f2fs_empty_dir(struct inode *);
  799. static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode)
  800. {
  801. return __f2fs_add_link(dentry->d_parent->d_inode, &dentry->d_name,
  802. inode);
  803. }
  804. /*
  805. * super.c
  806. */
  807. int f2fs_sync_fs(struct super_block *, int);
  808. extern __printf(3, 4)
  809. void f2fs_msg(struct super_block *, const char *, const char *, ...);
  810. /*
  811. * hash.c
  812. */
  813. f2fs_hash_t f2fs_dentry_hash(const char *, size_t);
  814. /*
  815. * node.c
  816. */
  817. struct dnode_of_data;
  818. struct node_info;
  819. int is_checkpointed_node(struct f2fs_sb_info *, nid_t);
  820. void get_node_info(struct f2fs_sb_info *, nid_t, struct node_info *);
  821. int get_dnode_of_data(struct dnode_of_data *, pgoff_t, int);
  822. int truncate_inode_blocks(struct inode *, pgoff_t);
  823. int remove_inode_page(struct inode *);
  824. struct page *new_inode_page(struct inode *, const struct qstr *);
  825. struct page *new_node_page(struct dnode_of_data *, unsigned int);
  826. void ra_node_page(struct f2fs_sb_info *, nid_t);
  827. struct page *get_node_page(struct f2fs_sb_info *, pgoff_t);
  828. struct page *get_node_page_ra(struct page *, int);
  829. void sync_inode_page(struct dnode_of_data *);
  830. int sync_node_pages(struct f2fs_sb_info *, nid_t, struct writeback_control *);
  831. bool alloc_nid(struct f2fs_sb_info *, nid_t *);
  832. void alloc_nid_done(struct f2fs_sb_info *, nid_t);
  833. void alloc_nid_failed(struct f2fs_sb_info *, nid_t);
  834. void recover_node_page(struct f2fs_sb_info *, struct page *,
  835. struct f2fs_summary *, struct node_info *, block_t);
  836. int recover_inode_page(struct f2fs_sb_info *, struct page *);
  837. int restore_node_summary(struct f2fs_sb_info *, unsigned int,
  838. struct f2fs_summary_block *);
  839. void flush_nat_entries(struct f2fs_sb_info *);
  840. int build_node_manager(struct f2fs_sb_info *);
  841. void destroy_node_manager(struct f2fs_sb_info *);
  842. int __init create_node_manager_caches(void);
  843. void destroy_node_manager_caches(void);
  844. /*
  845. * segment.c
  846. */
  847. void f2fs_balance_fs(struct f2fs_sb_info *);
  848. void invalidate_blocks(struct f2fs_sb_info *, block_t);
  849. void locate_dirty_segment(struct f2fs_sb_info *, unsigned int);
  850. void clear_prefree_segments(struct f2fs_sb_info *);
  851. int npages_for_summary_flush(struct f2fs_sb_info *);
  852. void allocate_new_segments(struct f2fs_sb_info *);
  853. struct page *get_sum_page(struct f2fs_sb_info *, unsigned int);
  854. struct bio *f2fs_bio_alloc(struct block_device *, int);
  855. void f2fs_submit_bio(struct f2fs_sb_info *, enum page_type, bool sync);
  856. void write_meta_page(struct f2fs_sb_info *, struct page *);
  857. void write_node_page(struct f2fs_sb_info *, struct page *, unsigned int,
  858. block_t, block_t *);
  859. void write_data_page(struct inode *, struct page *, struct dnode_of_data*,
  860. block_t, block_t *);
  861. void rewrite_data_page(struct f2fs_sb_info *, struct page *, block_t);
  862. void recover_data_page(struct f2fs_sb_info *, struct page *,
  863. struct f2fs_summary *, block_t, block_t);
  864. void rewrite_node_page(struct f2fs_sb_info *, struct page *,
  865. struct f2fs_summary *, block_t, block_t);
  866. void write_data_summaries(struct f2fs_sb_info *, block_t);
  867. void write_node_summaries(struct f2fs_sb_info *, block_t);
  868. int lookup_journal_in_cursum(struct f2fs_summary_block *,
  869. int, unsigned int, int);
  870. void flush_sit_entries(struct f2fs_sb_info *);
  871. int build_segment_manager(struct f2fs_sb_info *);
  872. void destroy_segment_manager(struct f2fs_sb_info *);
  873. /*
  874. * checkpoint.c
  875. */
  876. struct page *grab_meta_page(struct f2fs_sb_info *, pgoff_t);
  877. struct page *get_meta_page(struct f2fs_sb_info *, pgoff_t);
  878. long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long);
  879. int check_orphan_space(struct f2fs_sb_info *);
  880. void add_orphan_inode(struct f2fs_sb_info *, nid_t);
  881. void remove_orphan_inode(struct f2fs_sb_info *, nid_t);
  882. int recover_orphan_inodes(struct f2fs_sb_info *);
  883. int get_valid_checkpoint(struct f2fs_sb_info *);
  884. void set_dirty_dir_page(struct inode *, struct page *);
  885. void remove_dirty_dir_inode(struct inode *);
  886. struct inode *check_dirty_dir_inode(struct f2fs_sb_info *, nid_t);
  887. void sync_dirty_dir_inodes(struct f2fs_sb_info *);
  888. void write_checkpoint(struct f2fs_sb_info *, bool);
  889. void init_orphan_info(struct f2fs_sb_info *);
  890. int __init create_checkpoint_caches(void);
  891. void destroy_checkpoint_caches(void);
  892. /*
  893. * data.c
  894. */
  895. int reserve_new_block(struct dnode_of_data *);
  896. void update_extent_cache(block_t, struct dnode_of_data *);
  897. struct page *find_data_page(struct inode *, pgoff_t, bool);
  898. struct page *get_lock_data_page(struct inode *, pgoff_t);
  899. struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool);
  900. int f2fs_readpage(struct f2fs_sb_info *, struct page *, block_t, int);
  901. int do_write_data_page(struct page *);
  902. /*
  903. * gc.c
  904. */
  905. int start_gc_thread(struct f2fs_sb_info *);
  906. void stop_gc_thread(struct f2fs_sb_info *);
  907. block_t start_bidx_of_node(unsigned int);
  908. int f2fs_gc(struct f2fs_sb_info *);
  909. void build_gc_manager(struct f2fs_sb_info *);
  910. int __init create_gc_caches(void);
  911. void destroy_gc_caches(void);
  912. /*
  913. * recovery.c
  914. */
  915. int recover_fsync_data(struct f2fs_sb_info *);
  916. bool space_for_roll_forward(struct f2fs_sb_info *);
  917. /*
  918. * debug.c
  919. */
  920. #ifdef CONFIG_F2FS_STAT_FS
  921. struct f2fs_stat_info {
  922. struct list_head stat_list;
  923. struct f2fs_sb_info *sbi;
  924. struct mutex stat_lock;
  925. int all_area_segs, sit_area_segs, nat_area_segs, ssa_area_segs;
  926. int main_area_segs, main_area_sections, main_area_zones;
  927. int hit_ext, total_ext;
  928. int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta;
  929. int nats, sits, fnids;
  930. int total_count, utilization;
  931. int bg_gc;
  932. unsigned int valid_count, valid_node_count, valid_inode_count;
  933. unsigned int bimodal, avg_vblocks;
  934. int util_free, util_valid, util_invalid;
  935. int rsvd_segs, overp_segs;
  936. int dirty_count, node_pages, meta_pages;
  937. int prefree_count, call_count;
  938. int tot_segs, node_segs, data_segs, free_segs, free_secs;
  939. int tot_blks, data_blks, node_blks;
  940. int curseg[NR_CURSEG_TYPE];
  941. int cursec[NR_CURSEG_TYPE];
  942. int curzone[NR_CURSEG_TYPE];
  943. unsigned int segment_count[2];
  944. unsigned int block_count[2];
  945. unsigned base_mem, cache_mem;
  946. };
  947. #define stat_inc_call_count(si) ((si)->call_count++)
  948. #define stat_inc_seg_count(sbi, type) \
  949. do { \
  950. struct f2fs_stat_info *si = sbi->stat_info; \
  951. (si)->tot_segs++; \
  952. if (type == SUM_TYPE_DATA) \
  953. si->data_segs++; \
  954. else \
  955. si->node_segs++; \
  956. } while (0)
  957. #define stat_inc_tot_blk_count(si, blks) \
  958. (si->tot_blks += (blks))
  959. #define stat_inc_data_blk_count(sbi, blks) \
  960. do { \
  961. struct f2fs_stat_info *si = sbi->stat_info; \
  962. stat_inc_tot_blk_count(si, blks); \
  963. si->data_blks += (blks); \
  964. } while (0)
  965. #define stat_inc_node_blk_count(sbi, blks) \
  966. do { \
  967. struct f2fs_stat_info *si = sbi->stat_info; \
  968. stat_inc_tot_blk_count(si, blks); \
  969. si->node_blks += (blks); \
  970. } while (0)
  971. int f2fs_build_stats(struct f2fs_sb_info *);
  972. void f2fs_destroy_stats(struct f2fs_sb_info *);
  973. void __init f2fs_create_root_stats(void);
  974. void f2fs_destroy_root_stats(void);
  975. #else
  976. #define stat_inc_call_count(si)
  977. #define stat_inc_seg_count(si, type)
  978. #define stat_inc_tot_blk_count(si, blks)
  979. #define stat_inc_data_blk_count(si, blks)
  980. #define stat_inc_node_blk_count(sbi, blks)
  981. static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
  982. static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
  983. static inline void __init f2fs_create_root_stats(void) { }
  984. static inline void f2fs_destroy_root_stats(void) { }
  985. #endif
  986. extern const struct file_operations f2fs_dir_operations;
  987. extern const struct file_operations f2fs_file_operations;
  988. extern const struct inode_operations f2fs_file_inode_operations;
  989. extern const struct address_space_operations f2fs_dblock_aops;
  990. extern const struct address_space_operations f2fs_node_aops;
  991. extern const struct address_space_operations f2fs_meta_aops;
  992. extern const struct inode_operations f2fs_dir_inode_operations;
  993. extern const struct inode_operations f2fs_symlink_inode_operations;
  994. extern const struct inode_operations f2fs_special_inode_operations;
  995. #endif