@@ -811,6 +811,10 @@ xfs_inode_ag_walk_grab(
811
811
return false;
812
812
}
813
813
814
+ /*
815
+ * For a given per-AG structure @pag, grab, @execute, and rele all incore
816
+ * inodes with the given radix tree @tag.
817
+ */
814
818
STATIC int
815
819
xfs_inode_ag_walk (
816
820
struct xfs_mount * mp ,
@@ -916,6 +920,50 @@ xfs_inode_ag_walk(
916
920
return last_error ;
917
921
}
918
922
923
+ /* Fetch the next (possibly tagged) per-AG structure. */
924
+ static inline struct xfs_perag *
925
+ xfs_inode_walk_get_perag (
926
+ struct xfs_mount * mp ,
927
+ xfs_agnumber_t agno ,
928
+ int tag )
929
+ {
930
+ if (tag == XFS_ICI_NO_TAG )
931
+ return xfs_perag_get (mp , agno );
932
+ return xfs_perag_get_tag (mp , agno , tag );
933
+ }
934
+
935
+ /*
936
+ * Call the @execute function on all incore inodes matching the radix tree
937
+ * @tag.
938
+ */
939
+ int
940
+ xfs_inode_ag_iterator (
941
+ struct xfs_mount * mp ,
942
+ int iter_flags ,
943
+ int (* execute )(struct xfs_inode * ip , void * args ),
944
+ void * args ,
945
+ int tag )
946
+ {
947
+ struct xfs_perag * pag ;
948
+ int error = 0 ;
949
+ int last_error = 0 ;
950
+ xfs_agnumber_t ag ;
951
+
952
+ ag = 0 ;
953
+ while ((pag = xfs_inode_walk_get_perag (mp , ag , tag ))) {
954
+ ag = pag -> pag_agno + 1 ;
955
+ error = xfs_inode_ag_walk (mp , pag , execute , args , tag ,
956
+ iter_flags );
957
+ xfs_perag_put (pag );
958
+ if (error ) {
959
+ last_error = error ;
960
+ if (error == - EFSCORRUPTED )
961
+ break ;
962
+ }
963
+ }
964
+ return last_error ;
965
+ }
966
+
919
967
/*
920
968
* Background scanning to trim post-EOF preallocated space. This is queued
921
969
* based on the 'speculative_prealloc_lifetime' tunable (5m by default).
@@ -979,46 +1027,6 @@ xfs_cowblocks_worker(
979
1027
xfs_queue_cowblocks (mp );
980
1028
}
981
1029
982
- /* Fetch the next (possibly tagged) per-AG structure. */
983
- static inline struct xfs_perag *
984
- xfs_inode_walk_get_perag (
985
- struct xfs_mount * mp ,
986
- xfs_agnumber_t agno ,
987
- int tag )
988
- {
989
- if (tag == XFS_ICI_NO_TAG )
990
- return xfs_perag_get (mp , agno );
991
- return xfs_perag_get_tag (mp , agno , tag );
992
- }
993
-
994
- int
995
- xfs_inode_ag_iterator (
996
- struct xfs_mount * mp ,
997
- int iter_flags ,
998
- int (* execute )(struct xfs_inode * ip , void * args ),
999
- void * args ,
1000
- int tag )
1001
- {
1002
- struct xfs_perag * pag ;
1003
- int error = 0 ;
1004
- int last_error = 0 ;
1005
- xfs_agnumber_t ag ;
1006
-
1007
- ag = 0 ;
1008
- while ((pag = xfs_inode_walk_get_perag (mp , ag , tag ))) {
1009
- ag = pag -> pag_agno + 1 ;
1010
- error = xfs_inode_ag_walk (mp , pag , execute , args , tag ,
1011
- iter_flags );
1012
- xfs_perag_put (pag );
1013
- if (error ) {
1014
- last_error = error ;
1015
- if (error == - EFSCORRUPTED )
1016
- break ;
1017
- }
1018
- }
1019
- return last_error ;
1020
- }
1021
-
1022
1030
/*
1023
1031
* Grab the inode for reclaim exclusively.
1024
1032
* Return 0 if we grabbed it, non-zero otherwise.
0 commit comments