Commit 0dbdc2ae authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: add the number of inline_data files to status info

This patch adds the number of inline_data files into the status information.
Note that the number is reset whenever the filesystem is newly mounted.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
parent 9e09fc85
...@@ -45,6 +45,7 @@ static void update_general_status(struct f2fs_sb_info *sbi) ...@@ -45,6 +45,7 @@ static void update_general_status(struct f2fs_sb_info *sbi)
si->valid_count = valid_user_blocks(sbi); si->valid_count = valid_user_blocks(sbi);
si->valid_node_count = valid_node_count(sbi); si->valid_node_count = valid_node_count(sbi);
si->valid_inode_count = valid_inode_count(sbi); si->valid_inode_count = valid_inode_count(sbi);
si->inline_inode = sbi->inline_inode;
si->utilization = utilization(sbi); si->utilization = utilization(sbi);
si->free_segs = free_segments(sbi); si->free_segs = free_segments(sbi);
...@@ -200,6 +201,8 @@ static int stat_show(struct seq_file *s, void *v) ...@@ -200,6 +201,8 @@ static int stat_show(struct seq_file *s, void *v)
seq_printf(s, "Other: %u)\n - Data: %u\n", seq_printf(s, "Other: %u)\n - Data: %u\n",
si->valid_node_count - si->valid_inode_count, si->valid_node_count - si->valid_inode_count,
si->valid_count - si->valid_node_count); si->valid_count - si->valid_node_count);
seq_printf(s, " - Inline_data Inode: %u\n",
si->inline_inode);
seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n", seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n",
si->main_area_segs, si->main_area_sections, si->main_area_segs, si->main_area_sections,
si->main_area_zones); si->main_area_zones);
......
...@@ -460,6 +460,7 @@ struct f2fs_sb_info { ...@@ -460,6 +460,7 @@ struct f2fs_sb_info {
unsigned int segment_count[2]; /* # of allocated segments */ unsigned int segment_count[2]; /* # of allocated segments */
unsigned int block_count[2]; /* # of allocated blocks */ unsigned int block_count[2]; /* # of allocated blocks */
int total_hit_ext, read_hit_ext; /* extent cache hit ratio */ int total_hit_ext, read_hit_ext; /* extent cache hit ratio */
int inline_inode; /* # of inline_data inodes */
int bg_gc; /* background gc calls */ int bg_gc; /* background gc calls */
unsigned int n_dirty_dirs; /* # of dir inodes */ unsigned int n_dirty_dirs; /* # of dir inodes */
#endif #endif
...@@ -992,6 +993,11 @@ static inline int inline_xattr_size(struct inode *inode) ...@@ -992,6 +993,11 @@ static inline int inline_xattr_size(struct inode *inode)
return 0; return 0;
} }
static inline int f2fs_has_inline_data(struct inode *inode)
{
return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA);
}
static inline void *inline_data_addr(struct page *page) static inline void *inline_data_addr(struct page *page)
{ {
struct f2fs_inode *ri; struct f2fs_inode *ri;
...@@ -1201,7 +1207,7 @@ struct f2fs_stat_info { ...@@ -1201,7 +1207,7 @@ struct f2fs_stat_info {
int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta; int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta;
int nats, sits, fnids; int nats, sits, fnids;
int total_count, utilization; int total_count, utilization;
int bg_gc; int bg_gc, inline_inode;
unsigned int valid_count, valid_node_count, valid_inode_count; unsigned int valid_count, valid_node_count, valid_inode_count;
unsigned int bimodal, avg_vblocks; unsigned int bimodal, avg_vblocks;
int util_free, util_valid, util_invalid; int util_free, util_valid, util_invalid;
...@@ -1230,6 +1236,17 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ...@@ -1230,6 +1236,17 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
#define stat_dec_dirty_dir(sbi) ((sbi)->n_dirty_dirs--) #define stat_dec_dirty_dir(sbi) ((sbi)->n_dirty_dirs--)
#define stat_inc_total_hit(sb) ((F2FS_SB(sb))->total_hit_ext++) #define stat_inc_total_hit(sb) ((F2FS_SB(sb))->total_hit_ext++)
#define stat_inc_read_hit(sb) ((F2FS_SB(sb))->read_hit_ext++) #define stat_inc_read_hit(sb) ((F2FS_SB(sb))->read_hit_ext++)
#define stat_inc_inline_inode(inode) \
do { \
if (f2fs_has_inline_data(inode)) \
((F2FS_SB(inode->i_sb))->inline_inode++); \
} while (0)
#define stat_dec_inline_inode(inode) \
do { \
if (f2fs_has_inline_data(inode)) \
((F2FS_SB(inode->i_sb))->inline_inode--); \
} while (0)
#define stat_inc_seg_type(sbi, curseg) \ #define stat_inc_seg_type(sbi, curseg) \
((sbi)->segment_count[(curseg)->alloc_type]++) ((sbi)->segment_count[(curseg)->alloc_type]++)
#define stat_inc_block_count(sbi, curseg) \ #define stat_inc_block_count(sbi, curseg) \
...@@ -1273,6 +1290,8 @@ void f2fs_destroy_root_stats(void); ...@@ -1273,6 +1290,8 @@ void f2fs_destroy_root_stats(void);
#define stat_dec_dirty_dir(sbi) #define stat_dec_dirty_dir(sbi)
#define stat_inc_total_hit(sb) #define stat_inc_total_hit(sb)
#define stat_inc_read_hit(sb) #define stat_inc_read_hit(sb)
#define stat_inc_inline_inode(inode)
#define stat_dec_inline_inode(inode)
#define stat_inc_seg_type(sbi, curseg) #define stat_inc_seg_type(sbi, curseg)
#define stat_inc_block_count(sbi, curseg) #define stat_inc_block_count(sbi, curseg)
#define stat_inc_seg_count(si, type) #define stat_inc_seg_count(si, type)
...@@ -1299,7 +1318,6 @@ extern const struct inode_operations f2fs_special_inode_operations; ...@@ -1299,7 +1318,6 @@ extern const struct inode_operations f2fs_special_inode_operations;
/* /*
* inline.c * inline.c
*/ */
inline int f2fs_has_inline_data(struct inode *);
bool f2fs_may_inline(struct inode *); bool f2fs_may_inline(struct inode *);
int f2fs_read_inline_data(struct inode *, struct page *); int f2fs_read_inline_data(struct inode *, struct page *);
int f2fs_convert_inline_data(struct inode *, pgoff_t); int f2fs_convert_inline_data(struct inode *, pgoff_t);
......
...@@ -13,11 +13,6 @@ ...@@ -13,11 +13,6 @@
#include "f2fs.h" #include "f2fs.h"
inline int f2fs_has_inline_data(struct inode *inode)
{
return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA);
}
bool f2fs_may_inline(struct inode *inode) bool f2fs_may_inline(struct inode *inode)
{ {
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
...@@ -113,6 +108,7 @@ static int __f2fs_convert_inline_data(struct inode *inode, struct page *page) ...@@ -113,6 +108,7 @@ static int __f2fs_convert_inline_data(struct inode *inode, struct page *page)
zero_user_segment(ipage, INLINE_DATA_OFFSET, zero_user_segment(ipage, INLINE_DATA_OFFSET,
INLINE_DATA_OFFSET + MAX_INLINE_DATA); INLINE_DATA_OFFSET + MAX_INLINE_DATA);
clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA); clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
stat_dec_inline_inode(inode);
sync_inode_page(&dn); sync_inode_page(&dn);
f2fs_put_page(ipage, 1); f2fs_put_page(ipage, 1);
...@@ -165,6 +161,7 @@ int f2fs_write_inline_data(struct inode *inode, ...@@ -165,6 +161,7 @@ int f2fs_write_inline_data(struct inode *inode,
if (!f2fs_has_inline_data(inode)) { if (!f2fs_has_inline_data(inode)) {
truncate_data_blocks_range(&dn, 1); truncate_data_blocks_range(&dn, 1);
set_inode_flag(F2FS_I(inode), FI_INLINE_DATA); set_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
stat_inc_inline_inode(inode);
} }
sync_inode_page(&dn); sync_inode_page(&dn);
......
...@@ -277,6 +277,7 @@ void f2fs_evict_inode(struct inode *inode) ...@@ -277,6 +277,7 @@ void f2fs_evict_inode(struct inode *inode)
f2fs_lock_op(sbi); f2fs_lock_op(sbi);
remove_inode_page(inode); remove_inode_page(inode);
stat_dec_inline_inode(inode);
f2fs_unlock_op(sbi); f2fs_unlock_op(sbi);
sb_end_intwrite(inode->i_sb); sb_end_intwrite(inode->i_sb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment