mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
ext4: split ext4_journal_start trace for debug
we might want to know why jbd2 thread using high io for detail, split ext4_journal_start trace to ext4_journal_start_sb and ext4_journal_start_inode, show ino and handle type when possible. Signed-off-by: changfengnan <changfengnan@bytedance.com> Link: https://lore.kernel.org/r/20221008120518.74870-1-changfengnan@bytedance.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
e3ea75ee65
commit
5f3e240321
@ -86,15 +86,21 @@ static int ext4_journal_check_start(struct super_block *sb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_t *__ext4_journal_start_sb(struct super_block *sb, unsigned int line,
|
handle_t *__ext4_journal_start_sb(struct inode *inode,
|
||||||
|
struct super_block *sb, unsigned int line,
|
||||||
int type, int blocks, int rsv_blocks,
|
int type, int blocks, int rsv_blocks,
|
||||||
int revoke_creds)
|
int revoke_creds)
|
||||||
{
|
{
|
||||||
journal_t *journal;
|
journal_t *journal;
|
||||||
int err;
|
int err;
|
||||||
|
if (inode)
|
||||||
trace_ext4_journal_start(sb, blocks, rsv_blocks, revoke_creds,
|
trace_ext4_journal_start_inode(inode, blocks, rsv_blocks,
|
||||||
_RET_IP_);
|
revoke_creds, type,
|
||||||
|
_RET_IP_);
|
||||||
|
else
|
||||||
|
trace_ext4_journal_start_sb(sb, blocks, rsv_blocks,
|
||||||
|
revoke_creds, type,
|
||||||
|
_RET_IP_);
|
||||||
err = ext4_journal_check_start(sb);
|
err = ext4_journal_check_start(sb);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
@ -261,9 +261,9 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
|
|||||||
__ext4_handle_dirty_metadata(__func__, __LINE__, (handle), (inode), \
|
__ext4_handle_dirty_metadata(__func__, __LINE__, (handle), (inode), \
|
||||||
(bh))
|
(bh))
|
||||||
|
|
||||||
handle_t *__ext4_journal_start_sb(struct super_block *sb, unsigned int line,
|
handle_t *__ext4_journal_start_sb(struct inode *inode, struct super_block *sb,
|
||||||
int type, int blocks, int rsv_blocks,
|
unsigned int line, int type, int blocks,
|
||||||
int revoke_creds);
|
int rsv_blocks, int revoke_creds);
|
||||||
int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle);
|
int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle);
|
||||||
|
|
||||||
#define EXT4_NOJOURNAL_MAX_REF_COUNT ((unsigned long) 4096)
|
#define EXT4_NOJOURNAL_MAX_REF_COUNT ((unsigned long) 4096)
|
||||||
@ -303,7 +303,7 @@ static inline int ext4_trans_default_revoke_credits(struct super_block *sb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define ext4_journal_start_sb(sb, type, nblocks) \
|
#define ext4_journal_start_sb(sb, type, nblocks) \
|
||||||
__ext4_journal_start_sb((sb), __LINE__, (type), (nblocks), 0, \
|
__ext4_journal_start_sb(NULL, (sb), __LINE__, (type), (nblocks), 0,\
|
||||||
ext4_trans_default_revoke_credits(sb))
|
ext4_trans_default_revoke_credits(sb))
|
||||||
|
|
||||||
#define ext4_journal_start(inode, type, nblocks) \
|
#define ext4_journal_start(inode, type, nblocks) \
|
||||||
@ -323,7 +323,7 @@ static inline handle_t *__ext4_journal_start(struct inode *inode,
|
|||||||
int blocks, int rsv_blocks,
|
int blocks, int rsv_blocks,
|
||||||
int revoke_creds)
|
int revoke_creds)
|
||||||
{
|
{
|
||||||
return __ext4_journal_start_sb(inode->i_sb, line, type, blocks,
|
return __ext4_journal_start_sb(inode, inode->i_sb, line, type, blocks,
|
||||||
rsv_blocks, revoke_creds);
|
rsv_blocks, revoke_creds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,8 +1076,8 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,
|
|||||||
|
|
||||||
if ((!(sbi->s_mount_state & EXT4_FC_REPLAY)) && !handle) {
|
if ((!(sbi->s_mount_state & EXT4_FC_REPLAY)) && !handle) {
|
||||||
BUG_ON(nblocks <= 0);
|
BUG_ON(nblocks <= 0);
|
||||||
handle = __ext4_journal_start_sb(dir->i_sb, line_no,
|
handle = __ext4_journal_start_sb(NULL, dir->i_sb,
|
||||||
handle_type, nblocks, 0,
|
line_no, handle_type, nblocks, 0,
|
||||||
ext4_trans_default_revoke_credits(sb));
|
ext4_trans_default_revoke_credits(sb));
|
||||||
if (IS_ERR(handle)) {
|
if (IS_ERR(handle)) {
|
||||||
err = PTR_ERR(handle);
|
err = PTR_ERR(handle);
|
||||||
|
@ -1744,18 +1744,19 @@ TRACE_EVENT(ext4_load_inode,
|
|||||||
(unsigned long) __entry->ino)
|
(unsigned long) __entry->ino)
|
||||||
);
|
);
|
||||||
|
|
||||||
TRACE_EVENT(ext4_journal_start,
|
TRACE_EVENT(ext4_journal_start_sb,
|
||||||
TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
|
TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
|
||||||
int revoke_creds, unsigned long IP),
|
int revoke_creds, int type, unsigned long IP),
|
||||||
|
|
||||||
TP_ARGS(sb, blocks, rsv_blocks, revoke_creds, IP),
|
TP_ARGS(sb, blocks, rsv_blocks, revoke_creds, type, IP),
|
||||||
|
|
||||||
TP_STRUCT__entry(
|
TP_STRUCT__entry(
|
||||||
__field( dev_t, dev )
|
__field( dev_t, dev )
|
||||||
__field(unsigned long, ip )
|
__field( unsigned long, ip )
|
||||||
__field( int, blocks )
|
__field( int, blocks )
|
||||||
__field( int, rsv_blocks )
|
__field( int, rsv_blocks )
|
||||||
__field( int, revoke_creds )
|
__field( int, revoke_creds )
|
||||||
|
__field( int, type )
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_fast_assign(
|
TP_fast_assign(
|
||||||
@ -1764,11 +1765,45 @@ TRACE_EVENT(ext4_journal_start,
|
|||||||
__entry->blocks = blocks;
|
__entry->blocks = blocks;
|
||||||
__entry->rsv_blocks = rsv_blocks;
|
__entry->rsv_blocks = rsv_blocks;
|
||||||
__entry->revoke_creds = revoke_creds;
|
__entry->revoke_creds = revoke_creds;
|
||||||
|
__entry->type = type;
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d, "
|
TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d,"
|
||||||
"caller %pS", MAJOR(__entry->dev), MINOR(__entry->dev),
|
" type %d, caller %pS", MAJOR(__entry->dev),
|
||||||
__entry->blocks, __entry->rsv_blocks, __entry->revoke_creds,
|
MINOR(__entry->dev), __entry->blocks, __entry->rsv_blocks,
|
||||||
|
__entry->revoke_creds, __entry->type, (void *)__entry->ip)
|
||||||
|
);
|
||||||
|
|
||||||
|
TRACE_EVENT(ext4_journal_start_inode,
|
||||||
|
TP_PROTO(struct inode *inode, int blocks, int rsv_blocks,
|
||||||
|
int revoke_creds, int type, unsigned long IP),
|
||||||
|
|
||||||
|
TP_ARGS(inode, blocks, rsv_blocks, revoke_creds, type, IP),
|
||||||
|
|
||||||
|
TP_STRUCT__entry(
|
||||||
|
__field( unsigned long, ino )
|
||||||
|
__field( dev_t, dev )
|
||||||
|
__field( unsigned long, ip )
|
||||||
|
__field( int, blocks )
|
||||||
|
__field( int, rsv_blocks )
|
||||||
|
__field( int, revoke_creds )
|
||||||
|
__field( int, type )
|
||||||
|
),
|
||||||
|
|
||||||
|
TP_fast_assign(
|
||||||
|
__entry->dev = inode->i_sb->s_dev;
|
||||||
|
__entry->ip = IP;
|
||||||
|
__entry->blocks = blocks;
|
||||||
|
__entry->rsv_blocks = rsv_blocks;
|
||||||
|
__entry->revoke_creds = revoke_creds;
|
||||||
|
__entry->type = type;
|
||||||
|
__entry->ino = inode->i_ino;
|
||||||
|
),
|
||||||
|
|
||||||
|
TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d,"
|
||||||
|
" type %d, ino %lu, caller %pS", MAJOR(__entry->dev),
|
||||||
|
MINOR(__entry->dev), __entry->blocks, __entry->rsv_blocks,
|
||||||
|
__entry->revoke_creds, __entry->type, __entry->ino,
|
||||||
(void *)__entry->ip)
|
(void *)__entry->ip)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user