aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/debug.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-22f2fs: clean up flush/discard command namingsJaegeuk Kim1-1/+1
This patch simply cleans up the names for flush/discard commands. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2017-01-29f2fs: show the max number of atomic operationsJaegeuk Kim1-0/+7
This patch adds to show the max number of atomic operations which are conducting concurrently. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2016-11-25f2fs: set ->owner for debugfs status file's file_operationsNicolai Stange1-0/+1
The struct file_operations instance serving the f2fs/status debugfs file lacks an initialization of its ->owner. This means that although that file might have been opened, the f2fs module can still get removed. Any further operation on that opened file, releasing included, will cause accesses to unmapped memory. Indeed, Mike Marshall reported the following: BUG: unable to handle kernel paging request at ffffffffa0307430 IP: [<ffffffff8132a224>] full_proxy_release+0x24/0x90 <...> Call Trace: [] __fput+0xdf/0x1d0 [] ____fput+0xe/0x10 [] task_work_run+0x8e/0xc0 [] do_exit+0x2ae/0xae0 [] ? __audit_syscall_entry+0xae/0x100 [] ? syscall_trace_enter+0x1ca/0x310 [] do_group_exit+0x44/0xc0 [] SyS_exit_group+0x14/0x20 [] do_syscall_64+0x61/0x150 [] entry_SYSCALL64_slow_path+0x25/0x25 <...> ---[ end trace f22ae883fa3ea6b8 ]--- Fixing recursive fault but reboot is needed! Fix this by initializing the f2fs/status file_operations' ->owner with THIS_MODULE. This will allow debugfs to grab a reference to the f2fs module upon any open on that file, thus preventing it from getting removed. Fixes: 902829aa0b72 ("f2fs: move proc files to debugfs") Reported-by: Mike Marshall <[email protected]> Reported-by: Martin Brandenburg <[email protected]> Cc: [email protected] Signed-off-by: Nicolai Stange <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2016-11-25f2fs: don't wait writeback for datas during checkpointChao Yu1-3/+4
Normally, while committing checkpoint, we will wait on all pages to be writebacked no matter the page is data or metadata, so in scenario where there are lots of data IO being submitted with metadata, we may suffer long latency for waiting writeback during checkpoint. Indeed, we only care about persistence for pages with metadata, but not pages with data, as file system consistent are only related to metadate, so in order to avoid encountering long latency in above scenario, let's recognize and reference metadata in submitted IOs, wait writeback only for metadatas. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2016-11-23f2fs: remove percpu_count due to performance regressionJaegeuk Kim1-6/+6
This patch removes percpu_count usage due to performance regression in iozone. Fixes: 523be8a6b3 ("f2fs: use percpu_counter for page counters") Signed-off-by: Jaegeuk Kim <[email protected]>
2016-11-23f2fs: split free nid listChao Yu1-4/+7
During free nid allocation, in order to do preallocation, we will tag free nid entry as allocated one and still leave it in free nid list, for other allocators who want to grab free nids, it needs to traverse the free nid list for lookup. It becomes overhead in scenario of allocating free nid intensively by multithreads. This patch splits free nid list to two list: {free,alloc}_nid_list, to keep free nids and preallocated free nids separately, after that, traverse latency will be gone, besides split nid_cnt for separate statistic. Additionally, introduce __insert_nid_to_list and __remove_nid_from_list for cleanup. Signed-off-by: Chao Yu <[email protected]> [Jaegeuk Kim: modify f2fs_bug_on to avoid needless branches] Signed-off-by: Jaegeuk Kim <[email protected]>
2016-09-22f2fs: show dirty inode numberChao Yu1-0/+3
This patch enables showing dirty inode number in procfs. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2016-08-29f2fs: add discard info to sys entry of f2fs statusYunlei He1-2/+8
This patch add discard block count to sys entry of f2fs status Signed-off-by: Yunlei He <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2016-08-24f2fs: do not use discard_map for hard disksJaegeuk Kim1-1/+3
We don't need to keep discard_map, if disk does not support discard command. Signed-off-by: Jaegeuk Kim <[email protected]>
2016-06-02f2fs: flush inode metadata when checkpoint is doingJaegeuk Kim1-2/+3
This patch registers all the inodes which have dirty metadata to sync when checkpoint is doing. Signed-off-by: Jaegeuk Kim <[email protected]>
2016-05-18f2fs: use percpu_counter for page countersJaegeuk Kim1-5/+6
This patch substitutes percpu_counter for atomic_counter when counting various types of pages. Signed-off-by: Jaegeuk Kim <[email protected]>
2016-05-18f2fs: use bio count instead of F2FS_WRITEBACK page countJaegeuk Kim1-3/+3
This can reduce page counting overhead. Signed-off-by: Jaegeuk Kim <[email protected]>
2016-05-11f2fs: show # of orphan inodesJaegeuk Kim1-1/+4
This adds debug information for # of orphan inodes. Signed-off-by: Jaegeuk Kim <[email protected]>
2016-04-15f2fs: show current mount statusJaegeuk Kim1-2/+3
This patch remains the current mount status to f2fs status info. Signed-off-by: Jaegeuk Kim <[email protected]>
2016-04-04mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macrosKirill A. Shutemov1-3/+3
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time ago with promise that one day it will be possible to implement page cache with bigger chunks than PAGE_SIZE. This promise never materialized. And unlikely will. We have many places where PAGE_CACHE_SIZE assumed to be equal to PAGE_SIZE. And it's constant source of confusion on whether PAGE_CACHE_* or PAGE_* constant should be used in a particular case, especially on the border between fs and mm. Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much breakage to be doable. Let's stop pretending that pages in page cache are special. They are not. The changes are pretty straight-forward: - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>; - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>; - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN}; - page_cache_get() -> get_page(); - page_cache_release() -> put_page(); This patch contains automated changes generated with coccinelle using script below. For some reason, coccinelle doesn't patch header files. I've called spatch for them manually. The only adjustment after coccinelle is revert of changes to PAGE_CAHCE_ALIGN definition: we are going to drop it later. There are few places in the code where coccinelle didn't reach. I'll fix them manually in a separate patch. Comments and documentation also will be addressed with the separate patch. virtual patch @@ expression E; @@ - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT) + E @@ expression E; @@ - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) + E @@ @@ - PAGE_CACHE_SHIFT + PAGE_SHIFT @@ @@ - PAGE_CACHE_SIZE + PAGE_SIZE @@ @@ - PAGE_CACHE_MASK + PAGE_MASK @@ expression E; @@ - PAGE_CACHE_ALIGN(E) + PAGE_ALIGN(E) @@ expression E; @@ - page_cache_get(E) + get_page(E) @@ expression E; @@ - page_cache_release(E) + put_page(E) Signed-off-by: Kirill A. Shutemov <[email protected]> Acked-by: Michal Hocko <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-01-13Merge tag 'for-f2fs-4.5' of ↵Linus Torvalds1-10/+19
git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs Pull f2fs updates from Jaegeuk Kim: "This series adds two ioctls to control cached data and fragmented files. Most of the rest fixes missing error cases and bugs that we have not covered so far. Summary: Enhancements: - support an ioctl to execute online file defragmentation - support an ioctl to flush cached data - speed up shrinking of extent_cache entries - handle broken superblock - refector dirty inode management infra - revisit f2fs_map_blocks to handle more cases - reduce global lock coverage - add detecting user's idle time Major bug fixes: - fix data race condition on cached nat entries - fix error cases of volatile and atomic writes" * tag 'for-f2fs-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (87 commits) f2fs: should unset atomic flag after successful commit f2fs: fix wrong memory condition check f2fs: monitor the number of background checkpoint f2fs: detect idle time depending on user behavior f2fs: introduce time and interval facility f2fs: skip releasing nodes in chindless extent tree f2fs: use atomic type for node count in extent tree f2fs: recognize encrypted data in f2fs_fiemap f2fs: clean up f2fs_balance_fs f2fs: remove redundant calls f2fs: avoid unnecessary f2fs_balance_fs calls f2fs: check the page status filled from disk f2fs: introduce __get_node_page to reuse common code f2fs: check node id earily when readaheading node page f2fs: read isize while holding i_mutex in fiemap Revert "f2fs: check the node block address of newly allocated nid" f2fs: cover more area with nat_tree_lock f2fs: introduce max_file_blocks in sbi f2fs crypto: check CONFIG_F2FS_FS_XATTR for encrypted symlink f2fs: introduce zombie list for fast shrinking extent trees ...
2016-01-11f2fs: monitor the number of background checkpointJaegeuk Kim1-1/+2
This patch adds to show the number of background checkpoint. Signed-off-by: Jaegeuk Kim <[email protected]>
2016-01-06fs: use block_device name vsprintf helperDmitry Monakhov1-4/+2
Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-12-31f2fs: monitor zombie_tree countJaegeuk Kim1-2/+3
This patch adds an entry to show the number of zombie extent_tree. Signed-off-by: Jaegeuk Kim <[email protected]>
2015-12-22f2fs: use atomic variable for total_extent_treeJaegeuk Kim1-2/+3
It would be better to use atomic variable for total_extent_tree. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-12-17f2fs: stat dirty regular/symlink inodesChao Yu1-1/+5
Add to stat dirty regular and symlink inode for showing in debugfs. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-12-15f2fs: introduce dirty list node in inode infoChao Yu1-1/+0
Add a new dirt list node member in inode info for linking the inode to global dirty list in superblock, instead of old implementation which allocate slab cache memory as an entry to inode. It avoids memory pressure due to slab cache allocation, and also makes codes more clean. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-12-04f2fs: use sbi->blocks_per_seg to avoid unnecessary calculationChao Yu1-1/+1
Use sbi->blocks_per_seg directly to avoid unnecessary calculation when using 1 << sbi->log_blocks_per_seg. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-12-04f2fs: report error of f2fs_create_root_statsChao Yu1-2/+5
f2fs_create_root_stats can fail due to no memory, report it to user. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-10-09f2fs: use atomic64_t for extent cache hit statChao Yu1-11/+11
Our hit stat of extent cache will increase all the time until remount, and we use atomic_t type for the stat variable, so it may easily incur overflow when we query extent cache frequently in a long time running fs. So to avoid that, this patch uses atomic64_t for hit stat variables. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-10-09f2fs: fix incorrect bimodal calculationChao Yu1-1/+1
In update_sit_info, we use div_u64 to handle 'u64 divide u64' case, but div_u64 can only handle 32-bits divisor, so our divisor with u64 type passed to div_u64 will overflow, result in the wrong calculation when show debug info of f2fs as below: BDF: 464, avg. vblocks: 23509 (BDF should never exceed 100) So change to use div64_u64 to handle this case correctly. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-10-09f2fs: fix overflow of size calculationChao Yu1-6/+6
We have potential overflow issue when calculating size of object, when we left shift index with PAGE_CACHE_SHIFT bits, if type of index has only 32-bits space in 32-bit architecture, left shifting will incur overflow, i.e: pgoff_t index = 0xFFFFFFFF; loff_t size = index << PAGE_CACHE_SHIFT; size: 0xFFFFF000 So we should cast index with 64-bits type to avoid this issue. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-08-21f2fs: adjust showing of extent cache statChao Yu1-6/+12
This patch alters to replace total hit stat with rbtree hit stat, and then adjust showing of extent cache stat: Hit Count: L1-1: for largest node hit count; L1-2: for last cached node hit count; L2: for extent node hit after lookuping in rbtree. Hit Ratio: ratio (hit count / total lookup count) Inner Struct Count: tree count, node count. Before: Extent Hit Ratio: 0 / 2 Extent Tree Count: 3 Extent Node Count: 2 Patched: Exten Cacache: - Hit Count: L1-1:4871 L1-2:2074 L2:208 - Hit Ratio: 1% (7153 / 550751) - Inner Struct Count: tree: 26560, node: 11824 Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-08-21f2fs: add largest/cached stat in extent cacheChao Yu1-2/+7
This patch adds to stat the hit count of largest/cached node for showing in debugfs. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-08-05f2fs: use atomic_t to record hit ratio info of extent cacheChao Yu1-2/+5
Variables for recording extent cache ratio info were updated without protection, this patch tries to alter them to atomic_t type for more accurate stat. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-08-05f2fs: stat inline xattr inode numberChao Yu1-0/+4
This patch adds to stat the number of inline xattr inode for showing in debugfs. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-06-01f2fs: fix building on 32-bit architecturesArnd Bergmann1-3/+3
A bug fix to the debug output extended the type of some local variables to 64-bit, which now causes the kernel to fail building because of missing 64-bit division functions: ERROR: "__aeabi_uldivmod" [fs/f2fs/f2fs.ko] undefined! In the kernel, we have to use div_u64 or do_div to do this, in order to annotate that this is an expensive operation. As the function is only called for debug out, we know this is not performance critical, so it is safe to use div_u64. Signed-off-by: Arnd Bergmann <[email protected]> Fixes: d1f85bd38db19 ("f2fs: avoid value overflow in showing current status") Signed-off-by: Jaegeuk Kim <[email protected]>
2015-05-28f2fs: avoid value overflow in showing current statusJaegeuk Kim1-1/+2
This patch fixes overflow when do cat /sys/kernel/debug/f2fs/status. If a section is relatively large, dist value can be overflowed. Reported-by: Yossi Goldfill <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-05-28f2fs: introduce discard_map for f2fs_trim_fsJaegeuk Kim1-1/+1
This patch adds a bitmap for discard issues from f2fs_trim_fs. There-in rule is to issue discard commands only for invalidated blocks after mount. Once mount is done, f2fs_trim_fs trims out whole invalid area. After ehn, it will not issue and discrads redundantly. Signed-off-by: Jaegeuk Kim <[email protected]>
2015-04-10f2fs: add stat info for moved blocks by background gcChangman Lee1-5/+10
This patch is for looking into gc performance of f2fs in detail. Signed-off-by: Changman Lee <[email protected]> [Jaegeuk Kim: fix build errors] Signed-off-by: Jaegeuk Kim <[email protected]>
2015-03-03f2fs: show extent tree, node stat info in debugfsChao Yu1-0/+7
This patch add and show stat info of total memory footprint for extent tree,node in debugfs. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-02-11f2fs: avoid variable length arrayJaegeuk Kim1-0/+1
Instead of using variable length array, this patch let preallocate memory for them. Signed-off-by: Jaegeuk Kim <[email protected]>
2015-02-11f2fs: show the number of writeback pages in statJaegeuk Kim1-2/+3
This patch adds the # of writeback pages in stat info. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-02-11f2fs: update memory footprint informationJaegeuk Kim1-7/+17
This patch adds missing memory usages, and splits them in detail. Signed-off-by: Jaegeuk Kim <[email protected]>
2015-02-11f2fs: fix wrong memory footprint statistics in debugfsChao Yu1-4/+11
Our value of memory footprint statistics showed in debugfs is not calculated correctly. Fix it in this patch. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-01-09f2fs: add nat/sit entries into statusJaegeuk Kim1-3/+5
This patch adds NAT/SIT entry informations. Signed-off-by: Jaegeuk Kim <[email protected]>
2015-01-09f2fs: reuse inode_entry_slab in gc procedure for using slab more effectivelyChao Yu1-1/+1
There are two slab cache inode_entry_slab and winode_slab using the same structure as below: struct dir_inode_entry { struct list_head list; /* list head */ struct inode *inode; /* vfs inode pointer */ }; struct inode_entry { struct list_head list; struct inode *inode; }; It's a little waste that the two cache can not share their memory space for each other. So in this patch we remove one redundant winode_slab slab cache, then use more universal name struct inode_entry as remaining data structure name of slab, finally we reuse the inode_entry_slab to store dirty dir item and gc item for more effective. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2015-01-09f2fs: add block count by in-place-update in stat infoChangman Lee1-0/+4
This patch adds block count by in-place-update in stat. Signed-off-by: Changman Lee <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2014-12-08f2fs: use atomic for counting inode with inline_{dir,inode} flagChao Yu1-2/+5
As inline_{dir,inode} stat is increased/decreased concurrently by multi threads, so the value is not so accurate, let's use atomic type for counting accurately. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2014-12-08f2fs: count the number of inmemory pagesJaegeuk Kim1-0/+3
This patch adds counting # of inmemory pages in the page cache. Signed-off-by: Jaegeuk Kim <[email protected]>
2014-11-19f2fs: introduce struct inode_management to wrap inner fieldsChao Yu1-1/+1
Now in f2fs, we have three inode cache: ORPHAN_INO, APPEND_INO, UPDATE_INO, and we manage fields related to inode cache separately in struct f2fs_sb_info for each inode cache type. This makes codes a bit messy, so that this patch intorduce a new struct inode_management to wrap inner fields as following which make codes more neat. /* for inner inode cache management */ struct inode_management { struct radix_tree_root ino_root; /* ino entry array */ spinlock_t ino_lock; /* for ino entry lock */ struct list_head ino_list; /* inode list head */ unsigned long ino_num; /* number of entries */ }; struct f2fs_sb_info { ... struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ ... } Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2014-11-06f2fs: introduce the number of inode entriesJaegeuk Kim1-1/+3
This patch adds to monitor the number of ino entries. Signed-off-by: Jaegeuk Kim <[email protected]>
2014-11-03f2fs: add stat info for inline_dentry inodesJaegeuk Kim1-0/+3
This patch adds status information for inline_dentry inodes. Signed-off-by: Jaegeuk Kim <[email protected]>
2014-09-30f2fs: check the use of macros on block counts and addressesJaegeuk Kim1-10/+10
This patch cleans up the existing and new macros for readability. Rule is like this. ,-----------------------------------------> MAX_BLKADDR -, | ,------------- TOTAL_BLKS ----------------------------, | | | | ,- seg0_blkaddr ,----- sit/nat/ssa/main blkaddress | block | | (SEG0_BLKADDR) | | | | (e.g., MAIN_BLKADDR) | address 0..x................ a b c d ............................. | | global seg# 0...................... m ............................. | | | | `------- MAIN_SEGS -----------' `-------------- TOTAL_SEGS ---------------------------' | | seg# 0..........xx.................. = Note = o GET_SEGNO_FROM_SEG0 : blk address -> global segno o GET_SEGNO : blk address -> segno o START_BLOCK : segno -> starting block address Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
2014-08-19f2fs: fix typoarter971-2/+2
Fix typo and some grammatical errors. The words "filesystem" and "readahead" are being used without the space treewide. Signed-off-by: Park Ju Hyung <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>