mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-27 00:04:47 +08:00
f2fs: account swapfile inodes
In order to check count of opened swapfile inodes. Signed-off-by: Chao Yu <chao.yu@oppo.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
689fe57e7e
commit
8ec071c363
@ -3989,6 +3989,7 @@ static int f2fs_swap_activate(struct swap_info_struct *sis, struct file *file,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
stat_inc_swapfile_inode(inode);
|
||||
set_inode_flag(inode, FI_PIN_FILE);
|
||||
f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
|
||||
return ret;
|
||||
@ -3998,6 +3999,7 @@ static void f2fs_swap_deactivate(struct file *file)
|
||||
{
|
||||
struct inode *inode = file_inode(file);
|
||||
|
||||
stat_dec_swapfile_inode(inode);
|
||||
clear_inode_flag(inode, FI_PIN_FILE);
|
||||
}
|
||||
#else
|
||||
|
@ -135,6 +135,7 @@ static void update_general_status(struct f2fs_sb_info *sbi)
|
||||
si->inline_inode = atomic_read(&sbi->inline_inode);
|
||||
si->inline_dir = atomic_read(&sbi->inline_dir);
|
||||
si->compr_inode = atomic_read(&sbi->compr_inode);
|
||||
si->swapfile_inode = atomic_read(&sbi->swapfile_inode);
|
||||
si->compr_blocks = atomic64_read(&sbi->compr_blocks);
|
||||
si->append = sbi->im[APPEND_INO].ino_num;
|
||||
si->update = sbi->im[UPDATE_INO].ino_num;
|
||||
@ -385,6 +386,8 @@ static int stat_show(struct seq_file *s, void *v)
|
||||
si->inline_dir);
|
||||
seq_printf(s, " - Compressed Inode: %u, Blocks: %llu\n",
|
||||
si->compr_inode, si->compr_blocks);
|
||||
seq_printf(s, " - Swapfile Inode: %u\n",
|
||||
si->swapfile_inode);
|
||||
seq_printf(s, " - Orphan/Append/Update Inode: %u, %u, %u\n",
|
||||
si->orphans, si->append, si->update);
|
||||
seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n",
|
||||
@ -607,6 +610,7 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)
|
||||
atomic_set(&sbi->inline_dir, 0);
|
||||
atomic_set(&sbi->compr_inode, 0);
|
||||
atomic64_set(&sbi->compr_blocks, 0);
|
||||
atomic_set(&sbi->swapfile_inode, 0);
|
||||
atomic_set(&sbi->inplace_count, 0);
|
||||
for (i = META_CP; i < META_MAX; i++)
|
||||
atomic_set(&sbi->meta_count[i], 0);
|
||||
|
@ -1770,6 +1770,7 @@ struct f2fs_sb_info {
|
||||
atomic_t inline_dir; /* # of inline_dentry inodes */
|
||||
atomic_t compr_inode; /* # of compressed inodes */
|
||||
atomic64_t compr_blocks; /* # of compressed blocks */
|
||||
atomic_t swapfile_inode; /* # of swapfile inodes */
|
||||
atomic_t max_aw_cnt; /* max # of atomic writes */
|
||||
unsigned int io_skip_bggc; /* skip background gc for in-flight IO */
|
||||
unsigned int other_skip_bggc; /* skip background gc for other reasons */
|
||||
@ -3876,7 +3877,7 @@ struct f2fs_stat_info {
|
||||
int nr_issued_ckpt, nr_total_ckpt, nr_queued_ckpt;
|
||||
unsigned int cur_ckpt_time, peak_ckpt_time;
|
||||
int inline_xattr, inline_inode, inline_dir, append, update, orphans;
|
||||
int compr_inode;
|
||||
int compr_inode, swapfile_inode;
|
||||
unsigned long long compr_blocks;
|
||||
int aw_cnt, max_aw_cnt;
|
||||
unsigned int valid_count, valid_node_count, valid_inode_count, discard_blks;
|
||||
@ -3965,6 +3966,10 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
|
||||
(atomic64_add(blocks, &F2FS_I_SB(inode)->compr_blocks))
|
||||
#define stat_sub_compr_blocks(inode, blocks) \
|
||||
(atomic64_sub(blocks, &F2FS_I_SB(inode)->compr_blocks))
|
||||
#define stat_inc_swapfile_inode(inode) \
|
||||
(atomic_inc(&F2FS_I_SB(inode)->swapfile_inode))
|
||||
#define stat_dec_swapfile_inode(inode) \
|
||||
(atomic_dec(&F2FS_I_SB(inode)->swapfile_inode))
|
||||
#define stat_inc_meta_count(sbi, blkaddr) \
|
||||
do { \
|
||||
if (blkaddr < SIT_I(sbi)->sit_base_addr) \
|
||||
@ -4049,6 +4054,8 @@ void f2fs_update_sit_info(struct f2fs_sb_info *sbi);
|
||||
#define stat_dec_compr_inode(inode) do { } while (0)
|
||||
#define stat_add_compr_blocks(inode, blocks) do { } while (0)
|
||||
#define stat_sub_compr_blocks(inode, blocks) do { } while (0)
|
||||
#define stat_inc_swapfile_inode(inode) do { } while (0)
|
||||
#define stat_dec_swapfile_inode(inode) do { } while (0)
|
||||
#define stat_update_max_atomic_write(inode) do { } while (0)
|
||||
#define stat_inc_meta_count(sbi, blkaddr) do { } while (0)
|
||||
#define stat_inc_seg_type(sbi, curseg) do { } while (0)
|
||||
|
Loading…
Reference in New Issue
Block a user