set_field(s_raid_stripe_width, 0); /* default stripe width: 0 */
set_field(s_log_groups_per_flex, 0);
set_field(s_flags, 0);
+ assign_field(s_backup_bgs[0]);
+ assign_field(s_backup_bgs[1]);
if (super->s_feature_incompat & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) {
retval = EXT2_ET_UNSUPP_FEATURE;
goto cleanup;
goto cleanup;
}
- if (super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
- super->s_desc_size = EXT2_MIN_DESC_SIZE_64BIT;
+ set_field(s_desc_size,
+ super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ?
+ EXT2_MIN_DESC_SIZE_64BIT : 0);
fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count,
EXT2_DESC_PER_BLOCK(super));
* count.
*/
+ /* Set up the locations of the backup superblocks */
+ if (super->s_feature_compat & EXT4_FEATURE_COMPAT_SPARSE_SUPER2) {
+ if (super->s_backup_bgs[0] >= fs->group_desc_count)
+ super->s_backup_bgs[0] = fs->group_desc_count - 1;
+ if (super->s_backup_bgs[1] >= fs->group_desc_count)
+ super->s_backup_bgs[1] = fs->group_desc_count - 1;
+ if (super->s_backup_bgs[0] == super->s_backup_bgs[1])
+ super->s_backup_bgs[1] = 0;
+ if (super->s_backup_bgs[0] > super->s_backup_bgs[1]) {
+ __u32 t = super->s_backup_bgs[0];
+ super->s_backup_bgs[0] = super->s_backup_bgs[1];
+ super->s_backup_bgs[1] = t;
+ }
+ }
+
retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf);
if (retval)
goto cleanup;