Whamcloud - gitweb
libext2fs: add gnu.translator support
[tools/e2fsprogs.git] / lib / ext2fs / res_gdt.c
index e61c330..6bcf01e 100644 (file)
@@ -31,7 +31,7 @@ static unsigned int list_backups(ext2_filsys fs, unsigned int *three,
        int mult = 3;
        unsigned int ret;
 
-       if (fs->super->s_feature_compat & EXT4_FEATURE_COMPAT_SPARSE_SUPER2) {
+       if (ext2fs_has_feature_sparse_super2(fs->super)) {
                if (*min == 1) {
                        *min += 1;
                        if (fs->super->s_backup_bgs[0])
@@ -44,8 +44,7 @@ static unsigned int list_backups(ext2_filsys fs, unsigned int *three,
                }
                return fs->group_desc_count;
        }
-       if (!(fs->super->s_feature_ro_compat &
-             EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
+       if (!ext2fs_has_feature_sparse_super(fs->super)) {
                ret = *min;
                *min += 1;
                return ret;
@@ -105,7 +104,7 @@ errcode_t ext2fs_create_resize_inode(ext2_filsys fs)
        if (fs->blocksize == 1024 && sb_blk == 0)
                sb_blk = 1;
 
-       /* Maximum possible file size (we donly use the dindirect blocks) */
+       /* Maximum possible file size (we only use double indirect blocks) */
        apb = EXT2_ADDR_PER_BLOCK(sb);
        if ((dindir_blk = inode.i_block[EXT2_DIND_BLOCK])) {
 #ifdef RES_GDT_DEBUG
@@ -133,12 +132,9 @@ errcode_t ext2fs_create_resize_inode(ext2_filsys fs)
                dindir_dirty = inode_dirty = 1;
                inode_size = apb*apb + apb + EXT2_NDIR_BLOCKS;
                inode_size *= fs->blocksize;
-               inode.i_size = inode_size & 0xFFFFFFFF;
-               inode.i_size_high = (inode_size >> 32) & 0xFFFFFFFF;
-               if(inode.i_size_high) {
-                       sb->s_feature_ro_compat |=
-                               EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
-               }
+               retval = ext2fs_inode_size_set(fs, &inode, inode_size);
+               if (retval)
+                       goto out_free;
                inode.i_ctime = fs->now ? fs->now : time(0);
        }