From: Zheng Liu <gnehzuil.liu@gmail.com>
To: Steven Whitehouse <swhiteho@redhat.com>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Zheng Liu <wenqing.lz@taobao.com>,
Wang Shaoyan <wangshaoyan.pt@taobao.com>
Subject: Re: [PATCH v2 2/8] ext4: Add new data structures and related functions to count io types
Date: Fri, 11 Nov 2011 23:45:55 +0800 [thread overview]
Message-ID: <20111111154555.GC6826@gmail.com> (raw)
In-Reply-To: <1321009091.2710.41.camel@menhir>
On Fri, Nov 11, 2011 at 10:58:11AM +0000, Steven Whitehouse wrote:
> Hi,
>
> On Thu, 2011-11-10 at 18:34 +0800, Zheng Liu wrote:
> > From: Zheng Liu <wenqing.lz@taobao.com>
> >
> > A per-cpu counter is defined to store io types in ext4. We define 10 io types
> > in ext4, which includes 9 metadata types and 1 data type. Read and write
> > operations are counted separately. When checks 'Issue' flag, filesystem needs
> > to lock buffer.
> >
> > Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> > Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
> > ---
> > fs/ext4/ext4.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> > fs/ext4/super.c | 19 +++++++++++++++++++
> > 2 files changed, 72 insertions(+), 0 deletions(-)
> >
> > diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> > index 5b0e26a..39a1495 100644
> > --- a/fs/ext4/ext4.h
> > +++ b/fs/ext4/ext4.h
> > @@ -1108,6 +1108,23 @@ struct ext4_super_block {
> > #define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */
> >
> > /*
> > + * ext4 io types
> > + */
> > +enum {
> > + EXT4_IOS_SUPER_BLOCK = 0,
> > + EXT4_IOS_GROUP_DESC,
> > + EXT4_IOS_INODE_BITMAP,
> > + EXT4_IOS_BLOCK_BITMAP,
> > + EXT4_IOS_INODE_TABLE,
> > + EXT4_IOS_EXTENT_BLOCK,
> > + EXT4_IOS_INDIRECT_BLOCK,
> > + EXT4_IOS_DIR_ENTRY,
> > + EXT4_IOS_EXTENDED_ATTR,
> > + EXT4_IOS_REGULAR_DATA,
> > + EXT4_IOS_TYPE_END,
> > +};
> > +
> > +/*
> > * fourth extended-fs super-block data in memory
> > */
> > struct ext4_sb_info {
> > @@ -1284,6 +1301,11 @@ static inline void ext4_set_io_unwritten_flag(struct inode *inode,
> > }
> > }
> >
> > +static inline unsigned ext4_blocks_per_page(struct inode *inode)
> > +{
> > + return PAGE_CACHE_SIZE >> inode->i_blkbits;
> > +}
> > +
> > /*
> > * Inode dynamic state flags
> > */
> > @@ -1926,6 +1948,37 @@ extern int ext4_group_extend(struct super_block *sb,
> > ext4_fsblk_t n_blocks_count);
> >
> > /* super.c */
> > +extern void __ext4_io_stat(int, int, unsigned long);
> > +#define ext4_ios_read(bh, type, count) \
> > + do { \
> > + if (!bh) \
> > + break; \
> > + lock_buffer(bh); \
> > + if (buffer_issue(bh)) { \
> > + clear_buffer_issue(bh); \
> > + __ext4_io_stat(READ, type, count); \
> > + } \
> > + unlock_buffer(bh); \
> > + } while (0)
> Why not just test_and_clear_bit(BH_Issue) ? I don't follow why the
> buffer needs to be locked and unlocked,
test_and_clear_bit(BH_Issue) is better. Calling lock/unlock_buffer() is
to ensure 'Issue' flag can be set or cleared atomically. It is
unnecessary after using test_and_clear_bit(BH_Issue).
Regards,
Zheng
>
> Steve.
>
>
next prev parent reply other threads:[~2011-11-11 15:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 10:34 [PATCH v2 0/8] Filesystem io types statistic Zheng Liu
2011-11-10 10:34 ` [PATCH v2 1/8] vfs: Add a new flag and related functions in buffer to count io types Zheng Liu
2011-11-11 10:48 ` Steven Whitehouse
2011-11-11 15:36 ` Zheng Liu
2011-11-10 10:34 ` [PATCH v2 2/8] ext4: Add new data structures and related functions " Zheng Liu
2011-11-11 10:58 ` Steven Whitehouse
2011-11-11 15:45 ` Zheng Liu [this message]
2011-11-10 10:34 ` [PATCH v2 3/8] ext4: Count metadata request of read operations in buffered io Zheng Liu
2011-11-10 10:34 ` [PATCH v2 4/8] ext4: Count data " Zheng Liu
2011-11-10 10:34 ` [PATCH v2 5/8] ext4: Count metadata request of write " Zheng Liu
2011-11-10 10:34 ` [PATCH v2 6/8] ext4: Count data " Zheng Liu
2011-11-10 10:34 ` [PATCH v2 7/8] ext4: Count all requests in direct io Zheng Liu
2011-11-10 10:34 ` [PATCH v2 8/8] ext4: Show the result of io types statistic in sysfs Zheng Liu
2011-11-11 10:55 ` [PATCH v2 0/8] Filesystem io types statistic Steven Whitehouse
2011-11-11 15:32 ` Zheng Liu
2011-11-14 10:23 ` Steven Whitehouse
2011-11-14 13:35 ` Zheng Liu
2011-11-15 18:34 ` Aditya Kali
2011-11-16 8:43 ` Zheng Liu
2011-11-16 10:14 ` Steven Whitehouse
2011-11-18 2:48 ` Zheng Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111111154555.GC6826@gmail.com \
--to=gnehzuil.liu@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=swhiteho@redhat.com \
--cc=wangshaoyan.pt@taobao.com \
--cc=wenqing.lz@taobao.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).