aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Elliott <elliott@hp.com>2014-10-21 15:55:11 -0400
committerJens Axboe <axboe@fb.com>2014-10-21 15:55:11 -0400
commit432f16e64f50fd4999a476543d04dd52f7a2d753 (patch)
tree335a65b0145eb02a4f4854e5c6e768c884dc2db8
parentb744c2ac4bbc040794efb33207d6ebc14f88ea2e (diff)
fs: clarify rate limit suppressed buffer I/O errors
When quiet_error applies rate limiting to buffer_io_error calls, what the they apply to is unclear because the name is so generic, particularly if the messages are interleaved with others: [ 1936.063572] quiet_error: 664293 callbacks suppressed [ 1936.065297] Buffer I/O error on dev sdr, logical block 257429952, lost async page write [ 1936.067814] Buffer I/O error on dev sdr, logical block 257429953, lost async page write Also, the function uses printk_ratelimit(), although printk.h includes a comment advising "Please don't use... Instead use printk_ratelimited()." Change buffer_io_error to check the BH_Quiet bit itself, drop the printk_ratelimit call, and print using printk_ratelimited. This makes the messages look like: [ 387.208839] buffer_io_error: 676394 callbacks suppressed [ 387.210693] Buffer I/O error on dev sdr, logical block 211291776, lost async page write [ 387.213432] Buffer I/O error on dev sdr, logical block 211291777, lost async page write Signed-off-by: Robert Elliott <elliott@hp.com> Reviewed-by: Webb Scales <webbnh@hp.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--fs/buffer.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 9d1da1d314a2..20805db2c987 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -128,19 +128,13 @@ __clear_page_buffers(struct page *page)
128 page_cache_release(page); 128 page_cache_release(page);
129} 129}
130 130
131
132static int quiet_error(struct buffer_head *bh)
133{
134 if (!test_bit(BH_Quiet, &bh->b_state) && printk_ratelimit())
135 return 0;
136 return 1;
137}
138
139
140static void buffer_io_error(struct buffer_head *bh, char *msg) 131static void buffer_io_error(struct buffer_head *bh, char *msg)
141{ 132{
142 char b[BDEVNAME_SIZE]; 133 char b[BDEVNAME_SIZE];
143 printk(KERN_ERR "Buffer I/O error on dev %s, logical block %llu%s\n", 134
135 if (!test_bit(BH_Quiet, &bh->b_state))
136 printk_ratelimited(KERN_ERR
137 "Buffer I/O error on dev %s, logical block %llu%s\n",
144 bdevname(bh->b_bdev, b), 138 bdevname(bh->b_bdev, b),
145 (unsigned long long)bh->b_blocknr, msg); 139 (unsigned long long)bh->b_blocknr, msg);
146} 140}
@@ -180,8 +174,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate)
180 if (uptodate) { 174 if (uptodate) {
181 set_buffer_uptodate(bh); 175 set_buffer_uptodate(bh);
182 } else { 176 } else {
183 if (!quiet_error(bh)) 177 buffer_io_error(bh, ", lost sync page write");
184 buffer_io_error(bh, ", lost sync page write");
185 set_buffer_write_io_error(bh); 178 set_buffer_write_io_error(bh);
186 clear_buffer_uptodate(bh); 179 clear_buffer_uptodate(bh);
187 } 180 }
@@ -298,8 +291,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
298 set_buffer_uptodate(bh); 291 set_buffer_uptodate(bh);
299 } else { 292 } else {
300 clear_buffer_uptodate(bh); 293 clear_buffer_uptodate(bh);
301 if (!quiet_error(bh)) 294 buffer_io_error(bh, ", async page read");
302 buffer_io_error(bh, ", async page read");
303 SetPageError(page); 295 SetPageError(page);
304 } 296 }
305 297
@@ -358,8 +350,7 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate)
358 if (uptodate) { 350 if (uptodate) {
359 set_buffer_uptodate(bh); 351 set_buffer_uptodate(bh);
360 } else { 352 } else {
361 if (!quiet_error(bh)) 353 buffer_io_error(bh, ", lost async page write");
362 buffer_io_error(bh, ", lost async page write");
363 set_bit(AS_EIO, &page->mapping->flags); 354 set_bit(AS_EIO, &page->mapping->flags);
364 set_buffer_write_io_error(bh); 355 set_buffer_write_io_error(bh);
365 clear_buffer_uptodate(bh); 356 clear_buffer_uptodate(bh);