···11-/**11+/*22 * fs/f2fs/checkpoint.c33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···2424static struct kmem_cache *orphan_entry_slab;2525static struct kmem_cache *inode_entry_slab;26262727-/**2727+/*2828 * We guarantee no failure on the returned page.2929 */3030struct page *grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)···4444 return page;4545}46464747-/**4747+/*4848 * We guarantee no failure on the returned page.4949 */5050struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)···543543 goto retry;544544}545545546546-/**546546+/*547547 * Freeze all the FS-operations for checkpoint.548548 */549549void block_operations(struct f2fs_sb_info *sbi)···727727 F2FS_RESET_SB_DIRT(sbi);728728}729729730730-/**730730+/*731731 * We guarantee that this checkpoint procedure should not fail.732732 */733733void write_checkpoint(struct f2fs_sb_info *sbi, bool blocked, bool is_umount)
+6-6
fs/f2fs/data.c
···11-/**11+/*22 * fs/f2fs/data.c33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···2121#include "node.h"2222#include "segment.h"23232424-/**2424+/*2525 * Lock ordering for the change of data block address:2626 * ->data_page2727 * ->node_page···207207 return page;208208}209209210210-/**210210+/*211211 * If it tries to access a hole, return an error.212212 * Because, the callers, functions in dir.c and GC, should be able to know213213 * whether this page exists or not.···247247 return page;248248}249249250250-/**250250+/*251251 * Caller ensures that this data page is never allocated.252252 * A new zero-filled data page is allocated in the page cache.253253 */···322322 bio_put(bio);323323}324324325325-/**325325+/*326326 * Fill the locked page with data located in the block address.327327 * Read operation is synchronous, and caller must unlock the page.328328 */···367367 return 0;368368}369369370370-/**370370+/*371371 * This function should be used by the data read flow only where it372372 * does not check the "create" flag that indicates block allocation.373373 * The reason for this special functionality is to exploit VFS readahead
+3-3
fs/f2fs/debug.c
···11-/**11+/*22 * f2fs debugging statistics33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···7878 }7979}80808181-/**8181+/*8282 * This function calculates BDF of every segments8383 */8484static void update_sit_info(struct f2fs_sb_info *sbi)···113113 si->avg_vblocks = 0;114114}115115116116-/**116116+/*117117 * This function calculates memory footprint.118118 */119119static void update_mem_info(struct f2fs_sb_info *sbi)
+2-2
fs/f2fs/dir.c
···11-/**11+/*22 * fs/f2fs/dir.c33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···453453 return err;454454}455455456456-/**456456+/*457457 * It only removes the dentry from the dentry page,corresponding name458458 * entry in name page does not need to be touched during deletion.459459 */
···11-/**11+/*22 * fs/f2fs/gc.c33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···213213 return get_cb_cost(sbi, segno);214214}215215216216-/**216216+/*217217 * This function is called from two pathes.218218 * One is garbage collection and the other is SSR segment selection.219219 * When it is called during GC, it just gets a victim segment···359359 return ret ? GC_OK : GC_NEXT;360360}361361362362-/**362362+/*363363 * This function compares node address got in summary with that in NAT.364364 * On validity, copy that node with cold status, otherwise (invalid node)365365 * ignore that.···425425 return GC_DONE;426426}427427428428-/**428428+/*429429 * Calculate start block index that this node page contains430430 */431431block_t start_bidx_of_node(unsigned int node_ofs)···516516 f2fs_put_page(page, 1);517517}518518519519-/**519519+/*520520 * This function tries to get parent node of victim data block, and identifies521521 * data block validity. If the block is valid, copy that with cold status and522522 * modify parent node.
···11-/**11+/*22 * fs/f2fs/inode.c33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···235235 return 0;236236}237237238238-/**238238+/*239239 * Called at the last iput() if i_nlink is zero240240 */241241void f2fs_evict_inode(struct inode *inode)
+2-2
fs/f2fs/namei.c
···11-/**11+/*22 * fs/f2fs/namei.c33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···9696 return ret;9797}98989999-/**9999+/*100100 * Set multimedia files as cold files for hot/cold data separation101101 */102102static inline void set_cold_file(struct f2fs_sb_info *sbi, struct inode *inode,
+11-11
fs/f2fs/node.c
···11-/**11+/*22 * fs/f2fs/node.c33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···8181 return dst_page;8282}83838484-/**8484+/*8585 * Readahead NAT pages8686 */8787static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid)···251251 return nr_shrink;252252}253253254254-/**254254+/*255255 * This function returns always success256256 */257257void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni)···302302 cache_nat_entry(NM_I(sbi), nid, &ne);303303}304304305305-/**305305+/*306306 * The maximum depth is four.307307 * Offset[0] will have raw inode offset.308308 */···649649 return err;650650}651651652652-/**652652+/*653653 * All the block addresses of data and nodes should be nullified.654654 */655655int truncate_inode_blocks(struct inode *inode, pgoff_t from)···860860 return f2fs_readpage(sbi, page, ni.blk_addr, type);861861}862862863863-/**863863+/*864864 * Readahead a node page865865 */866866void ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)···910910 return page;911911}912912913913-/**913913+/*914914 * Return a locked page for the desired node page.915915 * And, readahead MAX_RA_NODE number of node pages.916916 */···11861186 return 0;11871187}1188118811891189-/**11891189+/*11901190 * Structure of the f2fs node operations11911191 */11921192const struct address_space_operations f2fs_node_aops = {···13861386 return true;13871387}1388138813891389-/**13891389+/*13901390 * alloc_nid() should be called prior to this function.13911391 */13921392void alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid)···14031403 spin_unlock(&nm_i->free_nid_list_lock);14041404}1405140514061406-/**14061406+/*14071407 * alloc_nid() should be called prior to this function.14081408 */14091409void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid)···15451545 return true;15461546}1547154715481548-/**15481548+/*15491549 * This function is called during the checkpointing process.15501550 */15511551void flush_nat_entries(struct f2fs_sb_info *sbi)
···11-/**11+/*22 * fs/f2fs/segment.c33 *44 * Copyright (c) 2012 Samsung Electronics Co., Ltd.···3636 return 0;3737}38383939-/**3939+/*4040 * This function balances dirty node and dentry pages.4141 * In addition, it controls garbage collection.4242 */···105105 }106106}107107108108-/**108108+/*109109 * Should not occur error such as -ENOMEM.110110 * Adding dirty entry into seglist is not critical operation.111111 * If a given segment is one of current working segments, it won't be added.···136136 return;137137}138138139139-/**139139+/*140140 * Should call clear_prefree_segments after checkpoint is done.141141 */142142static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi)···269269 mutex_unlock(&sit_i->sentry_lock);270270}271271272272-/**272272+/*273273 * This function should be resided under the curseg_mutex lock274274 */275275static void __add_sum_entry(struct f2fs_sb_info *sbi, int type,···282282 return;283283}284284285285-/**285285+/*286286 * Calculate the number of current summary pages for writing287287 */288288int npages_for_summary_flush(struct f2fs_sb_info *sbi)···309309 return 3;310310}311311312312-/**312312+/*313313 * Caller should put this summary page314314 */315315struct page *get_sum_page(struct f2fs_sb_info *sbi, unsigned int segno)···371371 return NULL_SEGNO;372372}373373374374-/**374374+/*375375 * Find a new segment from the free segments bitmap to right order376376 * This function should be returned with success, otherwise BUG377377 */···483483 __set_sit_entry_type(sbi, type, curseg->segno, modified);484484}485485486486-/**486486+/*487487 * Allocate a current working segment.488488 * This function always allocates a free segment in LFS manner.489489 */···520520 seg->next_blkoff = ofs;521521}522522523523-/**523523+/*524524 * If a segment is written by LFS manner, next block offset is just obtained525525 * by increasing the current block offset. However, if a segment is written by526526 * SSR manner, next block offset obtained by calling __next_free_blkoff···534534 seg->next_blkoff++;535535}536536537537-/**537537+/*538538 * This function always allocates a used segment (from dirty seglist) by SSR539539 * manner, so it should recover the existing segment information of valid blocks540540 */···13101310 return 0;13111311}1312131213131313-/**13131313+/*13141314 * CP calls this function, which flushes SIT entries including sit_journal,13151315 * and moves prefree segs to free segs.13161316 */···16241624 return init_victim_segmap(sbi);16251625}1626162616271627-/**16271627+/*16281628 * Update min, max modified time for cost-benefit GC algorithm16291629 */16301630static void init_min_max_mtime(struct f2fs_sb_info *sbi)