31
31
#include "xfs_error.h"
32
32
#include "xfs_bmap.h"
33
33
#include "xfs_bmap_btree.h"
34
+ #include "xfs_bmap_util.h"
34
35
#include "xfs_trans.h"
35
36
#include "xfs_trans_space.h"
36
37
#include "xfs_qm.h"
@@ -1120,31 +1121,6 @@ xfs_qm_quotacheck_dqadjust(
1120
1121
return 0 ;
1121
1122
}
1122
1123
1123
- STATIC int
1124
- xfs_qm_get_rtblks (
1125
- xfs_inode_t * ip ,
1126
- xfs_qcnt_t * O_rtblks )
1127
- {
1128
- xfs_filblks_t rtblks ; /* total rt blks */
1129
- xfs_extnum_t idx ; /* extent record index */
1130
- xfs_ifork_t * ifp ; /* inode fork pointer */
1131
- xfs_extnum_t nextents ; /* number of extent entries */
1132
- int error ;
1133
-
1134
- ASSERT (XFS_IS_REALTIME_INODE (ip ));
1135
- ifp = XFS_IFORK_PTR (ip , XFS_DATA_FORK );
1136
- if (!(ifp -> if_flags & XFS_IFEXTENTS )) {
1137
- if ((error = xfs_iread_extents (NULL , ip , XFS_DATA_FORK )))
1138
- return error ;
1139
- }
1140
- rtblks = 0 ;
1141
- nextents = xfs_iext_count (ifp );
1142
- for (idx = 0 ; idx < nextents ; idx ++ )
1143
- rtblks += xfs_bmbt_get_blockcount (xfs_iext_get_ext (ifp , idx ));
1144
- * O_rtblks = (xfs_qcnt_t )rtblks ;
1145
- return 0 ;
1146
- }
1147
-
1148
1124
/*
1149
1125
* callback routine supplied to bulkstat(). Given an inumber, find its
1150
1126
* dquots and update them to account for resources taken by that inode.
@@ -1160,7 +1136,8 @@ xfs_qm_dqusage_adjust(
1160
1136
int * res ) /* result code value */
1161
1137
{
1162
1138
xfs_inode_t * ip ;
1163
- xfs_qcnt_t nblks , rtblks = 0 ;
1139
+ xfs_qcnt_t nblks ;
1140
+ xfs_filblks_t rtblks = 0 ; /* total rt blks */
1164
1141
int error ;
1165
1142
1166
1143
ASSERT (XFS_IS_QUOTA_RUNNING (mp ));
@@ -1190,12 +1167,15 @@ xfs_qm_dqusage_adjust(
1190
1167
ASSERT (ip -> i_delayed_blks == 0 );
1191
1168
1192
1169
if (XFS_IS_REALTIME_INODE (ip )) {
1193
- /*
1194
- * Walk thru the extent list and count the realtime blocks.
1195
- */
1196
- error = xfs_qm_get_rtblks (ip , & rtblks );
1197
- if (error )
1198
- goto error0 ;
1170
+ struct xfs_ifork * ifp = XFS_IFORK_PTR (ip , XFS_DATA_FORK );
1171
+
1172
+ if (!(ifp -> if_flags & XFS_IFEXTENTS )) {
1173
+ error = xfs_iread_extents (NULL , ip , XFS_DATA_FORK );
1174
+ if (error )
1175
+ goto error0 ;
1176
+ }
1177
+
1178
+ xfs_bmap_count_leaves (ifp , & rtblks );
1199
1179
}
1200
1180
1201
1181
nblks = (xfs_qcnt_t )ip -> i_d .di_nblocks - rtblks ;
0 commit comments