+
+/*
+ * This function reserves the superblock and block group descriptors
+ * for a given block group and returns the number of blocks used by the
+ * super block and group descriptors by looking up the block bitmap.
+ */
+errcode_t ext2fs_reserve_super_and_bgd2(ext2_filsys fs,
+ dgrp_t group,
+ ext2fs_block_bitmap bmap,
+ blk_t *desc_blocks)
+{
+ blk64_t num_blocks;
+ errcode_t retval = 0;
+
+ ext2fs_reserve_super_and_bgd(fs, group, bmap);
+
+ retval = ext2fs_count_used_blocks(fs,
+ ext2fs_group_first_block2(fs, group),
+ ext2fs_group_last_block2(fs, group),
+ &num_blocks);
+ if (!retval)
+ *desc_blocks = num_blocks;
+
+ return retval;
+}