diff mbox series

[2/2] xfs: ratelimit xfs_discard_page alert messages

Message ID 20200220040549.366547-3-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/2] xfs: ratelimit xfs_buf_ioerror_alert | expand

Commit Message

Christoph Hellwig Feb. 20, 2020, 4:05 a.m. UTC
Use printk_ratelimit() to limit the amount of messages printed from
xfs_discard_page.  Without that a failing device causes a large
number of errors that doesn't really help debugging the underling
issue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_aops.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 58e937be24ce..acdda808fbdd 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -539,9 +539,10 @@  xfs_discard_page(
 	if (XFS_FORCED_SHUTDOWN(mp))
 		goto out_invalidate;
 
-	xfs_alert(mp,
-		"page discard on page "PTR_FMT", inode 0x%llx, offset %llu.",
-			page, ip->i_ino, offset);
+	if (printk_ratelimit())
+		xfs_alert(mp,
+			"page discard on page "PTR_FMT", inode 0x%llx, offset %llu.",
+				page, ip->i_ino, offset);
 
 	error = xfs_bmap_punch_delalloc_range(ip, start_fsb,
 			PAGE_SIZE / i_blocksize(inode));