aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-11-25 21:08:57 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-01-06 02:42:20 -0500
commit0dbdc2ae9bba0a358816cc4a22e41a6ef16db8a2 (patch)
tree7ffa34ebdec3327322913de047f8964bd21e7e1a /fs/f2fs
parent9e09fc855dd6f6ed510b3db7f3c3c1dd73631ac7 (diff)
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: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/debug.c3
-rw-r--r--fs/f2fs/f2fs.h22
-rw-r--r--fs/f2fs/inline.c7
-rw-r--r--fs/f2fs/inode.c1
4 files changed, 26 insertions, 7 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 61adbcbe9b87..711a0d4d1cba 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -45,6 +45,7 @@ static void update_general_status(struct f2fs_sb_info *sbi)
45 si->valid_count = valid_user_blocks(sbi); 45 si->valid_count = valid_user_blocks(sbi);
46 si->valid_node_count = valid_node_count(sbi); 46 si->valid_node_count = valid_node_count(sbi);
47 si->valid_inode_count = valid_inode_count(sbi); 47 si->valid_inode_count = valid_inode_count(sbi);
48 si->inline_inode = sbi->inline_inode;
48 si->utilization = utilization(sbi); 49 si->utilization = utilization(sbi);
49 50
50 si->free_segs = free_segments(sbi); 51 si->free_segs = free_segments(sbi);
@@ -200,6 +201,8 @@ static int stat_show(struct seq_file *s, void *v)
200 seq_printf(s, "Other: %u)\n - Data: %u\n", 201 seq_printf(s, "Other: %u)\n - Data: %u\n",
201 si->valid_node_count - si->valid_inode_count, 202 si->valid_node_count - si->valid_inode_count,
202 si->valid_count - si->valid_node_count); 203 si->valid_count - si->valid_node_count);
204 seq_printf(s, " - Inline_data Inode: %u\n",
205 si->inline_inode);
203 seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n", 206 seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n",
204 si->main_area_segs, si->main_area_sections, 207 si->main_area_segs, si->main_area_sections,
205 si->main_area_zones); 208 si->main_area_zones);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index af35039c38f8..0b6badadbfd8 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -460,6 +460,7 @@ struct f2fs_sb_info {
460 unsigned int segment_count[2]; /* # of allocated segments */ 460 unsigned int segment_count[2]; /* # of allocated segments */
461 unsigned int block_count[2]; /* # of allocated blocks */ 461 unsigned int block_count[2]; /* # of allocated blocks */
462 int total_hit_ext, read_hit_ext; /* extent cache hit ratio */ 462 int total_hit_ext, read_hit_ext; /* extent cache hit ratio */
463 int inline_inode; /* # of inline_data inodes */
463 int bg_gc; /* background gc calls */ 464 int bg_gc; /* background gc calls */
464 unsigned int n_dirty_dirs; /* # of dir inodes */ 465 unsigned int n_dirty_dirs; /* # of dir inodes */
465#endif 466#endif
@@ -992,6 +993,11 @@ static inline int inline_xattr_size(struct inode *inode)
992 return 0; 993 return 0;
993} 994}
994 995
996static inline int f2fs_has_inline_data(struct inode *inode)
997{
998 return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA);
999}
1000
995static inline void *inline_data_addr(struct page *page) 1001static inline void *inline_data_addr(struct page *page)
996{ 1002{
997 struct f2fs_inode *ri; 1003 struct f2fs_inode *ri;
@@ -1201,7 +1207,7 @@ struct f2fs_stat_info {
1201 int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta; 1207 int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta;
1202 int nats, sits, fnids; 1208 int nats, sits, fnids;
1203 int total_count, utilization; 1209 int total_count, utilization;
1204 int bg_gc; 1210 int bg_gc, inline_inode;
1205 unsigned int valid_count, valid_node_count, valid_inode_count; 1211 unsigned int valid_count, valid_node_count, valid_inode_count;
1206 unsigned int bimodal, avg_vblocks; 1212 unsigned int bimodal, avg_vblocks;
1207 int util_free, util_valid, util_invalid; 1213 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#define stat_dec_dirty_dir(sbi) ((sbi)->n_dirty_dirs--) 1236#define stat_dec_dirty_dir(sbi) ((sbi)->n_dirty_dirs--)
1231#define stat_inc_total_hit(sb) ((F2FS_SB(sb))->total_hit_ext++) 1237#define stat_inc_total_hit(sb) ((F2FS_SB(sb))->total_hit_ext++)
1232#define stat_inc_read_hit(sb) ((F2FS_SB(sb))->read_hit_ext++) 1238#define stat_inc_read_hit(sb) ((F2FS_SB(sb))->read_hit_ext++)
1239#define stat_inc_inline_inode(inode) \
1240 do { \
1241 if (f2fs_has_inline_data(inode)) \
1242 ((F2FS_SB(inode->i_sb))->inline_inode++); \
1243 } while (0)
1244#define stat_dec_inline_inode(inode) \
1245 do { \
1246 if (f2fs_has_inline_data(inode)) \
1247 ((F2FS_SB(inode->i_sb))->inline_inode--); \
1248 } while (0)
1249
1233#define stat_inc_seg_type(sbi, curseg) \ 1250#define stat_inc_seg_type(sbi, curseg) \
1234 ((sbi)->segment_count[(curseg)->alloc_type]++) 1251 ((sbi)->segment_count[(curseg)->alloc_type]++)
1235#define stat_inc_block_count(sbi, curseg) \ 1252#define stat_inc_block_count(sbi, curseg) \
@@ -1273,6 +1290,8 @@ void f2fs_destroy_root_stats(void);
1273#define stat_dec_dirty_dir(sbi) 1290#define stat_dec_dirty_dir(sbi)
1274#define stat_inc_total_hit(sb) 1291#define stat_inc_total_hit(sb)
1275#define stat_inc_read_hit(sb) 1292#define stat_inc_read_hit(sb)
1293#define stat_inc_inline_inode(inode)
1294#define stat_dec_inline_inode(inode)
1276#define stat_inc_seg_type(sbi, curseg) 1295#define stat_inc_seg_type(sbi, curseg)
1277#define stat_inc_block_count(sbi, curseg) 1296#define stat_inc_block_count(sbi, curseg)
1278#define stat_inc_seg_count(si, type) 1297#define stat_inc_seg_count(si, type)
@@ -1299,7 +1318,6 @@ extern const struct inode_operations f2fs_special_inode_operations;
1299/* 1318/*
1300 * inline.c 1319 * inline.c
1301 */ 1320 */
1302inline int f2fs_has_inline_data(struct inode *);
1303bool f2fs_may_inline(struct inode *); 1321bool f2fs_may_inline(struct inode *);
1304int f2fs_read_inline_data(struct inode *, struct page *); 1322int f2fs_read_inline_data(struct inode *, struct page *);
1305int f2fs_convert_inline_data(struct inode *, pgoff_t); 1323int f2fs_convert_inline_data(struct inode *, pgoff_t);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index e8891aa3ab8c..3c9261cd215f 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -13,11 +13,6 @@
13 13
14#include "f2fs.h" 14#include "f2fs.h"
15 15
16inline int f2fs_has_inline_data(struct inode *inode)
17{
18 return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA);
19}
20
21bool f2fs_may_inline(struct inode *inode) 16bool f2fs_may_inline(struct inode *inode)
22{ 17{
23 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 18 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 zero_user_segment(ipage, INLINE_DATA_OFFSET, 108 zero_user_segment(ipage, INLINE_DATA_OFFSET,
114 INLINE_DATA_OFFSET + MAX_INLINE_DATA); 109 INLINE_DATA_OFFSET + MAX_INLINE_DATA);
115 clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA); 110 clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
111 stat_dec_inline_inode(inode);
116 112
117 sync_inode_page(&dn); 113 sync_inode_page(&dn);
118 f2fs_put_page(ipage, 1); 114 f2fs_put_page(ipage, 1);
@@ -165,6 +161,7 @@ int f2fs_write_inline_data(struct inode *inode,
165 if (!f2fs_has_inline_data(inode)) { 161 if (!f2fs_has_inline_data(inode)) {
166 truncate_data_blocks_range(&dn, 1); 162 truncate_data_blocks_range(&dn, 1);
167 set_inode_flag(F2FS_I(inode), FI_INLINE_DATA); 163 set_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
164 stat_inc_inline_inode(inode);
168 } 165 }
169 166
170 sync_inode_page(&dn); 167 sync_inode_page(&dn);
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index a91f45177cd9..915f9a8f3ee6 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -277,6 +277,7 @@ void f2fs_evict_inode(struct inode *inode)
277 277
278 f2fs_lock_op(sbi); 278 f2fs_lock_op(sbi);
279 remove_inode_page(inode); 279 remove_inode_page(inode);
280 stat_dec_inline_inode(inode);
280 f2fs_unlock_op(sbi); 281 f2fs_unlock_op(sbi);
281 282
282 sb_end_intwrite(inode->i_sb); 283 sb_end_intwrite(inode->i_sb);