History

fs: ratelimit __find_get_block_slow() failure message.

When something let __find_get_block_slow() hit all_mapped path, it calls printk() for 100+ times per a second. But there is no need to print same message with such high frequency; it is just asking for stall warning, or at least bloating log files. [ 399.866302][T15342] __find_get_block_slow() failed. block=1, b_blocknr=8 [ 399.873324][T15342] b_state=0x00000029, b_size=512 [ 399.878403][T15342] device loop0 blocksize: 4096 [ 399.883296][T15342] __find_get_block_slow() failed. block=1, b_blocknr=8 [ 399.890400][T15342] b_state=0x00000029, b_size=512 [ 399.895595][T15342] device loop0 blocksize: 4096 [ 399.900556][T15342] __find_get_block_slow() failed. block=1, b_blocknr=8 [ 399.907471][T15342] b_state=0x00000029, b_size=512 [ 399.912506][T15342] device loop0 blocksize: 4096 This patch reduces frequency to up to once per a second, in addition to concatenating three lines into one. [ 399.866302][T15342] __find_get_block_slow() failed. block=1, b_blocknr=8, b_state=0x00000029, b_size=512, device loop0 blocksize: 4096

Tetsuo Handa committed 7 years ago

Commit 43636c81 parent 30363d61 file · +10 −9Browse files

Unified · Split

fs/buffer.c+10−9
@@ -200,6 +200,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) · 199 unmodified lines
200200 struct buffer_head *head;
201201 struct page *page;
202202 int all_mapped = 1;
203+ static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1);
203204
204205 index = block >> (PAGE_SHIFT - bd_inode->i_blkbits);
205206 page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED);
@@ -227,15 +228,15 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) · 21 unmodified lines
227228 * file io on the block device and getblk. It gets dealt with
228229 * elsewhere, don't buffer_error if we had some unmapped buffers
229230 */
230− if (all_mapped) {
231− printk("__find_get_block_slow() failed. "
232− "block=%llu, b_blocknr=%llu\n",
233− (unsigned long long)block,
234− (unsigned long long)bh->b_blocknr);
235− printk("b_state=0x%08lx, b_size=%zu\n",
236− bh->b_state, bh->b_size);
237− printk("device %pg blocksize: %d\n", bdev,
238− 1 << bd_inode->i_blkbits);
231+ ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE);
232+ if (all_mapped && __ratelimit(&last_warned)) {
233+ printk("__find_get_block_slow() failed. block=%llu, "
234+ "b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, "
235+ "device %pg blocksize: %d\n",
236+ (unsigned long long)block,
237+ (unsigned long long)bh->b_blocknr,
238+ bh->b_state, bh->b_size, bdev,
239+ 1 << bd_inode->i_blkbits);
239240 }
240241 out_unlock:
241242 spin_unlock(&bd_mapping->private_lock);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t