diff mbox series

[42/36] xfs_db: refactor metadump handling of multi-fsb objects

Message ID 20190320193658.GF1183@magnolia (mailing list archive)
State Accepted
Headers show
Series xfsprogs-5.0: fix various problems | expand

Commit Message

Darrick J. Wong March 20, 2019, 7:36 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Separate the multi-fsb object dispatch from actual dir block processing
so that we can implement symlink handling correctly as a multi-fsb file.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 db/metadump.c |   27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

Comments

Eric Sandeen April 4, 2019, 10:17 p.m. UTC | #1
On 3/20/19 2:36 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Separate the multi-fsb object dispatch from actual dir block processing
> so that we can implement symlink handling correctly as a multi-fsb file.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  db/metadump.c |   27 ++++++++++++++++++---------
>  1 file changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/db/metadump.c b/db/metadump.c
> index 3cce3012..83a257d0 100644
> --- a/db/metadump.c
> +++ b/db/metadump.c
> @@ -1911,7 +1911,7 @@ static struct bbmap mfsb_map;
>  static int mfsb_length;
>  
>  static int
> -process_multi_fsb_objects(
> +process_multi_fsb_dir(
>  	xfs_fileoff_t	o,
>  	xfs_fsblock_t	s,
>  	xfs_filblks_t	c,
> @@ -1921,14 +1921,6 @@ process_multi_fsb_objects(
>  	char		*dp;
>  	int		ret = 0;
>  
> -	switch (btype) {
> -	case TYP_DIR2:
> -		break;
> -	default:
> -		print_warning("bad type for multi-fsb object %d", btype);
> -		return -EINVAL;
> -	}
> -
>  	while (c > 0) {
>  		unsigned int	bm_len;
>  
> @@ -1987,6 +1979,23 @@ process_multi_fsb_objects(
>  	return ret;
>  }
>  
> +static int
> +process_multi_fsb_objects(
> +	xfs_fileoff_t	o,
> +	xfs_fsblock_t	s,
> +	xfs_filblks_t	c,
> +	typnm_t		btype,
> +	xfs_fileoff_t	last)
> +{
> +	switch (btype) {
> +	case TYP_DIR2:
> +		return process_multi_fsb_dir(o, s, c, btype, last);
> +	default:
> +		print_warning("bad type for multi-fsb object %d", btype);
> +		return -EINVAL;
> +	}
> +}
> +
>  /* inode copy routines */
>  static int
>  process_bmbt_reclist(
>
diff mbox series

Patch

diff --git a/db/metadump.c b/db/metadump.c
index 3cce3012..83a257d0 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1911,7 +1911,7 @@  static struct bbmap mfsb_map;
 static int mfsb_length;
 
 static int
-process_multi_fsb_objects(
+process_multi_fsb_dir(
 	xfs_fileoff_t	o,
 	xfs_fsblock_t	s,
 	xfs_filblks_t	c,
@@ -1921,14 +1921,6 @@  process_multi_fsb_objects(
 	char		*dp;
 	int		ret = 0;
 
-	switch (btype) {
-	case TYP_DIR2:
-		break;
-	default:
-		print_warning("bad type for multi-fsb object %d", btype);
-		return -EINVAL;
-	}
-
 	while (c > 0) {
 		unsigned int	bm_len;
 
@@ -1987,6 +1979,23 @@  process_multi_fsb_objects(
 	return ret;
 }
 
+static int
+process_multi_fsb_objects(
+	xfs_fileoff_t	o,
+	xfs_fsblock_t	s,
+	xfs_filblks_t	c,
+	typnm_t		btype,
+	xfs_fileoff_t	last)
+{
+	switch (btype) {
+	case TYP_DIR2:
+		return process_multi_fsb_dir(o, s, c, btype, last);
+	default:
+		print_warning("bad type for multi-fsb object %d", btype);
+		return -EINVAL;
+	}
+}
+
 /* inode copy routines */
 static int
 process_bmbt_reclist(