Merge branch 'maint' into next

Conflicts:
	debian/changelog
	debian/e2fslibs.symbols
	version.h
diff --git a/debian/changelog b/debian/changelog
index c2854ee..2d00c30 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,24 @@
-e2fsprogs (1.43~WIP-2013-12-28-1) unstable; urgency=low
+e2fsprogs (1.43~WIP-2014-02-04-1) unstable; urgency=low
 
-  * Add metadata checksum feature
+  * Merge in updates from the maint branch (changes from 1.42.9-3)
 
- -- Theodore Y. Ts'o <tytso@mit.edu>  Mon, 28 Dec 2013 23:25:42 -0400
+ -- Theodore Y. Ts'o <tytso@mit.edu>  Wed, 04 Feb 2014 23:31:56 -0500
+
+e2fsprogs (1.42.9-3) unstable; urgency=medium
+
+  * Add the ability for mke2fs to create hugefiles
+  * Add support for the sparse_super2 compat feature
+  * Mke2fs can now force all of the metadata blocks to be at the
+    beginning of the file system
+  * Fix loopback mount detection (Closes: #497984)
+  * Add support to mke2fs to create a file system at an offset
+    (Closes: #417385)
+  * Mention badblocks in the package description (Closes: #718725)
+  * Update/fix various man pages (Closes: #719184, #719189)
+  * Improve e2fsck's "superblock corrupt" message (Closes: #719185)
+  * Miscellaneous Coverity clean ups
+
+ -- Theodore Y. Ts'o <tytso@mit.edu>  Tue, 04 Feb 2014 22:17:22 -0500
 
 e2fsprogs (1.42.9-2) unstable; urgency=low
 
diff --git a/debian/e2fslibs.symbols b/debian/e2fslibs.symbols
index fd673c2..8a88efe 100644
--- a/debian/e2fslibs.symbols
+++ b/debian/e2fslibs.symbols
@@ -44,6 +44,7 @@
  ext2fs_add_dir_block2@Base 1.42
  ext2fs_add_dir_block@Base 1.37
  ext2fs_add_journal_device@Base 1.37
+ ext2fs_add_journal_inode2@Base 1.42.9-3~
  ext2fs_add_journal_inode@Base 1.37
  ext2fs_adjust_ea_refcount2@Base 1.42
  ext2fs_adjust_ea_refcount3@Base 1.43~WIP-2012-08-01
@@ -91,6 +92,7 @@
  ext2fs_block_bitmap_checksum@Base 1.43~WIP-2012-08-01
  ext2fs_block_bitmap_csum_set@Base 1.43~WIP-2012-08-01
  ext2fs_block_bitmap_csum_verify@Base 1.43~WIP-2012-08-01
+ ext2fs_block_alloc_stats_range@Base 1.42.9-3~
  ext2fs_block_bitmap_loc@Base 1.42
  ext2fs_block_bitmap_loc_set@Base 1.42
  ext2fs_block_iterate2@Base 1.37
@@ -167,8 +169,8 @@
  ext2fs_extent_free@Base 1.41.0
  ext2fs_extent_get@Base 1.41.0
  ext2fs_extent_get_info@Base 1.41.0
- ext2fs_extent_goto@Base 1.41.0
  ext2fs_extent_goto2@Base 1.42.7
+ ext2fs_extent_goto@Base 1.41.0
  ext2fs_extent_header_verify@Base 1.41.0
  ext2fs_extent_insert@Base 1.41.0
  ext2fs_extent_node_split@Base 1.42.7
@@ -217,6 +219,10 @@
  ext2fs_file_set_size@Base 1.37
  ext2fs_file_write@Base 1.37
  ext2fs_find_block_device@Base 1.37
+ ext2fs_find_first_set_block_bitmap2@Base 1.42.9-3~
+ ext2fs_find_first_set_generic_bitmap@Base 1.42.9-3~
+ ext2fs_find_first_set_generic_bmap@Base 1.42.9-3~
+ ext2fs_find_first_set_inode_bitmap2@Base 1.42.9-3~
  ext2fs_find_first_zero_block_bitmap2@Base 1.42.2
  ext2fs_find_first_zero_generic_bitmap@Base 1.42.3
  ext2fs_find_first_zero_generic_bmap@Base 1.42.2
@@ -284,8 +290,8 @@
  ext2fs_get_pathname@Base 1.37
  ext2fs_get_rec_len@Base 1.41.7
  ext2fs_group_blocks_count@Base 1.42
- ext2fs_group_desc_csum@Base 1.42.2
  ext2fs_group_desc@Base 1.42
+ ext2fs_group_desc_csum@Base 1.42.2
  ext2fs_group_desc_csum_set@Base 1.41.0
  ext2fs_group_desc_csum_verify@Base 1.41.0
  ext2fs_group_first_block2@Base 1.42
@@ -324,8 +330,8 @@
  ext2fs_inode_csum_verify@Base 1.43~WIP-2012-08-01
  ext2fs_inode_data_blocks2@Base 1.42
  ext2fs_inode_data_blocks@Base 1.37
- ext2fs_inode_has_valid_blocks@Base 1.37
  ext2fs_inode_has_valid_blocks2@Base 1.42
+ ext2fs_inode_has_valid_blocks@Base 1.37
  ext2fs_inode_i_blocks@Base 1.42
  ext2fs_inode_io_intern2@Base 1.37
  ext2fs_inode_io_intern@Base 1.37
diff --git a/debian/rules b/debian/rules
index bd9a34e..f5ee6a6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -23,10 +23,7 @@
 
 # Allow distro-specific behaviour
 DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release 2>/dev/null || echo Debian)
-SYS_BLKID_VER := $(shell dpkg-query -W libblkid1:$(DEB_HOST_ARCH) | cut -f 2 | cut -b 1)
-ifeq ($(SYS_BLKID_VER),2)
 UTIL_LINUX_NG ?= yes
-endif
 
 # find the version for the main package, from changelog file
 MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
diff --git a/misc/mk_hugefiles.c b/misc/mk_hugefiles.c
index 12420af..eb91f0c 100644
--- a/misc/mk_hugefiles.c
+++ b/misc/mk_hugefiles.c
@@ -310,12 +310,25 @@
 	return blk;
 }
 
+static blk64_t round_up_align(blk64_t b, unsigned long align)
+{
+	unsigned long m;
+
+	if (align == 0)
+		return b;
+	m = b % align;
+	if (m)
+		b += align - m;
+	return b;
+}
+
 errcode_t mk_hugefiles(ext2_filsys fs)
 {
 	unsigned long	i;
 	ext2_ino_t	dir;
 	errcode_t	retval;
 	blk64_t		fs_blocks;
+	unsigned long	align;
 	int		d, dsize;
 	char		*t;
 
@@ -332,6 +345,10 @@
 	t = get_string_from_profile(fs_types, "hugefiles_size", "0");
 	num_blocks = parse_num_blocks2(t, fs->super->s_log_block_size);
 	free(t);
+	t = get_string_from_profile(fs_types, "hugefiles_align", "0");
+	align = parse_num_blocks2(t, fs->super->s_log_block_size);
+	free(t);
+	num_blocks = round_up_align(num_blocks, align);
 	zero_hugefile = get_int_from_profile(fs_types, "zero_hugefiles",
 					     zero_hugefile);
 
@@ -357,7 +374,12 @@
 	fn_numbuf = fn_buf + strlen(fn_prefix);
 	free(fn_prefix);
 
-	fs_blocks = ext2fs_free_blocks_count(fs->super) -num_slack;
+	fs_blocks = ext2fs_free_blocks_count(fs->super);
+	if (fs_blocks < num_slack + align)
+		return ENOMEM;
+	fs_blocks -= num_slack + align;
+	if (num_blocks && num_blocks > fs_blocks)
+		return ENOMEM;
 	if (num_blocks == 0 && num_files == 0)
 		num_files = 1;
 
@@ -378,6 +400,7 @@
 	num_slack += calc_overhead(fs, num_blocks) * num_files;
 	num_slack += (num_files / 16) + 1; /* space for dir entries */
 	goal = get_start_block(fs, num_slack);
+	goal = round_up_align(goal, align);
 
 	if (!quiet) {
 		if (zero_hugefile && verbose)
diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in
index 39a1a40..02efdce 100644
--- a/misc/mke2fs.conf.5.in
+++ b/misc/mke2fs.conf.5.in
@@ -457,7 +457,13 @@
 .TP
 .I hugefiles_size
 This relation specifies the size of the huge files.  If this relation is
-not specified, the default is to fill th efile system.
+not specified, the default is to fill the entire file system.
+.TP
+.I hugefiles_align
+This relation specifies the alignment for the start block of the huge
+files.  It also forces the size of huge files to be a multiple of the
+requested alignment.  If this relation is not specified, no alignment
+requirement will be imposed on the huge files.
 .TP
 .I hugefiles_name
 This relation specifies the base file name for the huge files.
diff --git a/version.h b/version.h
index 67d4d9a..9eb6e94 100644
--- a/version.h
+++ b/version.h
@@ -8,4 +8,4 @@
  */
 
 #define E2FSPROGS_VERSION "1.43-WIP"
-#define E2FSPROGS_DATE "28-Dec-2013"
+#define E2FSPROGS_DATE "4-Feb-2014"