Skip to content

Commit 5e5c943

Browse files
committed
xfs: revert "xfs: factor rmap btree size into the indlen calculations"
In commit fd26a88 we added a worst case estimate for rmapbt blocks needed to satisfy the block mapping request. Since then, we added the ability to reserve enough space in each AG such that we should never run out of blocks to grow the rmapbt, which makes this calculation unnecessary. Revert the commit because it makes the extra delalloc indlen accounting unnecessary and incorrect. Reported-by: Eryu Guan <eguan@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
1 parent 842f6e9 commit 5e5c943

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
#include "xfs_rmap.h"
5050
#include "xfs_ag_resv.h"
5151
#include "xfs_refcount.h"
52-
#include "xfs_rmap_btree.h"
5352
#include "xfs_icache.h"
5453

5554

@@ -192,33 +191,21 @@ xfs_bmap_worst_indlen(
192191
int maxrecs; /* maximum record count at this level */
193192
xfs_mount_t *mp; /* mount structure */
194193
xfs_filblks_t rval; /* return value */
195-
xfs_filblks_t orig_len;
196194

197195
mp = ip->i_mount;
198-
199-
/* Calculate the worst-case size of the bmbt. */
200-
orig_len = len;
201196
maxrecs = mp->m_bmap_dmxr[0];
202197
for (level = 0, rval = 0;
203198
level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
204199
level++) {
205200
len += maxrecs - 1;
206201
do_div(len, maxrecs);
207202
rval += len;
208-
if (len == 1) {
209-
rval += XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
203+
if (len == 1)
204+
return rval + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
210205
level - 1;
211-
break;
212-
}
213206
if (level == 0)
214207
maxrecs = mp->m_bmap_dmxr[1];
215208
}
216-
217-
/* Calculate the worst-case size of the rmapbt. */
218-
if (xfs_sb_version_hasrmapbt(&mp->m_sb))
219-
rval += 1 + xfs_rmapbt_calc_size(mp, orig_len) +
220-
mp->m_rmap_maxlevels;
221-
222209
return rval;
223210
}
224211

0 commit comments

Comments
 (0)