diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-10-10 12:52:49 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2011-10-11 22:15:10 -0400 |
commit | 901796afca0d31d97bf6d1bf2ab251a93a4b8c83 (patch) | |
tree | 85f204657d81700492487acbf39fb9702e6b0842 /fs/xfs | |
parent | 4347b9d7ad4223474d315c3ab6bc1ce7cce7fa2d (diff) |
xfs: clean up xfs_ioerror_alert
Instead of passing the block number and mount structure explicitly
get them off the bp and fix make the argument order more natural.
Also move it to xfs_buf.c and stop printing the device name given
that we already get the fs name as part of xfs_alert, and we know
what device is operates on because of the caller that gets printed,
finally rename it to xfs_buf_ioerror_alert and pass __func__ as
argument where it makes sense.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_buf.c | 11 | ||||
-rw-r--r-- | fs/xfs/xfs_buf.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 25 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_rw.c | 20 | ||||
-rw-r--r-- | fs/xfs/xfs_rw.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_buf.c | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 11 |
9 files changed, 37 insertions, 59 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 1f24ee5f0d7a..0a767fca0305 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -1004,6 +1004,17 @@ xfs_buf_ioerror( | |||
1004 | trace_xfs_buf_ioerror(bp, error, _RET_IP_); | 1004 | trace_xfs_buf_ioerror(bp, error, _RET_IP_); |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | void | ||
1008 | xfs_buf_ioerror_alert( | ||
1009 | struct xfs_buf *bp, | ||
1010 | const char *func) | ||
1011 | { | ||
1012 | xfs_alert(bp->b_target->bt_mount, | ||
1013 | "metadata I/O error: block 0x%llx (\"%s\") error %d buf count %zd", | ||
1014 | (__uint64_t)XFS_BUF_ADDR(bp), func, | ||
1015 | bp->b_error, XFS_BUF_COUNT(bp)); | ||
1016 | } | ||
1017 | |||
1007 | int | 1018 | int |
1008 | xfs_bwrite( | 1019 | xfs_bwrite( |
1009 | struct xfs_buf *bp) | 1020 | struct xfs_buf *bp) |
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index 26b909417deb..357a3371cae7 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h | |||
@@ -205,6 +205,7 @@ extern int xfs_bdstrat_cb(struct xfs_buf *); | |||
205 | 205 | ||
206 | extern void xfs_buf_ioend(xfs_buf_t *, int); | 206 | extern void xfs_buf_ioend(xfs_buf_t *, int); |
207 | extern void xfs_buf_ioerror(xfs_buf_t *, int); | 207 | extern void xfs_buf_ioerror(xfs_buf_t *, int); |
208 | extern void xfs_buf_ioerror_alert(struct xfs_buf *, const char *func); | ||
208 | extern int xfs_buf_iorequest(xfs_buf_t *); | 209 | extern int xfs_buf_iorequest(xfs_buf_t *); |
209 | extern int xfs_buf_iowait(xfs_buf_t *); | 210 | extern int xfs_buf_iowait(xfs_buf_t *); |
210 | extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *, | 211 | extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *, |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 8c9db4e5ddd2..2758a6277c52 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -880,7 +880,7 @@ xlog_iodone(xfs_buf_t *bp) | |||
880 | */ | 880 | */ |
881 | if (XFS_TEST_ERROR((xfs_buf_geterror(bp)), l->l_mp, | 881 | if (XFS_TEST_ERROR((xfs_buf_geterror(bp)), l->l_mp, |
882 | XFS_ERRTAG_IODONE_IOERR, XFS_RANDOM_IODONE_IOERR)) { | 882 | XFS_ERRTAG_IODONE_IOERR, XFS_RANDOM_IODONE_IOERR)) { |
883 | xfs_ioerror_alert("xlog_iodone", l->l_mp, bp, XFS_BUF_ADDR(bp)); | 883 | xfs_buf_ioerror_alert(bp, __func__); |
884 | xfs_buf_stale(bp); | 884 | xfs_buf_stale(bp); |
885 | xfs_force_shutdown(l->l_mp, SHUTDOWN_LOG_IO_ERROR); | 885 | xfs_force_shutdown(l->l_mp, SHUTDOWN_LOG_IO_ERROR); |
886 | /* | 886 | /* |
@@ -1387,9 +1387,9 @@ xlog_sync(xlog_t *log, | |||
1387 | */ | 1387 | */ |
1388 | XFS_BUF_WRITE(bp); | 1388 | XFS_BUF_WRITE(bp); |
1389 | 1389 | ||
1390 | if ((error = xlog_bdstrat(bp))) { | 1390 | error = xlog_bdstrat(bp); |
1391 | xfs_ioerror_alert("xlog_sync", log->l_mp, bp, | 1391 | if (error) { |
1392 | XFS_BUF_ADDR(bp)); | 1392 | xfs_buf_ioerror_alert(bp, "xlog_sync"); |
1393 | return error; | 1393 | return error; |
1394 | } | 1394 | } |
1395 | if (split) { | 1395 | if (split) { |
@@ -1423,9 +1423,9 @@ xlog_sync(xlog_t *log, | |||
1423 | /* account for internal log which doesn't start at block #0 */ | 1423 | /* account for internal log which doesn't start at block #0 */ |
1424 | XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart); | 1424 | XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart); |
1425 | XFS_BUF_WRITE(bp); | 1425 | XFS_BUF_WRITE(bp); |
1426 | if ((error = xlog_bdstrat(bp))) { | 1426 | error = xlog_bdstrat(bp); |
1427 | xfs_ioerror_alert("xlog_sync (split)", log->l_mp, | 1427 | if (error) { |
1428 | bp, XFS_BUF_ADDR(bp)); | 1428 | xfs_buf_ioerror_alert(bp, "xlog_sync (split)"); |
1429 | return error; | 1429 | return error; |
1430 | } | 1430 | } |
1431 | } | 1431 | } |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 8f70f3469997..82ee9db628ed 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -183,8 +183,7 @@ xlog_bread_noalign( | |||
183 | xfsbdstrat(log->l_mp, bp); | 183 | xfsbdstrat(log->l_mp, bp); |
184 | error = xfs_buf_iowait(bp); | 184 | error = xfs_buf_iowait(bp); |
185 | if (error) | 185 | if (error) |
186 | xfs_ioerror_alert("xlog_bread", log->l_mp, | 186 | xfs_buf_ioerror_alert(bp, __func__); |
187 | bp, XFS_BUF_ADDR(bp)); | ||
188 | return error; | 187 | return error; |
189 | } | 188 | } |
190 | 189 | ||
@@ -269,10 +268,8 @@ xlog_bwrite( | |||
269 | XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); | 268 | XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); |
270 | 269 | ||
271 | error = xfs_bwrite(bp); | 270 | error = xfs_bwrite(bp); |
272 | if (error) { | 271 | if (error) |
273 | xfs_ioerror_alert("xlog_bwrite", log->l_mp, | 272 | xfs_buf_ioerror_alert(bp, __func__); |
274 | bp, XFS_BUF_ADDR(bp)); | ||
275 | } | ||
276 | xfs_buf_relse(bp); | 273 | xfs_buf_relse(bp); |
277 | return error; | 274 | return error; |
278 | } | 275 | } |
@@ -364,9 +361,7 @@ xlog_recover_iodone( | |||
364 | * We're not going to bother about retrying | 361 | * We're not going to bother about retrying |
365 | * this during recovery. One strike! | 362 | * this during recovery. One strike! |
366 | */ | 363 | */ |
367 | xfs_ioerror_alert("xlog_recover_iodone", | 364 | xfs_buf_ioerror_alert(bp, __func__); |
368 | bp->b_target->bt_mount, bp, | ||
369 | XFS_BUF_ADDR(bp)); | ||
370 | xfs_force_shutdown(bp->b_target->bt_mount, | 365 | xfs_force_shutdown(bp->b_target->bt_mount, |
371 | SHUTDOWN_META_IO_ERROR); | 366 | SHUTDOWN_META_IO_ERROR); |
372 | } | 367 | } |
@@ -2138,8 +2133,7 @@ xlog_recover_buffer_pass2( | |||
2138 | return XFS_ERROR(ENOMEM); | 2133 | return XFS_ERROR(ENOMEM); |
2139 | error = bp->b_error; | 2134 | error = bp->b_error; |
2140 | if (error) { | 2135 | if (error) { |
2141 | xfs_ioerror_alert("xlog_recover_do..(read#1)", mp, | 2136 | xfs_buf_ioerror_alert(bp, "xlog_recover_do..(read#1)"); |
2142 | bp, buf_f->blf_blkno); | ||
2143 | xfs_buf_relse(bp); | 2137 | xfs_buf_relse(bp); |
2144 | return error; | 2138 | return error; |
2145 | } | 2139 | } |
@@ -2234,8 +2228,7 @@ xlog_recover_inode_pass2( | |||
2234 | } | 2228 | } |
2235 | error = bp->b_error; | 2229 | error = bp->b_error; |
2236 | if (error) { | 2230 | if (error) { |
2237 | xfs_ioerror_alert("xlog_recover_do..(read#2)", mp, | 2231 | xfs_buf_ioerror_alert(bp, "xlog_recover_do..(read#2)"); |
2238 | bp, in_f->ilf_blkno); | ||
2239 | xfs_buf_relse(bp); | 2232 | xfs_buf_relse(bp); |
2240 | goto error; | 2233 | goto error; |
2241 | } | 2234 | } |
@@ -2542,8 +2535,7 @@ xlog_recover_dquot_pass2( | |||
2542 | XFS_FSB_TO_BB(mp, dq_f->qlf_len), | 2535 | XFS_FSB_TO_BB(mp, dq_f->qlf_len), |
2543 | 0, &bp); | 2536 | 0, &bp); |
2544 | if (error) { | 2537 | if (error) { |
2545 | xfs_ioerror_alert("xlog_recover_do..(read#3)", mp, | 2538 | xfs_buf_ioerror_alert(bp, "xlog_recover_do..(read#3)"); |
2546 | bp, dq_f->qlf_blkno); | ||
2547 | return error; | 2539 | return error; |
2548 | } | 2540 | } |
2549 | ASSERT(bp); | 2541 | ASSERT(bp); |
@@ -3695,8 +3687,7 @@ xlog_do_recover( | |||
3695 | xfsbdstrat(log->l_mp, bp); | 3687 | xfsbdstrat(log->l_mp, bp); |
3696 | error = xfs_buf_iowait(bp); | 3688 | error = xfs_buf_iowait(bp); |
3697 | if (error) { | 3689 | if (error) { |
3698 | xfs_ioerror_alert("xlog_do_recover", | 3690 | xfs_buf_ioerror_alert(bp, __func__); |
3699 | log->l_mp, bp, XFS_BUF_ADDR(bp)); | ||
3700 | ASSERT(0); | 3691 | ASSERT(0); |
3701 | xfs_buf_relse(bp); | 3692 | xfs_buf_relse(bp); |
3702 | return error; | 3693 | return error; |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index e8fe1cb54094..f3b1cec38b81 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -1610,8 +1610,7 @@ xfs_unmountfs_writesb(xfs_mount_t *mp) | |||
1610 | xfsbdstrat(mp, sbp); | 1610 | xfsbdstrat(mp, sbp); |
1611 | error = xfs_buf_iowait(sbp); | 1611 | error = xfs_buf_iowait(sbp); |
1612 | if (error) | 1612 | if (error) |
1613 | xfs_ioerror_alert("xfs_unmountfs_writesb", | 1613 | xfs_buf_ioerror_alert(sbp, __func__); |
1614 | mp, sbp, XFS_BUF_ADDR(sbp)); | ||
1615 | xfs_buf_relse(sbp); | 1614 | xfs_buf_relse(sbp); |
1616 | } | 1615 | } |
1617 | return error; | 1616 | return error; |
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c index 86f1928b4cfa..597d044a09a1 100644 --- a/fs/xfs/xfs_rw.c +++ b/fs/xfs/xfs_rw.c | |||
@@ -92,24 +92,6 @@ xfs_do_force_shutdown( | |||
92 | } | 92 | } |
93 | 93 | ||
94 | /* | 94 | /* |
95 | * Prints out an ALERT message about I/O error. | ||
96 | */ | ||
97 | void | ||
98 | xfs_ioerror_alert( | ||
99 | char *func, | ||
100 | struct xfs_mount *mp, | ||
101 | xfs_buf_t *bp, | ||
102 | xfs_daddr_t blkno) | ||
103 | { | ||
104 | xfs_alert(mp, | ||
105 | "I/O error occurred: meta-data dev %s block 0x%llx" | ||
106 | " (\"%s\") error %d buf count %zd", | ||
107 | xfs_buf_target_name(bp->b_target), | ||
108 | (__uint64_t)blkno, func, | ||
109 | bp->b_error, XFS_BUF_COUNT(bp)); | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * This isn't an absolute requirement, but it is | 95 | * This isn't an absolute requirement, but it is |
114 | * just a good idea to call xfs_read_buf instead of | 96 | * just a good idea to call xfs_read_buf instead of |
115 | * directly doing a read_buf call. For one, we shouldn't | 97 | * directly doing a read_buf call. For one, we shouldn't |
@@ -143,7 +125,7 @@ xfs_read_buf( | |||
143 | } else { | 125 | } else { |
144 | *bpp = NULL; | 126 | *bpp = NULL; |
145 | if (error) { | 127 | if (error) { |
146 | xfs_ioerror_alert("xfs_read_buf", mp, bp, XFS_BUF_ADDR(bp)); | 128 | xfs_buf_ioerror_alert(bp, __func__); |
147 | } else { | 129 | } else { |
148 | error = XFS_ERROR(EIO); | 130 | error = XFS_ERROR(EIO); |
149 | } | 131 | } |
diff --git a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h index 11c41ec6ed75..bbdb9ad6a4ba 100644 --- a/fs/xfs/xfs_rw.h +++ b/fs/xfs/xfs_rw.h | |||
@@ -42,8 +42,6 @@ xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb) | |||
42 | extern int xfs_read_buf(struct xfs_mount *mp, xfs_buftarg_t *btp, | 42 | extern int xfs_read_buf(struct xfs_mount *mp, xfs_buftarg_t *btp, |
43 | xfs_daddr_t blkno, int len, uint flags, | 43 | xfs_daddr_t blkno, int len, uint flags, |
44 | struct xfs_buf **bpp); | 44 | struct xfs_buf **bpp); |
45 | extern void xfs_ioerror_alert(char *func, struct xfs_mount *mp, | ||
46 | xfs_buf_t *bp, xfs_daddr_t blkno); | ||
47 | extern xfs_extlen_t xfs_get_extsz_hint(struct xfs_inode *ip); | 45 | extern xfs_extlen_t xfs_get_extsz_hint(struct xfs_inode *ip); |
48 | 46 | ||
49 | #endif /* __XFS_RW_H__ */ | 47 | #endif /* __XFS_RW_H__ */ |
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index 5bab5980a6f9..475a4ded4f41 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c | |||
@@ -296,8 +296,7 @@ xfs_trans_read_buf( | |||
296 | 296 | ||
297 | if (bp->b_error) { | 297 | if (bp->b_error) { |
298 | error = bp->b_error; | 298 | error = bp->b_error; |
299 | xfs_ioerror_alert("xfs_trans_read_buf", mp, | 299 | xfs_buf_ioerror_alert(bp, __func__); |
300 | bp, blkno); | ||
301 | xfs_buf_relse(bp); | 300 | xfs_buf_relse(bp); |
302 | return error; | 301 | return error; |
303 | } | 302 | } |
@@ -339,8 +338,7 @@ xfs_trans_read_buf( | |||
339 | xfsbdstrat(tp->t_mountp, bp); | 338 | xfsbdstrat(tp->t_mountp, bp); |
340 | error = xfs_buf_iowait(bp); | 339 | error = xfs_buf_iowait(bp); |
341 | if (error) { | 340 | if (error) { |
342 | xfs_ioerror_alert("xfs_trans_read_buf", mp, | 341 | xfs_buf_ioerror_alert(bp, __func__); |
343 | bp, blkno); | ||
344 | xfs_buf_relse(bp); | 342 | xfs_buf_relse(bp); |
345 | /* | 343 | /* |
346 | * We can gracefully recover from most read | 344 | * We can gracefully recover from most read |
@@ -391,8 +389,7 @@ xfs_trans_read_buf( | |||
391 | error = bp->b_error; | 389 | error = bp->b_error; |
392 | xfs_buf_stale(bp); | 390 | xfs_buf_stale(bp); |
393 | XFS_BUF_DONE(bp); | 391 | XFS_BUF_DONE(bp); |
394 | xfs_ioerror_alert("xfs_trans_read_buf", mp, | 392 | xfs_buf_ioerror_alert(bp, __func__); |
395 | bp, blkno); | ||
396 | if (tp->t_flags & XFS_TRANS_DIRTY) | 393 | if (tp->t_flags & XFS_TRANS_DIRTY) |
397 | xfs_force_shutdown(tp->t_mountp, SHUTDOWN_META_IO_ERROR); | 394 | xfs_force_shutdown(tp->t_mountp, SHUTDOWN_META_IO_ERROR); |
398 | xfs_buf_relse(bp); | 395 | xfs_buf_relse(bp); |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index fc38f15808c6..4ecf2a549060 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -87,8 +87,7 @@ xfs_readlink_bmap( | |||
87 | return XFS_ERROR(ENOMEM); | 87 | return XFS_ERROR(ENOMEM); |
88 | error = bp->b_error; | 88 | error = bp->b_error; |
89 | if (error) { | 89 | if (error) { |
90 | xfs_ioerror_alert("xfs_readlink", | 90 | xfs_buf_ioerror_alert(bp, __func__); |
91 | ip->i_mount, bp, XFS_BUF_ADDR(bp)); | ||
92 | xfs_buf_relse(bp); | 91 | xfs_buf_relse(bp); |
93 | goto out; | 92 | goto out; |
94 | } | 93 | } |
@@ -1993,8 +1992,8 @@ xfs_zero_remaining_bytes( | |||
1993 | xfsbdstrat(mp, bp); | 1992 | xfsbdstrat(mp, bp); |
1994 | error = xfs_buf_iowait(bp); | 1993 | error = xfs_buf_iowait(bp); |
1995 | if (error) { | 1994 | if (error) { |
1996 | xfs_ioerror_alert("xfs_zero_remaining_bytes(read)", | 1995 | xfs_buf_ioerror_alert(bp, |
1997 | mp, bp, XFS_BUF_ADDR(bp)); | 1996 | "xfs_zero_remaining_bytes(read)"); |
1998 | break; | 1997 | break; |
1999 | } | 1998 | } |
2000 | memset(bp->b_addr + | 1999 | memset(bp->b_addr + |
@@ -2006,8 +2005,8 @@ xfs_zero_remaining_bytes( | |||
2006 | xfsbdstrat(mp, bp); | 2005 | xfsbdstrat(mp, bp); |
2007 | error = xfs_buf_iowait(bp); | 2006 | error = xfs_buf_iowait(bp); |
2008 | if (error) { | 2007 | if (error) { |
2009 | xfs_ioerror_alert("xfs_zero_remaining_bytes(write)", | 2008 | xfs_buf_ioerror_alert(bp, |
2010 | mp, bp, XFS_BUF_ADDR(bp)); | 2009 | "xfs_zero_remaining_bytes(write)"); |
2011 | break; | 2010 | break; |
2012 | } | 2011 | } |
2013 | } | 2012 | } |