@@ -534,6 +534,35 @@ xfs_iwalk_prefetch(
534
534
return max (inobt_records , 2U );
535
535
}
536
536
537
+ static int
538
+ xfs_iwalk_args (
539
+ struct xfs_iwalk_ag * iwag ,
540
+ unsigned int flags )
541
+ {
542
+ struct xfs_mount * mp = iwag -> mp ;
543
+ xfs_agnumber_t agno = XFS_INO_TO_AGNO (mp , iwag -> startino );
544
+ int error ;
545
+
546
+ ASSERT (agno < mp -> m_sb .sb_agcount );
547
+ ASSERT (!(flags & ~XFS_IWALK_FLAGS_ALL ));
548
+
549
+ error = xfs_iwalk_alloc (iwag );
550
+ if (error )
551
+ return error ;
552
+
553
+ for_each_perag_from (mp , agno , iwag -> pag ) {
554
+ error = xfs_iwalk_ag (iwag );
555
+ if (error || (flags & XFS_IWALK_SAME_AG )) {
556
+ xfs_perag_rele (iwag -> pag );
557
+ break ;
558
+ }
559
+ iwag -> startino = XFS_AGINO_TO_INO (mp , agno + 1 , 0 );
560
+ }
561
+
562
+ xfs_iwalk_free (iwag );
563
+ return error ;
564
+ }
565
+
537
566
/*
538
567
* Walk all inodes in the filesystem starting from @startino. The @iwalk_fn
539
568
* will be called for each allocated inode, being passed the inode's number and
@@ -562,32 +591,8 @@ xfs_iwalk(
562
591
.pwork = XFS_PWORK_SINGLE_THREADED ,
563
592
.lastino = NULLFSINO ,
564
593
};
565
- struct xfs_perag * pag ;
566
- xfs_agnumber_t agno = XFS_INO_TO_AGNO (mp , startino );
567
- int error ;
568
-
569
- ASSERT (agno < mp -> m_sb .sb_agcount );
570
- ASSERT (!(flags & ~XFS_IWALK_FLAGS_ALL ));
571
594
572
- error = xfs_iwalk_alloc (& iwag );
573
- if (error )
574
- return error ;
575
-
576
- for_each_perag_from (mp , agno , pag ) {
577
- iwag .pag = pag ;
578
- error = xfs_iwalk_ag (& iwag );
579
- if (error )
580
- break ;
581
- iwag .startino = XFS_AGINO_TO_INO (mp , agno + 1 , 0 );
582
- if (flags & XFS_INOBT_WALK_SAME_AG )
583
- break ;
584
- iwag .pag = NULL ;
585
- }
586
-
587
- if (iwag .pag )
588
- xfs_perag_rele (pag );
589
- xfs_iwalk_free (& iwag );
590
- return error ;
595
+ return xfs_iwalk_args (& iwag , flags );
591
596
}
592
597
593
598
/* Run per-thread iwalk work. */
@@ -673,7 +678,7 @@ xfs_iwalk_threaded(
673
678
iwag -> lastino = NULLFSINO ;
674
679
xfs_pwork_queue (& pctl , & iwag -> pwork );
675
680
startino = XFS_AGINO_TO_INO (mp , pag -> pag_agno + 1 , 0 );
676
- if (flags & XFS_INOBT_WALK_SAME_AG )
681
+ if (flags & XFS_IWALK_SAME_AG )
677
682
break ;
678
683
}
679
684
if (pag )
@@ -747,30 +752,6 @@ xfs_inobt_walk(
747
752
.pwork = XFS_PWORK_SINGLE_THREADED ,
748
753
.lastino = NULLFSINO ,
749
754
};
750
- struct xfs_perag * pag ;
751
- xfs_agnumber_t agno = XFS_INO_TO_AGNO (mp , startino );
752
- int error ;
753
755
754
- ASSERT (agno < mp -> m_sb .sb_agcount );
755
- ASSERT (!(flags & ~XFS_INOBT_WALK_FLAGS_ALL ));
756
-
757
- error = xfs_iwalk_alloc (& iwag );
758
- if (error )
759
- return error ;
760
-
761
- for_each_perag_from (mp , agno , pag ) {
762
- iwag .pag = pag ;
763
- error = xfs_iwalk_ag (& iwag );
764
- if (error )
765
- break ;
766
- iwag .startino = XFS_AGINO_TO_INO (mp , pag -> pag_agno + 1 , 0 );
767
- if (flags & XFS_INOBT_WALK_SAME_AG )
768
- break ;
769
- iwag .pag = NULL ;
770
- }
771
-
772
- if (iwag .pag )
773
- xfs_perag_rele (pag );
774
- xfs_iwalk_free (& iwag );
775
- return error ;
756
+ return xfs_iwalk_args (& iwag , flags );
776
757
}
0 commit comments