summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-08-27 09:27:54 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-08-27 09:27:54 -0400
commit725502de199031a379761fba338885d2c3bbfb25 (patch)
treecefea7d121ab565fc499d16ffe564efb78a1b143
parent3ff57555f64eada1512cf545c46d2491ba229a1f (diff)
downloade2fsprogs-725502de199031a379761fba338885d2c3bbfb25.tar.gz
mke2fs: complain if bigalloc and hugefiles_align_disk is incompatible
If the starting partition offset is incompatible with the bigalloc cluster size, complain and exit, instead of creating a file which would have a logical to physical block mapping which breaks the cluster alignment requirement. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--misc/mk_hugefiles.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/misc/mk_hugefiles.c b/misc/mk_hugefiles.c
index c292ddc1..8291f019 100644
--- a/misc/mk_hugefiles.c
+++ b/misc/mk_hugefiles.c
@@ -490,9 +490,18 @@ errcode_t mk_hugefiles(ext2_filsys fs, const char *device_name)
t = get_string_from_profile(fs_types, "hugefiles_align", "0");
align = parse_num_blocks2(t, fs->super->s_log_block_size);
free(t);
- if (get_bool_from_profile(fs_types, "hugefiles_align_disk", 0))
+ if (get_bool_from_profile(fs_types, "hugefiles_align_disk", 0)) {
part_offset = get_partition_start(device_name) /
(fs->blocksize / 512);
+ if (part_offset % EXT2FS_CLUSTER_RATIO(fs)) {
+ fprintf(stderr,
+ _("Partition offset of %llu (%uk) blocks "
+ "not compatible with cluster size %u.\n"),
+ part_offset, fs->blocksize,
+ EXT2_CLUSTER_SIZE(fs->super));
+ exit(1);
+ }
+ }
num_blocks = round_up_align(num_blocks, align, 0);
zero_hugefile = get_bool_from_profile(fs_types, "zero_hugefiles",
zero_hugefile);