Commit b744c2ac authored by Robert Elliott's avatar Robert Elliott Committed by Jens Axboe

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: default avatarRobert Elliott <elliott@hp.com>
Reviewed-by: default avatarWebb Scales <webbnh@hp.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent c2661b80
...@@ -137,12 +137,12 @@ static int quiet_error(struct buffer_head *bh) ...@@ -137,12 +137,12 @@ static int quiet_error(struct buffer_head *bh)
} }
static void buffer_io_error(struct buffer_head *bh) static void buffer_io_error(struct buffer_head *bh, char *msg)
{ {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n", printk(KERN_ERR "Buffer I/O error on dev %s, logical block %llu%s\n",
bdevname(bh->b_bdev, b), bdevname(bh->b_bdev, b),
(unsigned long long)bh->b_blocknr); (unsigned long long)bh->b_blocknr, msg);
} }
/* /*
...@@ -177,17 +177,11 @@ EXPORT_SYMBOL(end_buffer_read_sync); ...@@ -177,17 +177,11 @@ EXPORT_SYMBOL(end_buffer_read_sync);
void end_buffer_write_sync(struct buffer_head *bh, int uptodate) void end_buffer_write_sync(struct buffer_head *bh, int uptodate)
{ {
char b[BDEVNAME_SIZE];
if (uptodate) { if (uptodate) {
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
} else { } else {
if (!quiet_error(bh)) { if (!quiet_error(bh))
buffer_io_error(bh); buffer_io_error(bh, ", lost sync page write");
printk(KERN_WARNING "lost page write due to "
"I/O error on %s\n",
bdevname(bh->b_bdev, b));
}
set_buffer_write_io_error(bh); set_buffer_write_io_error(bh);
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
} }
...@@ -305,7 +299,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -305,7 +299,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
} else { } else {
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
if (!quiet_error(bh)) if (!quiet_error(bh))
buffer_io_error(bh); buffer_io_error(bh, ", async page read");
SetPageError(page); SetPageError(page);
} }
...@@ -353,7 +347,6 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -353,7 +347,6 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
*/ */
void end_buffer_async_write(struct buffer_head *bh, int uptodate) void end_buffer_async_write(struct buffer_head *bh, int uptodate)
{ {
char b[BDEVNAME_SIZE];
unsigned long flags; unsigned long flags;
struct buffer_head *first; struct buffer_head *first;
struct buffer_head *tmp; struct buffer_head *tmp;
...@@ -365,12 +358,8 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate) ...@@ -365,12 +358,8 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate)
if (uptodate) { if (uptodate) {
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
} else { } else {
if (!quiet_error(bh)) { if (!quiet_error(bh))
buffer_io_error(bh); buffer_io_error(bh, ", lost async page write");
printk(KERN_WARNING "lost page write due to "
"I/O error on %s\n",
bdevname(bh->b_bdev, b));
}
set_bit(AS_EIO, &page->mapping->flags); set_bit(AS_EIO, &page->mapping->flags);
set_buffer_write_io_error(bh); set_buffer_write_io_error(bh);
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment