aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRobert Elliott <elliott@hp.com>2014-10-21 15:55:09 -0400
committerJens Axboe <axboe@fb.com>2014-10-21 15:55:09 -0400
commitb744c2ac4bbc040794efb33207d6ebc14f88ea2e (patch)
tree220ce36860119b9b2906bb6d6b4e3bcaac77d030 /fs
parentc2661b806092d8ea2dccb7b02b65776555e0ee47 (diff)
fs: merge I/O error prints into one line
buffer.c uses two printk calls to print these messages: [67353.422338] Buffer I/O error on device sdr, logical block 212868488 [67353.422338] lost page write due to I/O error on sdr In a busy system, they may be interleaved with other prints, losing the context for the second message. Merge them into one line with one printk call so the prints are atomic. Also, differentiate between async page writes, sync page writes, and async page reads. Also, shorten "device" to "dev" to match the block layer prints: [67353.467906] blk_update_request: critical target error, dev sdr, sector 1707107328 Also, use %llu rather than %Lu. Resulting prints look like: [ 1356.437006] blk_update_request: critical target error, dev sdr, sector 1719693992 [ 1361.383522] quiet_error: 659876 callbacks suppressed [ 1361.385816] Buffer I/O error on dev sdr, logical block 256902912, lost async page write [ 1361.385819] Buffer I/O error on dev sdr, logical block 256903644, 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>
Diffstat (limited to 'fs')
-rw-r--r--fs/buffer.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 6c48f20eddd4..9d1da1d314a2 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -137,12 +137,12 @@ static int quiet_error(struct buffer_head *bh)
137} 137}
138 138
139 139
140static void buffer_io_error(struct buffer_head *bh) 140static void buffer_io_error(struct buffer_head *bh, char *msg)
141{ 141{
142 char b[BDEVNAME_SIZE]; 142 char b[BDEVNAME_SIZE];
143 printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n", 143 printk(KERN_ERR "Buffer I/O error on dev %s, logical block %llu%s\n",
144 bdevname(bh->b_bdev, b), 144 bdevname(bh->b_bdev, b),
145 (unsigned long long)bh->b_blocknr); 145 (unsigned long long)bh->b_blocknr, msg);
146} 146}
147 147
148/* 148/*
@@ -177,17 +177,11 @@ EXPORT_SYMBOL(end_buffer_read_sync);
177 177
178void end_buffer_write_sync(struct buffer_head *bh, int uptodate) 178void end_buffer_write_sync(struct buffer_head *bh, int uptodate)
179{ 179{
180 char b[BDEVNAME_SIZE];
181
182 if (uptodate) { 180 if (uptodate) {
183 set_buffer_uptodate(bh); 181 set_buffer_uptodate(bh);
184 } else { 182 } else {
185 if (!quiet_error(bh)) { 183 if (!quiet_error(bh))
186 buffer_io_error(bh); 184 buffer_io_error(bh, ", lost sync page write");
187 printk(KERN_WARNING "lost page write due to "
188 "I/O error on %s\n",
189 bdevname(bh->b_bdev, b));
190 }
191 set_buffer_write_io_error(bh); 185 set_buffer_write_io_error(bh);
192 clear_buffer_uptodate(bh); 186 clear_buffer_uptodate(bh);
193 } 187 }
@@ -305,7 +299,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
305 } else { 299 } else {
306 clear_buffer_uptodate(bh); 300 clear_buffer_uptodate(bh);
307 if (!quiet_error(bh)) 301 if (!quiet_error(bh))
308 buffer_io_error(bh); 302 buffer_io_error(bh, ", async page read");
309 SetPageError(page); 303 SetPageError(page);
310 } 304 }
311 305
@@ -353,7 +347,6 @@ still_busy:
353 */ 347 */
354void end_buffer_async_write(struct buffer_head *bh, int uptodate) 348void end_buffer_async_write(struct buffer_head *bh, int uptodate)
355{ 349{
356 char b[BDEVNAME_SIZE];
357 unsigned long flags; 350 unsigned long flags;
358 struct buffer_head *first; 351 struct buffer_head *first;
359 struct buffer_head *tmp; 352 struct buffer_head *tmp;
@@ -365,12 +358,8 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate)
365 if (uptodate) { 358 if (uptodate) {
366 set_buffer_uptodate(bh); 359 set_buffer_uptodate(bh);
367 } else { 360 } else {
368 if (!quiet_error(bh)) { 361 if (!quiet_error(bh))
369 buffer_io_error(bh); 362 buffer_io_error(bh, ", lost async page write");
370 printk(KERN_WARNING "lost page write due to "
371 "I/O error on %s\n",
372 bdevname(bh->b_bdev, b));
373 }
374 set_bit(AS_EIO, &page->mapping->flags); 363 set_bit(AS_EIO, &page->mapping->flags);
375 set_buffer_write_io_error(bh); 364 set_buffer_write_io_error(bh);
376 clear_buffer_uptodate(bh); 365 clear_buffer_uptodate(bh);