linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: improve error message when we can't allocate memory for xfs_buf
@ 2020-02-21 15:41 Darrick J. Wong
  2020-02-21 15:49 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2020-02-21 15:41 UTC (permalink / raw)
  To: xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

If xfs_buf_get_map can't allocate enough memory for the buffer it's
trying to create, it'll cough up an error about not being able to
allocate "pagesn".  That's not particularly helpful (and if we're really
out of memory the message is very spammy) so change the message to tell
us how many pages were actually requested, and ratelimit it too.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_buf.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 0ceaa172545b..f8e4fee206ff 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -727,8 +727,9 @@ xfs_buf_get_map(
 	if (!bp->b_addr) {
 		error = _xfs_buf_map_pages(bp, flags);
 		if (unlikely(error)) {
-			xfs_warn(target->bt_mount,
-				"%s: failed to map pagesn", __func__);
+			xfs_warn_ratelimited(target->bt_mount,
+				"%s: failed to map %u pages", __func__,
+				bp->b_page_count);
 			xfs_buf_relse(bp);
 			return error;
 		}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: improve error message when we can't allocate memory for xfs_buf
  2020-02-21 15:41 [PATCH] xfs: improve error message when we can't allocate memory for xfs_buf Darrick J. Wong
@ 2020-02-21 15:49 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2020-02-21 15:49 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs

On Fri, Feb 21, 2020 at 07:41:32AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If xfs_buf_get_map can't allocate enough memory for the buffer it's
> trying to create, it'll cough up an error about not being able to
> allocate "pagesn".  That's not particularly helpful (and if we're really
> out of memory the message is very spammy) so change the message to tell
> us how many pages were actually requested, and ratelimit it too.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-21 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 15:41 [PATCH] xfs: improve error message when we can't allocate memory for xfs_buf Darrick J. Wong
2020-02-21 15:49 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).