linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 1/6] xfs: decrease indenting problems in xfs_dabuf_map
Date: Sun, 03 Nov 2019 14:24:10 -0800	[thread overview]
Message-ID: <157281985084.4151907.11548453010559620958.stgit@magnolia> (raw)
In-Reply-To: <157281984457.4151907.11281776450827989936.stgit@magnolia>

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

Refactor the code that complains when a dir/attr mapping doesn't exist
but the caller requires a mapping.  This small restructuring helps us to
reduce the indenting level.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_da_btree.c |   38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)


diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index 1e2dc65adeb8..9925d4a7dc33 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -2567,26 +2567,30 @@ xfs_dabuf_map(
 	}
 
 	if (!xfs_da_map_covers_blocks(nirecs, irecs, bno, nfsb)) {
-		error = mappedbno == -2 ? -1 : -EFSCORRUPTED;
-		if (unlikely(error == -EFSCORRUPTED)) {
-			if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
-				int i;
-				xfs_alert(mp, "%s: bno %lld dir: inode %lld",
-					__func__, (long long)bno,
-					(long long)dp->i_ino);
-				for (i = 0; i < *nmaps; i++) {
-					xfs_alert(mp,
+		/* Caller ok with no mapping. */
+		if (mappedbno == -2) {
+			error = -1;
+			goto out;
+		}
+
+		/* Caller expected a mapping, so abort. */
+		if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
+			int i;
+
+			xfs_alert(mp, "%s: bno %lld dir: inode %lld", __func__,
+					(long long)bno, (long long)dp->i_ino);
+			for (i = 0; i < *nmaps; i++) {
+				xfs_alert(mp,
 "[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d",
-						i,
-						(long long)irecs[i].br_startoff,
-						(long long)irecs[i].br_startblock,
-						(long long)irecs[i].br_blockcount,
-						irecs[i].br_state);
-				}
+					i,
+					(long long)irecs[i].br_startoff,
+					(long long)irecs[i].br_startblock,
+					(long long)irecs[i].br_blockcount,
+					irecs[i].br_state);
 			}
-			XFS_ERROR_REPORT("xfs_da_do_buf(1)",
-					 XFS_ERRLEVEL_LOW, mp);
 		}
+		XFS_ERROR_REPORT("xfs_da_do_buf(1)", XFS_ERRLEVEL_LOW, mp);
+		error = -EFSCORRUPTED;
 		goto out;
 	}
 	error = xfs_buf_map_from_irec(mp, map, nmaps, irecs, nirecs);


  reply	other threads:[~2019-11-03 22:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03 22:24 [PATCH 0/6] xfs: refactor corruption checking and reporting Darrick J. Wong
2019-11-03 22:24 ` Darrick J. Wong [this message]
2019-11-05  0:44   ` [PATCH 1/6] xfs: decrease indenting problems in xfs_dabuf_map Christoph Hellwig
2019-11-03 22:24 ` [PATCH 2/6] xfs: add missing assert in xfs_fsmap_owner_from_rmap Darrick J. Wong
2019-11-05  0:44   ` Christoph Hellwig
2019-11-03 22:24 ` [PATCH 3/6] xfs: make the assertion message functions take a mount parameter Darrick J. Wong
2019-11-05  0:45   ` Christoph Hellwig
2019-11-05  1:08     ` Darrick J. Wong
2019-11-05  1:09   ` [PATCH v2 " Darrick J. Wong
2019-11-05 15:50     ` Christoph Hellwig
2019-11-03 22:24 ` [PATCH 4/6] xfs: add a XFS_CORRUPT_ON macro Darrick J. Wong
2019-11-05  0:48   ` Christoph Hellwig
2019-11-05  0:51     ` Darrick J. Wong
2019-11-06  4:58   ` [PATCH v2 4/6] xfs: add a XFS_IS_CORRUPT macro Darrick J. Wong
2019-11-03 22:24 ` [PATCH 5/6] xfs: kill the XFS_WANT_CORRUPT_* macros Darrick J. Wong
2019-11-06  4:58   ` [PATCH v2 " Darrick J. Wong
2019-11-03 22:24 ` [PATCH 6/6] xfs: convert open coded corruption check to use XFS_CORRUPT_ON Darrick J. Wong
2019-11-06  4:58   ` [PATCH v2 6/6] xfs: convert open coded corruption check to use XFS_IS_CORRUPT Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=157281985084.4151907.11548453010559620958.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).