diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-02-08 21:59:22 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-02-08 21:59:22 -0500 |
commit | 9924a92a8c217576bd2a2b1bbbb854462f1a00ae (patch) | |
tree | 5c4eaee350e38cd2854fd6029da9f2a822ee184e /fs/ext4/extents.c | |
parent | 722887ddc8982ff40e40b650fbca9ae1e56259bc (diff) |
ext4: pass context information to jbd2__journal_start()
So we can better understand what bits of ext4 are responsible for
long-running jbd2 handles, use jbd2__journal_start() so we can pass
context information for logging purposes.
The recommended way for finding the longer-running handles is:
T=/sys/kernel/debug/tracing
EVENT=$T/events/jbd2/jbd2_handle_stats
echo "interval > 5" > $EVENT/filter
echo 1 > $EVENT/enable
./run-my-fs-benchmark
cat $T/trace > /tmp/problem-handles
This will list handles that were active for longer than 20ms. Having
longer-running handles is bad, because a commit started at the wrong
time could stall for those 20+ milliseconds, which could delay an
fsync() or an O_SYNC operation. Here is an example line from the
trace file describing a handle which lived on for 311 jiffies, or over
1.2 seconds:
postmark-2917 [000] .... 196.435786: jbd2_handle_stats: dev 254,32
tid 570 type 2 line_no 2541 interval 311 sync 0 requested_blocks 1
dirtied_blocks 0
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index db55c62e1f01..b6b54d658dc2 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -2656,7 +2656,7 @@ static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start, | |||
2656 | ext_debug("truncate since %u to %u\n", start, end); | 2656 | ext_debug("truncate since %u to %u\n", start, end); |
2657 | 2657 | ||
2658 | /* probably first extent we're gonna free will be last in block */ | 2658 | /* probably first extent we're gonna free will be last in block */ |
2659 | handle = ext4_journal_start(inode, depth + 1); | 2659 | handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE, depth + 1); |
2660 | if (IS_ERR(handle)) | 2660 | if (IS_ERR(handle)) |
2661 | return PTR_ERR(handle); | 2661 | return PTR_ERR(handle); |
2662 | 2662 | ||
@@ -4287,7 +4287,7 @@ void ext4_ext_truncate(struct inode *inode) | |||
4287 | * probably first extent we're gonna free will be last in block | 4287 | * probably first extent we're gonna free will be last in block |
4288 | */ | 4288 | */ |
4289 | err = ext4_writepage_trans_blocks(inode); | 4289 | err = ext4_writepage_trans_blocks(inode); |
4290 | handle = ext4_journal_start(inode, err); | 4290 | handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE, err); |
4291 | if (IS_ERR(handle)) | 4291 | if (IS_ERR(handle)) |
4292 | return; | 4292 | return; |
4293 | 4293 | ||
@@ -4454,7 +4454,8 @@ retry: | |||
4454 | while (ret >= 0 && ret < max_blocks) { | 4454 | while (ret >= 0 && ret < max_blocks) { |
4455 | map.m_lblk = map.m_lblk + ret; | 4455 | map.m_lblk = map.m_lblk + ret; |
4456 | map.m_len = max_blocks = max_blocks - ret; | 4456 | map.m_len = max_blocks = max_blocks - ret; |
4457 | handle = ext4_journal_start(inode, credits); | 4457 | handle = ext4_journal_start(inode, EXT4_HT_MAP_BLOCKS, |
4458 | credits); | ||
4458 | if (IS_ERR(handle)) { | 4459 | if (IS_ERR(handle)) { |
4459 | ret = PTR_ERR(handle); | 4460 | ret = PTR_ERR(handle); |
4460 | break; | 4461 | break; |
@@ -4532,7 +4533,7 @@ int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, | |||
4532 | while (ret >= 0 && ret < max_blocks) { | 4533 | while (ret >= 0 && ret < max_blocks) { |
4533 | map.m_lblk += ret; | 4534 | map.m_lblk += ret; |
4534 | map.m_len = (max_blocks -= ret); | 4535 | map.m_len = (max_blocks -= ret); |
4535 | handle = ext4_journal_start(inode, credits); | 4536 | handle = ext4_journal_start(inode, EXT4_HT_MAP_BLOCKS, credits); |
4536 | if (IS_ERR(handle)) { | 4537 | if (IS_ERR(handle)) { |
4537 | ret = PTR_ERR(handle); | 4538 | ret = PTR_ERR(handle); |
4538 | break; | 4539 | break; |
@@ -4710,7 +4711,7 @@ int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length) | |||
4710 | inode_dio_wait(inode); | 4711 | inode_dio_wait(inode); |
4711 | 4712 | ||
4712 | credits = ext4_writepage_trans_blocks(inode); | 4713 | credits = ext4_writepage_trans_blocks(inode); |
4713 | handle = ext4_journal_start(inode, credits); | 4714 | handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE, credits); |
4714 | if (IS_ERR(handle)) { | 4715 | if (IS_ERR(handle)) { |
4715 | err = PTR_ERR(handle); | 4716 | err = PTR_ERR(handle); |
4716 | goto out_dio; | 4717 | goto out_dio; |