Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

f2fs: export ra_nid_pages to sysfs

After finishing building free nid cache, we will try to readahead
asynchronously 4 more pages for the next reloading, the count of
readahead nid pages is fixed.

In some case, like SMR drive, read less sectors with fixed count
each time we trigger RA may be low efficient, since we will face
high seeking overhead, so we'd better let user to configure this
parameter from sysfs in specific workload.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Chao Yu and committed by
Jaegeuk Kim
ea1a29a0 2db2388f

+14 -2
+6
Documentation/ABI/testing/sysfs-fs-f2fs
··· 86 86 Contact: "Jaegeuk Kim" <jaegeuk@kernel.org> 87 87 Description: 88 88 Controls the checkpoint timing. 89 + 90 + What: /sys/fs/f2fs/<disk>/ra_nid_pages 91 + Date: October 2015 92 + Contact: "Chao Yu" <chao2.yu@samsung.com> 93 + Description: 94 + Controls the count of nid pages to be readaheaded.
+1
fs/f2fs/f2fs.h
··· 510 510 nid_t available_nids; /* maximum available node ids */ 511 511 nid_t next_scan_nid; /* the next nid to be scanned */ 512 512 unsigned int ram_thresh; /* control the memory footprint */ 513 + unsigned int ra_nid_pages; /* # of nid pages to be readaheaded */ 513 514 514 515 /* NAT cache management */ 515 516 struct radix_tree_root nat_root;/* root of the nat entry cache */
+2 -1
fs/f2fs/node.c
··· 1562 1562 mutex_unlock(&curseg->curseg_mutex); 1563 1563 1564 1564 ra_meta_pages(sbi, NAT_BLOCK_OFFSET(nm_i->next_scan_nid), 1565 - FREE_NID_PAGES, META_NAT, false); 1565 + nm_i->ra_nid_pages, META_NAT, false); 1566 1566 } 1567 1567 1568 1568 /* ··· 2005 2005 nm_i->fcnt = 0; 2006 2006 nm_i->nat_cnt = 0; 2007 2007 nm_i->ram_thresh = DEF_RAM_THRESHOLD; 2008 + nm_i->ra_nid_pages = DEF_RA_NID_PAGES; 2008 2009 2009 2010 INIT_RADIX_TREE(&nm_i->free_nid_root, GFP_ATOMIC); 2010 2011 INIT_LIST_HEAD(&nm_i->free_nid_list);
+3 -1
fs/f2fs/node.h
··· 14 14 /* node block offset on the NAT area dedicated to the given start node id */ 15 15 #define NAT_BLOCK_OFFSET(start_nid) (start_nid / NAT_ENTRY_PER_BLOCK) 16 16 17 - /* # of pages to perform readahead before building free nids */ 17 + /* # of pages to perform synchronous readahead before building free nids */ 18 18 #define FREE_NID_PAGES 4 19 + 20 + #define DEF_RA_NID_PAGES 4 /* # of nid pages to be readaheaded */ 19 21 20 22 /* maximum readahead size for node during getting data blocks */ 21 23 #define MAX_RA_NODE 128
+2
fs/f2fs/super.c
··· 213 213 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_ipu_util, min_ipu_util); 214 214 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_fsync_blocks, min_fsync_blocks); 215 215 F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, ram_thresh, ram_thresh); 216 + F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, ra_nid_pages, ra_nid_pages); 216 217 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_victim_search, max_victim_search); 217 218 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, dir_level, dir_level); 218 219 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, cp_interval, cp_interval); ··· 233 232 ATTR_LIST(max_victim_search), 234 233 ATTR_LIST(dir_level), 235 234 ATTR_LIST(ram_thresh), 235 + ATTR_LIST(ra_nid_pages), 236 236 ATTR_LIST(cp_interval), 237 237 NULL, 238 238 };