Blame SOURCES/xfsprogs-5.0.0-xfs_db-refactor-multi-fsb-object-detection-decision-.patch

3d5736
From 001df390de88731675adae166db5f189924b107f Mon Sep 17 00:00:00 2001
3d5736
From: "Darrick J. Wong" <darrick.wong@oracle.com>
3d5736
Date: Fri, 26 Apr 2019 15:40:24 -0500
3d5736
Subject: [PATCH] xfs_db: refactor multi-fsb object detection decision making
3d5736
3d5736
Pull the "is this a multi-fsb object" decision into a separate function
3d5736
that we can keep close to the actual multi-fsb object dispatcher.  We
3d5736
will soon make the machinery more complex so we do this to avoid having
3d5736
a big hairy if statement.
3d5736
3d5736
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
3d5736
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
3d5736
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
3d5736
---
3d5736
 db/metadump.c | 22 +++++++++++++++++-----
3d5736
 1 file changed, 17 insertions(+), 5 deletions(-)
3d5736
3d5736
Index: xfsprogs-4.5.0/db/metadump.c
3d5736
===================================================================
3d5736
--- xfsprogs-4.5.0.orig/db/metadump.c
3d5736
+++ xfsprogs-4.5.0/db/metadump.c
3d5736
@@ -1757,6 +1757,16 @@ out_pop:
3d5736
 	return ret;
3d5736
 }
3d5736
 
3d5736
+static bool
3d5736
+is_multi_fsb_object(
3d5736
+	struct xfs_mount	*mp,
3d5736
+	typnm_t			btype)
3d5736
+{
3d5736
+	if (btype == TYP_DIR2 && mp->m_dir_geo->fsbcount > 1)
3d5736
+		return true;
3d5736
+	return false;
3d5736
+}
3d5736
+
3d5736
 static int
3d5736
 process_multi_fsb_objects(
3d5736
 	xfs_fileoff_t	o,
3d5736
@@ -1789,6 +1799,7 @@ process_bmbt_reclist(
3d5736
 	xfs_fileoff_t		last;
3d5736
 	xfs_agnumber_t		agno;
3d5736
 	xfs_agblock_t		agbno;
3d5736
+	bool			is_multi_fsb = is_multi_fsb_object(mp, btype);
3d5736
 	int			error;
3d5736
 
3d5736
 	if (btype == TYP_DATA)
3d5736
@@ -1852,11 +1863,12 @@ process_bmbt_reclist(
3d5736
 		}
3d5736
 
3d5736
 		/* multi-extent blocks require special handling */
3d5736
-		if (btype != TYP_DIR2 || mp->m_dir_geo->fsbcount == 1) {
3d5736
-			error = process_single_fsb_objects(o, s, c, btype, last);
3d5736
-		} else {
3d5736
-			error = process_multi_fsb_objects(o, s, c, btype, last);
3d5736
-		}
3d5736
+		if (is_multi_fsb)
3d5736
+			error = process_multi_fsb_objects(o, s, c, btype,
3d5736
+					last);
3d5736
+		else
3d5736
+			error = process_single_fsb_objects(o, s, c, btype,
3d5736
+					last);
3d5736
 		if (error)
3d5736
 			return 0;
3d5736
 	}