summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_bmap_btree.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/libxfs/xfs_bmap_btree.h')
-rw-r--r--fs/xfs/libxfs/xfs_bmap_btree.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.h b/fs/xfs/libxfs/xfs_bmap_btree.h
index 3e05e1b22967..76ac80f46783 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.h
+++ b/fs/xfs/libxfs/xfs_bmap_btree.h
@@ -157,6 +157,13 @@ xfs_bmap_broot_space_calc(
struct xfs_mount *mp,
unsigned int nrecs)
{
+ /*
+ * If the bmbt root block is empty, we should be converting the fork
+ * to extents format. Hence, the size is zero.
+ */
+ if (nrecs == 0)
+ return 0;
+
return xfs_bmbt_block_len(mp) + \
(nrecs * (sizeof(struct xfs_bmbt_key) + sizeof(xfs_bmbt_ptr_t)));
}