Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755126AbbLQCoK (ORCPT ); Wed, 16 Dec 2015 21:44:10 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:49067 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752836AbbLQCoI (ORCPT ); Wed, 16 Dec 2015 21:44:08 -0500 X-AuditID: cbfee61b-f793c6d00000236c-b4-56722176563a From: Chao Yu To: "'Jaegeuk Kim'" Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <000001d137c2$05ff5e20$11fe1a60$@samsung.com> <20151216173717.GB74292@jaegeuk.local> In-reply-to: <20151216173717.GB74292@jaegeuk.local> Subject: RE: [PATCH v2 5/7] f2fs: stat dirty regular/symlink inodes Date: Thu, 17 Dec 2015 10:43:25 +0800 Message-id: <006001d13874$cc41ef50$64c5cdf0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQG1hHipTdKLkarhbjXubz1USdI+pQHqFITLnvZzoFA= Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRmVeSWpSXmKPExsVy+t9jQd0yxaIwg9UnFSyerJ/FbHFpkbvF 5V1z2ByYPTat6mTz2L3gM5PH501yAcxRXDYpqTmZZalF+nYJXBl7T95iKjiiXdH/2a6Bcbly FyMHh4SAicSk6dVdjJxAppjEhXvr2boYuTiEBGYxSvRtOsYC4bxilHj7azojSBWbgIrE8o7/ TCC2iICaRO++KWA2s4CHRGPHd1aQoUICSRJNL1JBwpwCxhILd99lAbGFBZwl7l3fwwZiswio Snw4+44ZxOYVsJT4sn8TK4QtKPFj8j0WiJFaEut3HocaLy+xec1bZohDFSR2nH3NCHGClcT2 o28ZIWrEJTYeucUygVFoFpJRs5CMmoVk1CwkLQsYWVYxSqQWJBcUJ6XnGuWllusVJ+YWl+al 6yXn525iBAf8M+kdjId3uR9iFOBgVOLhFdhXGCbEmlhWXJl7iFGCg1lJhPf7HqAQb0piZVVq UX58UWlOavEhRmkOFiVx3n2XIsOEBNITS1KzU1MLUotgskwcnFINjNFCKpeP/pzrqls3KWm3 oGmEo85dVee0pmfLXv/P/OLsa7v+5UGLr19/L1nmZPQo4YTg8b++rFHhEWsulW4XuXmKNf6o dV86l83d7luf2+27ONp4LNy6j0qznJ0+x2LvhwP7Hidzl5cv3pTxdFF3iIGCxh6PjQsC2O78 kLwu+4b1+dNtUws8riixFGckGmoxFxUnAgA2ySCpdAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5673 Lines: 149 Hi Jaegeuk, > -----Original Message----- > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > Sent: Thursday, December 17, 2015 1:37 AM > To: Chao Yu > Cc: linux-f2fs-devel@lists.sourceforge.net; linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2 5/7] f2fs: stat dirty regular/symlink inodes > > Hi Chao, > > We need to change this patch to avoid build warnings. > > On Wed, Dec 16, 2015 at 01:23:44PM +0800, Chao Yu wrote: > > Add to stat dirty regular and symlink inode for showing in debugfs. > > > > Signed-off-by: Chao Yu > > --- > > v2: > > - rename F2FS_DIRTY_DATAS to F2FS_DIRTY_DATA > > --- > > fs/f2fs/checkpoint.c | 4 ++++ > > fs/f2fs/debug.c | 4 ++++ > > fs/f2fs/f2fs.h | 8 +++++++- > > 3 files changed, 15 insertions(+), 1 deletion(-) > > > > diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c > > index f33c4d7..b2af2c16 100644 > > --- a/fs/f2fs/checkpoint.c > > +++ b/fs/f2fs/checkpoint.c > > @@ -735,6 +735,8 @@ static void __add_dirty_inode(struct inode *inode, enum inode_type type) > > list_add_tail(&fi->dirty_list, &sbi->inode_list[type]); > > if (type == DIR_INODE) > > stat_inc_dirty_dir(sbi); > > + else > > + stat_inc_dirty_file(sbi); > > If we don't set F2FS_STAT_FS, this causes unreferenced sbi. > > How about something like this? > > stat_inc_dirty_inode(F2FS_I_SB(inode), type); > > #ifdef > stat_inc_dirty_inode(sbi, type) (sbi)->ndirty_inode[type]++; > stat_dec_dirty_inode(sbi, type) (sbi)->ndirty_inode[type]--; > #else > stat_inc_dirty_inode > stat_dec_dirty_inode > #endif More neat, will do. :) Thanks, > > > } > > > > static void __remove_dirty_inode(struct inode *inode, enum inode_type type) > > @@ -751,6 +753,8 @@ static void __remove_dirty_inode(struct inode *inode, enum inode_type > type) > > clear_inode_flag(fi, flag); > > if (type == DIR_INODE) > > stat_dec_dirty_dir(sbi); > > + else > > + stat_dec_dirty_file(sbi); > > > stat_dec_dirty_inode(F2FS_I_SB(inode), type); > > > } > > > > void update_dirty_page(struct inode *inode, struct page *page) > > diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c > > index f4a7b9e..780d5ed1 100644 > > --- a/fs/f2fs/debug.c > > +++ b/fs/f2fs/debug.c > > @@ -42,7 +42,9 @@ static void update_general_status(struct f2fs_sb_info *sbi) > > si->ext_node = atomic_read(&sbi->total_ext_node); > > si->ndirty_node = get_pages(sbi, F2FS_DIRTY_NODES); > > si->ndirty_dent = get_pages(sbi, F2FS_DIRTY_DENTS); > > + si->ndirty_data = get_pages(sbi, F2FS_DIRTY_DATA); > > si->ndirty_dirs = sbi->n_dirty_dirs; > > + si->ndirty_files = sbi->n_dirty_files; > > ... = sbi->n_dirty_inode[FILE_INODE]; > ... = sbi->n_dirty_inode[DIR_INODE]; > > > si->ndirty_meta = get_pages(sbi, F2FS_DIRTY_META); > > si->inmem_pages = get_pages(sbi, F2FS_INMEM_PAGES); > > si->wb_pages = get_pages(sbi, F2FS_WRITEBACK); > > @@ -298,6 +300,8 @@ static int stat_show(struct seq_file *s, void *v) > > si->ndirty_node, si->node_pages); > > seq_printf(s, " - dents: %4d in dirs:%4d\n", > > si->ndirty_dent, si->ndirty_dirs); > > + seq_printf(s, " - datas: %4d in files:%4d\n", > > + si->ndirty_data, si->ndirty_files); > > seq_printf(s, " - meta: %4d in %4d\n", > > si->ndirty_meta, si->meta_pages); > > seq_printf(s, " - NATs: %9d/%9d\n - SITs: %9d/%9d\n", > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > > index c68c4a3..e73ddea 100644 > > --- a/fs/f2fs/f2fs.h > > +++ b/fs/f2fs/f2fs.h > > @@ -818,6 +818,7 @@ struct f2fs_sb_info { > > atomic_t inline_dir; /* # of inline_dentry inodes */ > > int bg_gc; /* background gc calls */ > > unsigned int n_dirty_dirs; /* # of dir inodes */ > > + unsigned int n_dirty_files; /* # of regular/symlink inodes */ > > #endif > > unsigned int last_victim[2]; /* last victim segment # */ > > spinlock_t stat_lock; /* lock for stat operations */ > > @@ -1887,7 +1888,8 @@ struct f2fs_stat_info { > > unsigned long long hit_largest, hit_cached, hit_rbtree; > > unsigned long long hit_total, total_ext; > > int ext_tree, ext_node; > > - int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta; > > + int ndirty_node, ndirty_meta; > > + int ndirty_dent, ndirty_dirs, ndirty_data, ndirty_files; > > int nats, dirty_nats, sits, dirty_sits, fnids; > > int total_count, utilization; > > int bg_gc, inmem_pages, wb_pages; > > @@ -1922,6 +1924,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) > > #define stat_inc_bggc_count(sbi) ((sbi)->bg_gc++) > > #define stat_inc_dirty_dir(sbi) ((sbi)->n_dirty_dirs++) > > #define stat_dec_dirty_dir(sbi) ((sbi)->n_dirty_dirs--) > > +#define stat_inc_dirty_file(sbi) ((sbi)->n_dirty_files++) > > +#define stat_dec_dirty_file(sbi) ((sbi)->n_dirty_files--) > > #define stat_inc_total_hit(sbi) (atomic64_inc(&(sbi)->total_hit_ext)) > > #define stat_inc_rbtree_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_rbtree)) > > #define stat_inc_largest_node_hit(sbi) (atomic64_inc(&(sbi)->read_hit_largest)) > > @@ -2004,6 +2008,8 @@ void f2fs_destroy_root_stats(void); > > #define stat_inc_bggc_count(si) > > #define stat_inc_dirty_dir(sbi) > > #define stat_dec_dirty_dir(sbi) > > +#define stat_inc_dirty_file(sbi) > > +#define stat_dec_dirty_file(sbi) > > #define stat_inc_total_hit(sb) > > #define stat_inc_rbtree_node_hit(sb) > > #define stat_inc_largest_node_hit(sbi) > > -- > > 2.6.3 > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/