You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

64 lines
1.9 KiB

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