summaryrefslogtreecommitdiff
path: root/ext4_utils/make_ext4fs.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2013-02-04 00:44:55 -0800
committerColin Cross <ccross@android.com>2013-02-04 15:33:50 -0800
commit56497f28bd20001dd5f931208e8d948cf2f81b2f (patch)
tree00a35e7640dd9b44d6a63fc86633ae7eb8d05cec /ext4_utils/make_ext4fs.c
parent682a27cbce4935a6598c42a248855eb5878c1115 (diff)
downloadextras-56497f28bd20001dd5f931208e8d948cf2f81b2f.tar.gz
ext4_utils: mark uninitialized inode tables in block groups
Block groups that have no used inodes have their inode table left uninitialized, unless -t is specified, in which case they are explicitly zeroed. When they are uninitialized, writing a sparse ext4 image over existing data can cause e2fsck to confuse the uninitialized data for lost inodes. Set the EXT4_BG_INODE_UNINIT flags on block groups that have no used inodes. This flag requires the block group checksum feature to be enabled, so also enable the checksum feature in the superblock and compute the checksum for the block group. Since zeroing the inode tables is now useless, remove the code for it and deprecate the -t command line option. Change-Id: I4927c1d866d051547cf0dadc8c8703ded0163925
Diffstat (limited to 'ext4_utils/make_ext4fs.c')
-rw-r--r--ext4_utils/make_ext4fs.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index f62fee9f..b2d14263 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -361,7 +361,7 @@ int make_ext4fs_sparse_fd(int fd, long long len,
reset_ext4fs_info();
info.len = len;
- return make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 1, 0, 0, 0, sehnd, 0);
+ return make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 1, 0, 0, sehnd, 0);
}
int make_ext4fs(const char *filename, long long len,
@@ -379,7 +379,7 @@ int make_ext4fs(const char *filename, long long len,
return EXIT_FAILURE;
}
- status = make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 0, 0, 1, 0, sehnd, 0);
+ status = make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 0, 0, 1, sehnd, 0);
close(fd);
return status;
@@ -444,7 +444,7 @@ static char *canonicalize_rel_slashes(const char *str)
int make_ext4fs_internal(int fd, const char *_directory,
const char *_mountpoint, fs_config_func_t fs_config_func, int gzip,
- int sparse, int crc, int wipe, int init_itabs,
+ int sparse, int crc, int wipe,
struct selabel_handle *sehnd, int verbose)
{
u32 root_inode_num;
@@ -507,7 +507,8 @@ int make_ext4fs_internal(int fd, const char *_directory,
info.feat_ro_compat |=
EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER |
- EXT4_FEATURE_RO_COMPAT_LARGE_FILE;
+ EXT4_FEATURE_RO_COMPAT_LARGE_FILE |
+ EXT4_FEATURE_RO_COMPAT_GDT_CSUM;
info.feat_incompat |=
EXT4_FEATURE_INCOMPAT_EXTENTS |
@@ -580,9 +581,6 @@ int make_ext4fs_internal(int fd, const char *_directory,
ext4_update_free();
- if (init_itabs)
- init_unused_inode_tables();
-
ext4_queue_sb();
printf("Created filesystem with %d/%d inodes and %d/%d blocks\n",