Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 901796af authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent 4347b9d7
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1004,6 +1004,17 @@ xfs_buf_ioerror(
	trace_xfs_buf_ioerror(bp, error, _RET_IP_);
}

void
xfs_buf_ioerror_alert(
	struct xfs_buf		*bp,
	const char		*func)
{
	xfs_alert(bp->b_target->bt_mount,
"metadata I/O error: block 0x%llx (\"%s\") error %d buf count %zd",
		(__uint64_t)XFS_BUF_ADDR(bp), func,
		bp->b_error, XFS_BUF_COUNT(bp));
}

int
xfs_bwrite(
	struct xfs_buf		*bp)
+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ extern int xfs_bdstrat_cb(struct xfs_buf *);

extern void xfs_buf_ioend(xfs_buf_t *,	int);
extern void xfs_buf_ioerror(xfs_buf_t *, int);
extern void xfs_buf_ioerror_alert(struct xfs_buf *, const char *func);
extern int xfs_buf_iorequest(xfs_buf_t *);
extern int xfs_buf_iowait(xfs_buf_t *);
extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *,
+7 −7
Original line number Diff line number Diff line
@@ -880,7 +880,7 @@ xlog_iodone(xfs_buf_t *bp)
	 */
	if (XFS_TEST_ERROR((xfs_buf_geterror(bp)), l->l_mp,
			XFS_ERRTAG_IODONE_IOERR, XFS_RANDOM_IODONE_IOERR)) {
		xfs_ioerror_alert("xlog_iodone", l->l_mp, bp, XFS_BUF_ADDR(bp));
		xfs_buf_ioerror_alert(bp, __func__);
		xfs_buf_stale(bp);
		xfs_force_shutdown(l->l_mp, SHUTDOWN_LOG_IO_ERROR);
		/*
@@ -1387,9 +1387,9 @@ xlog_sync(xlog_t *log,
	 */
	XFS_BUF_WRITE(bp);

	if ((error = xlog_bdstrat(bp))) {
		xfs_ioerror_alert("xlog_sync", log->l_mp, bp,
				  XFS_BUF_ADDR(bp));
	error = xlog_bdstrat(bp);
	if (error) {
		xfs_buf_ioerror_alert(bp, "xlog_sync");
		return error;
	}
	if (split) {
@@ -1423,9 +1423,9 @@ xlog_sync(xlog_t *log,
		/* account for internal log which doesn't start at block #0 */
		XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart);
		XFS_BUF_WRITE(bp);
		if ((error = xlog_bdstrat(bp))) {
			xfs_ioerror_alert("xlog_sync (split)", log->l_mp,
					  bp, XFS_BUF_ADDR(bp));
		error = xlog_bdstrat(bp);
		if (error) {
			xfs_buf_ioerror_alert(bp, "xlog_sync (split)");
			return error;
		}
	}
+8 −17
Original line number Diff line number Diff line
@@ -183,8 +183,7 @@ xlog_bread_noalign(
	xfsbdstrat(log->l_mp, bp);
	error = xfs_buf_iowait(bp);
	if (error)
		xfs_ioerror_alert("xlog_bread", log->l_mp,
				  bp, XFS_BUF_ADDR(bp));
		xfs_buf_ioerror_alert(bp, __func__);
	return error;
}

@@ -269,10 +268,8 @@ xlog_bwrite(
	XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));

	error = xfs_bwrite(bp);
	if (error) {
		xfs_ioerror_alert("xlog_bwrite", log->l_mp,
				  bp, XFS_BUF_ADDR(bp));
	}
	if (error)
		xfs_buf_ioerror_alert(bp, __func__);
	xfs_buf_relse(bp);
	return error;
}
@@ -364,9 +361,7 @@ xlog_recover_iodone(
		 * We're not going to bother about retrying
		 * this during recovery. One strike!
		 */
		xfs_ioerror_alert("xlog_recover_iodone",
					bp->b_target->bt_mount, bp,
					XFS_BUF_ADDR(bp));
		xfs_buf_ioerror_alert(bp, __func__);
		xfs_force_shutdown(bp->b_target->bt_mount,
					SHUTDOWN_META_IO_ERROR);
	}
@@ -2138,8 +2133,7 @@ xlog_recover_buffer_pass2(
		return XFS_ERROR(ENOMEM);
	error = bp->b_error;
	if (error) {
		xfs_ioerror_alert("xlog_recover_do..(read#1)", mp,
				  bp, buf_f->blf_blkno);
		xfs_buf_ioerror_alert(bp, "xlog_recover_do..(read#1)");
		xfs_buf_relse(bp);
		return error;
	}
@@ -2234,8 +2228,7 @@ xlog_recover_inode_pass2(
	}
	error = bp->b_error;
	if (error) {
		xfs_ioerror_alert("xlog_recover_do..(read#2)", mp,
				  bp, in_f->ilf_blkno);
		xfs_buf_ioerror_alert(bp, "xlog_recover_do..(read#2)");
		xfs_buf_relse(bp);
		goto error;
	}
@@ -2542,8 +2535,7 @@ xlog_recover_dquot_pass2(
			     XFS_FSB_TO_BB(mp, dq_f->qlf_len),
			     0, &bp);
	if (error) {
		xfs_ioerror_alert("xlog_recover_do..(read#3)", mp,
				  bp, dq_f->qlf_blkno);
		xfs_buf_ioerror_alert(bp, "xlog_recover_do..(read#3)");
		return error;
	}
	ASSERT(bp);
@@ -3695,8 +3687,7 @@ xlog_do_recover(
	xfsbdstrat(log->l_mp, bp);
	error = xfs_buf_iowait(bp);
	if (error) {
		xfs_ioerror_alert("xlog_do_recover",
				  log->l_mp, bp, XFS_BUF_ADDR(bp));
		xfs_buf_ioerror_alert(bp, __func__);
		ASSERT(0);
		xfs_buf_relse(bp);
		return error;
+1 −2
Original line number Diff line number Diff line
@@ -1610,8 +1610,7 @@ xfs_unmountfs_writesb(xfs_mount_t *mp)
		xfsbdstrat(mp, sbp);
		error = xfs_buf_iowait(sbp);
		if (error)
			xfs_ioerror_alert("xfs_unmountfs_writesb",
					  mp, sbp, XFS_BUF_ADDR(sbp));
			xfs_buf_ioerror_alert(sbp, __func__);
		xfs_buf_relse(sbp);
	}
	return error;
Loading