Whamcloud - gitweb
lib/{ext2fs,support}: fix 32-bit Windows build
[tools/e2fsprogs.git] / lib / ext2fs / alloc_tables.c
index 407283f..e8a1fef 100644 (file)
@@ -33,7 +33,7 @@
  * This routine searches for free blocks that can allocate a full
  * group of bitmaps or inode tables for a flexbg group.  Returns the
  * block number with a correct offset were the bitmaps and inode
- * tables can be allocated continously and in order.
+ * tables can be allocated continuously and in order.
  */
 static blk64_t flexbg_offset(ext2_filsys fs, dgrp_t group, blk64_t start_blk,
                             ext2fs_block_bitmap bmap, int rem_grp,
@@ -43,7 +43,7 @@ static blk64_t flexbg_offset(ext2_filsys fs, dgrp_t group, blk64_t start_blk,
        blk64_t         last_blk, first_free = 0;
        dgrp_t          last_grp;
 
-       flexbg_size = 1 << fs->super->s_log_groups_per_flex;
+       flexbg_size = 1U << fs->super->s_log_groups_per_flex;
        flexbg = group / flexbg_size;
        size = rem_grp * elem_size;
 
@@ -97,7 +97,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
 
        if (ext2fs_has_feature_flex_bg(fs->super) &&
            fs->super->s_log_groups_per_flex) {
-               flexbg_size = 1 << fs->super->s_log_groups_per_flex;
+               flexbg_size = 1U << fs->super->s_log_groups_per_flex;
                last_grp = group | (flexbg_size - 1);
                if (last_grp > fs->group_desc_count-1)
                        last_grp = fs->group_desc_count-1;
@@ -107,7 +107,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
        /*
         * Allocate the block and inode bitmaps, if necessary
         */
-       if (fs->stride) {
+       if (fs->stride && !flexbg_size) {
                retval = ext2fs_get_free_blocks2(fs, group_blk, last_blk,
                                                 1, bmap, &start_blk);
                if (retval)