Skip to content

Commit cdbcf82

Browse files
committed
xfs: fix xfs_buf_ioerror_alert location reporting
Instead of passing __func__ to the error reporting function, let's use the return address builtins so that the messages actually tell you which higher level function called the buffer functions. This was previously true for the xfs_buf_read callers, but not for the xfs_trans_read_buf callers. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 706b8c5 commit cdbcf82

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

fs/xfs/xfs_buf.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,8 @@ xfs_buf_read_map(
803803
int nmaps,
804804
xfs_buf_flags_t flags,
805805
struct xfs_buf **bpp,
806-
const struct xfs_buf_ops *ops)
806+
const struct xfs_buf_ops *ops,
807+
xfs_failaddr_t fa)
807808
{
808809
struct xfs_buf *bp;
809810
int error;
@@ -852,7 +853,7 @@ xfs_buf_read_map(
852853
*/
853854
if (error) {
854855
if (!XFS_FORCED_SHUTDOWN(target->bt_mount))
855-
xfs_buf_ioerror_alert(bp, __func__);
856+
xfs_buf_ioerror_alert(bp, fa);
856857

857858
bp->b_flags &= ~XBF_DONE;
858859
xfs_buf_stale(bp);
@@ -885,7 +886,8 @@ xfs_buf_readahead_map(
885886
return;
886887

887888
xfs_buf_read_map(target, map, nmaps,
888-
XBF_TRYLOCK | XBF_ASYNC | XBF_READ_AHEAD, &bp, ops);
889+
XBF_TRYLOCK | XBF_ASYNC | XBF_READ_AHEAD, &bp, ops,
890+
__this_address);
889891
}
890892

891893
/*
@@ -1234,10 +1236,10 @@ __xfs_buf_ioerror(
12341236
void
12351237
xfs_buf_ioerror_alert(
12361238
struct xfs_buf *bp,
1237-
const char *func)
1239+
xfs_failaddr_t func)
12381240
{
12391241
xfs_alert(bp->b_mount,
1240-
"metadata I/O error in \"%s\" at daddr 0x%llx len %d error %d",
1242+
"metadata I/O error in \"%pS\" at daddr 0x%llx len %d error %d",
12411243
func, (uint64_t)XFS_BUF_ADDR(bp), bp->b_length,
12421244
-bp->b_error);
12431245
}

fs/xfs/xfs_buf.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ int xfs_buf_get_map(struct xfs_buftarg *target, struct xfs_buf_map *map,
196196
int nmaps, xfs_buf_flags_t flags, struct xfs_buf **bpp);
197197
int xfs_buf_read_map(struct xfs_buftarg *target, struct xfs_buf_map *map,
198198
int nmaps, xfs_buf_flags_t flags, struct xfs_buf **bpp,
199-
const struct xfs_buf_ops *ops);
199+
const struct xfs_buf_ops *ops, xfs_failaddr_t fa);
200200
void xfs_buf_readahead_map(struct xfs_buftarg *target,
201201
struct xfs_buf_map *map, int nmaps,
202202
const struct xfs_buf_ops *ops);
@@ -224,7 +224,8 @@ xfs_buf_read(
224224
{
225225
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
226226

227-
return xfs_buf_read_map(target, &map, 1, flags, bpp, ops);
227+
return xfs_buf_read_map(target, &map, 1, flags, bpp, ops,
228+
__builtin_return_address(0));
228229
}
229230

230231
static inline void
@@ -261,7 +262,7 @@ extern void xfs_buf_ioend(struct xfs_buf *bp);
261262
extern void __xfs_buf_ioerror(struct xfs_buf *bp, int error,
262263
xfs_failaddr_t failaddr);
263264
#define xfs_buf_ioerror(bp, err) __xfs_buf_ioerror((bp), (err), __this_address)
264-
extern void xfs_buf_ioerror_alert(struct xfs_buf *, const char *func);
265+
extern void xfs_buf_ioerror_alert(struct xfs_buf *bp, xfs_failaddr_t fa);
265266

266267
extern int __xfs_buf_submit(struct xfs_buf *bp, bool);
267268
static inline int xfs_buf_submit(struct xfs_buf *bp)

fs/xfs/xfs_buf_item.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ xfs_buf_iodone_callback_error(
11131113
if (bp->b_target != lasttarg ||
11141114
time_after(jiffies, (lasttime + 5*HZ))) {
11151115
lasttime = jiffies;
1116-
xfs_buf_ioerror_alert(bp, __func__);
1116+
xfs_buf_ioerror_alert(bp, __this_address);
11171117
}
11181118
lasttarg = bp->b_target;
11191119

fs/xfs/xfs_log_recover.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ xlog_recover_iodone(
294294
* this during recovery. One strike!
295295
*/
296296
if (!XFS_FORCED_SHUTDOWN(bp->b_mount)) {
297-
xfs_buf_ioerror_alert(bp, __func__);
297+
xfs_buf_ioerror_alert(bp, __this_address);
298298
xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
299299
}
300300
}
@@ -5627,7 +5627,7 @@ xlog_do_recover(
56275627
error = xfs_buf_submit(bp);
56285628
if (error) {
56295629
if (!XFS_FORCED_SHUTDOWN(mp)) {
5630-
xfs_buf_ioerror_alert(bp, __func__);
5630+
xfs_buf_ioerror_alert(bp, __this_address);
56315631
ASSERT(0);
56325632
}
56335633
xfs_buf_relse(bp);

fs/xfs/xfs_trans_buf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ xfs_trans_read_buf_map(
280280
ASSERT(bp->b_ops != NULL);
281281
error = xfs_buf_reverify(bp, ops);
282282
if (error) {
283-
xfs_buf_ioerror_alert(bp, __func__);
283+
xfs_buf_ioerror_alert(bp, __return_address);
284284

285285
if (tp->t_flags & XFS_TRANS_DIRTY)
286286
xfs_force_shutdown(tp->t_mountp,
@@ -302,7 +302,8 @@ xfs_trans_read_buf_map(
302302
return 0;
303303
}
304304

305-
error = xfs_buf_read_map(target, map, nmaps, flags, &bp, ops);
305+
error = xfs_buf_read_map(target, map, nmaps, flags, &bp, ops,
306+
__return_address);
306307
switch (error) {
307308
case 0:
308309
break;

0 commit comments

Comments
 (0)