aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--RELEASE-NOTES23
-rw-r--r--contrib/spd_readdir.c113
-rw-r--r--debian/changelog5
-rw-r--r--e2fsprogs.lsm4
-rw-r--r--lib/ext2fs/gen_bitmap64.c30
-rw-r--r--misc/mke2fs.c12
-rw-r--r--misc/tune2fs.c4
-rw-r--r--po/e2fsprogs.pot317
-rw-r--r--resize/main.c14
-rw-r--r--resize/resize2fs.c65
-rw-r--r--version.h2
11 files changed, 418 insertions, 171 deletions
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index c9dd8766..20470d7f 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -18,9 +18,15 @@ needed by boot loadsers such as yaboot.
Support for the MMP feature can now be disabled at compile time.
-E2fsprogs 1.42.7 (January 15, 2013)
+E2fsprogs 1.42.7 (January 21, 2013)
===================================
+Add warnings to mke2fs, resize2fs, and tune2fs that the bigalloc and
+quota features are still under development. For more information
+please see:
+ * https://ext4.wiki.kernel.org/index.php/Bigalloc
+ * https://ext4.wiki.kernel.org/index.php/Quota
+
Add some new options to filefrag from Lustre's patches to e2fsprogs:
* add -k option to print extents in kB-sized units (like df -k)
* add -b {blocksize} to print extents in blocksize units
@@ -34,6 +40,9 @@ creates a filesystem with a restricted number of reserved gdt blocks,
an off-line resize which grows the file system could potentially
result in file system corruption.
+Fix a resize2fs bug which could cause it to corrupt bigalloc file
+systems when doing an off-line resize.
+
Further optimize resize2fs so it doesn't use quite as much CPU when
resizing very large file systems.
@@ -101,6 +110,12 @@ on file systems whose block size is greater than 8k.
Fix e2freefrag so it works on 64-bit file systems, and so it uses much
less memory. (Addresses Google Bug: 7269948)
+Update the spd_readdir.c file in the contrib directory to include some
+additions which were made in 2008 that didn't get folded into the
+version which we checked into the e2fsprogs source tree. These
+enhancements include thread safety, support for readdir64_r(), and
+safe_getenv() support in case spd_readdir.so is used for setuid binaries.
+
Update Czech, Dutch, French, German, Polish, Sweedish, and Vietnamese
translations
@@ -127,9 +142,13 @@ The ext2fs_extents_fix_parents() was fixed so it does not modify the
location of the extent handle if its current location is at an
interior node, rather than a leaf node of an inode's extent tree.
-Add a regression test to assure that e2fsck can correctl fix an
+Add a regression test to assure that e2fsck can correctly fix an
inconsistent interior node in an inode's extent tree.
+The ext2fs_{mark,unmark,test}_block_bitmap_range2() functions now
+correctly support bigalloc file systems which use store block usage
+information in units of clusters.
+
Fixed the help text in the configure script for --enable-quota.
The m68k-specific bitops code has been removed since they were
diff --git a/contrib/spd_readdir.c b/contrib/spd_readdir.c
index f89832cd..8345fa1a 100644
--- a/contrib/spd_readdir.c
+++ b/contrib/spd_readdir.c
@@ -1,21 +1,22 @@
/*
* readdir accelerator
*
- * (C) Copyright 2003, 2004 by Theodore Ts'o.
+ * (C) Copyright 2003, 2004, 2008 by Theodore Ts'o.
+ *
+ * 2008-06-08 Modified by Ross Boylan <RossBoylan stanfordalumni org>
+ * Added support for readdir_r and readdir64_r calls. Note
+ * this has not been tested on anything other than GNU/Linux i386,
+ * and that the regular readdir wrapper will take slightly more
+ * space than Ted's original since it now includes a lock.
*
* Compile using the command:
*
- * gcc -o spd_readdir.so -fPIC -shared spd_readdir.c -ldl
+ * gcc -o spd_readdir.so -shared -fpic spd_readdir.c -ldl
*
* Use it by setting the LD_PRELOAD environment variable:
*
* export LD_PRELOAD=/usr/local/sbin/spd_readdir.so
*
- * Note that this preload is not going to work for all programs. In
- * particular, although it does supply readdir_r(), it is *not* thread
- * safe. So I can't recommend this as something to be dropped in
- * /etc/ld.so.preload.
- *
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
@@ -27,6 +28,10 @@
#define MAX_DIRSIZE 0
#define DEBUG
+/* Util we autoconfiscate spd_readdir... */
+#define HAVE___SECURE_GETENV 1
+#define HAVE_PRCTL 1
+#define HAVE_SYS_PRCTL_H 1
#ifdef DEBUG
#define DEBUG_DIR(x) {if (do_debug) { x; }}
@@ -46,6 +51,12 @@
#include <dirent.h>
#include <errno.h>
#include <dlfcn.h>
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#else
+#define PR_GET_DUMPABLE 3
+#endif
+#include <pthread.h>
struct dirent_s {
unsigned long long d_ino;
@@ -57,6 +68,7 @@ struct dirent_s {
struct dir_s {
DIR *dir;
+ pthread_mutex_t lock; /* Mutex lock for this structure. */
int num;
int max;
struct dirent_s *dp;
@@ -74,6 +86,8 @@ static struct dirent *(*real_readdir)(DIR *dir) = 0;
static int (*real_readdir_r)(DIR *dir, struct dirent *entry,
struct dirent **result) = 0;
static struct dirent64 *(*real_readdir64)(DIR *dir) = 0;
+static int (*real_readdir64_r)(DIR *dir, struct dirent64 *entry,
+ struct dirent64 **result) = 0;
static off_t (*real_telldir)(DIR *dir) = 0;
static void (*real_seekdir)(DIR *dir, off_t offset) = 0;
static int (*real_dirfd)(DIR *dir) = 0;
@@ -83,6 +97,27 @@ static int num_open = 0;
static int do_debug = 0;
#endif
+static char *safe_getenv(const char *arg)
+{
+ if ((getuid() != geteuid()) || (getgid() != getegid()))
+ return NULL;
+#if HAVE_PRCTL
+ if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
+ return NULL;
+#else
+#if (defined(linux) && defined(SYS_prctl))
+ if (syscall(SYS_prctl, PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
+ return NULL;
+#endif
+#endif
+
+#if HAVE___SECURE_GETENV
+ return __secure_getenv(arg);
+#else
+ return getenv(arg);
+#endif
+}
+
static void setup_ptr()
{
char *cp;
@@ -94,14 +129,15 @@ static void setup_ptr()
real_readdir = dlsym(RTLD_NEXT, "readdir");
real_readdir_r = dlsym(RTLD_NEXT, "readdir_r");
real_readdir64 = dlsym(RTLD_NEXT, "readdir64");
+ real_readdir64_r = dlsym(RTLD_NEXT, "readdir64_r");
real_telldir = dlsym(RTLD_NEXT, "telldir");
real_seekdir = dlsym(RTLD_NEXT, "seekdir");
real_dirfd = dlsym(RTLD_NEXT, "dirfd");
- if ((cp = getenv("SPD_READDIR_MAX_SIZE")) != NULL) {
+ if ((cp = safe_getenv("SPD_READDIR_MAX_SIZE")) != NULL) {
max_dirsize = atol(cp);
}
#ifdef DEBUG
- if (getenv("SPD_READDIR_DEBUG")) {
+ if (safe_getenv("SPD_READDIR_DEBUG")) {
printf("initialized!\n");
do_debug++;
}
@@ -112,6 +148,8 @@ static void free_cached_dir(struct dir_s *dirstruct)
{
int i;
+ pthread_mutex_destroy(&(dirstruct->lock));
+
if (!dirstruct->dp)
return;
@@ -148,18 +186,21 @@ static int ino_cmp(const void *a, const void *b)
return (i_a - i_b);
}
-struct dir_s *alloc_dirstruct(DIR *dir)
+static struct dir_s *alloc_dirstruct(DIR *dir)
{
struct dir_s *dirstruct;
+ static pthread_mutexattr_t mutexattr;
+ mutexattr.__align = PTHREAD_MUTEX_RECURSIVE;
dirstruct = malloc(sizeof(struct dir_s));
if (dirstruct)
memset(dirstruct, 0, sizeof(struct dir_s));
dirstruct->dir = dir;
+ pthread_mutex_init(&(dirstruct->lock), &mutexattr);
return dirstruct;
}
-void cache_dirstruct(struct dir_s *dirstruct)
+static void cache_dirstruct(struct dir_s *dirstruct)
{
struct dirent_s *ds, *dnew;
struct dirent64 *d;
@@ -238,7 +279,7 @@ DIR *fdopendir(int fd)
if (!real_fdopendir)
setup_ptr();
- DEBUG_DIR(printf("fdpendir(%d) (%d open)\n", fd, num_open++));
+ DEBUG_DIR(printf("fdopendir(%d) (%d open)\n", fd, num_open++));
dir = (*real_fdopendir)(fd);
if (!dir)
return NULL;
@@ -306,19 +347,19 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
if (dirstruct->direct)
return (*real_readdir_r)(dirstruct->dir, entry, result);
+ pthread_mutex_lock(&(dirstruct->lock));
if (dirstruct->pos >= dirstruct->num) {
*result = NULL;
- return 0;
+ } else {
+ ds = &dirstruct->dp[dirstruct->pos++];
+ entry->d_ino = ds->d_ino;
+ entry->d_off = ds->d_off;
+ entry->d_reclen = ds->d_reclen;
+ entry->d_type = ds->d_type;
+ strncpy(entry->d_name, ds->d_name, sizeof(entry->d_name));
+ *result = entry;
}
-
- ds = &dirstruct->dp[dirstruct->pos++];
- entry->d_ino = ds->d_ino;
- entry->d_off = ds->d_off;
- entry->d_reclen = ds->d_reclen;
- entry->d_type = ds->d_type;
- strncpy(entry->d_name, ds->d_name, sizeof(entry->d_name));
- *result = entry;
-
+ pthread_mutex_unlock(&(dirstruct->lock));
return 0;
}
@@ -344,6 +385,32 @@ struct dirent64 *readdir64(DIR *dir)
return (&dirstruct->ret_dir64);
}
+int readdir64_r (DIR *__restrict dir,
+ struct dirent64 *__restrict entry,
+ struct dirent64 **__restrict result)
+{
+ struct dir_s *dirstruct = (struct dir_s *) dir;
+ struct dirent_s *ds;
+
+ if (dirstruct->direct)
+ return (*real_readdir64_r)(dir, entry, result);
+ pthread_mutex_lock(&(dirstruct->lock));
+ if (dirstruct->pos >= dirstruct->num) {
+ *result = NULL;
+ } else {
+ ds = &dirstruct->dp[dirstruct->pos++];
+ entry->d_ino = ds->d_ino;
+ entry->d_off = ds->d_off;
+ entry->d_reclen = ds->d_reclen;
+ entry->d_type = ds->d_type;
+ strncpy(entry->d_name, ds->d_name,
+ sizeof(entry->d_name));
+ *result = entry;
+ }
+ pthread_mutex_unlock(&(dirstruct->lock));
+ return 0;
+}
+
off_t telldir(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
@@ -374,9 +441,11 @@ void rewinddir(DIR *dir)
if (dirstruct->direct)
return;
+ pthread_mutex_lock(&(dirstruct->lock));
dirstruct->pos = 0;
free_cached_dir(dirstruct);
cache_dirstruct(dirstruct);
+ pthread_mutex_unlock(&(dirstruct->lock));
}
int dirfd(DIR *dir)
diff --git a/debian/changelog b/debian/changelog
index d36496e1..bb075d5b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
e2fsprogs (1.42.7-1) unstable; urgency=low
* New upstream version
+ * Add warning indicating that the quota and bigalloc features are
+ still under development.
* Added new options to filefrag to be consistent with the version from
Lustre
* Optimized e2fsck's CPU utilization
@@ -24,6 +26,7 @@ e2fsprogs (1.42.7-1) unstable; urgency=low
resizing very large file systems.
* Fixed 32-bit overflow bugs which could cause resize2fs to fail and
possibly corrupt the file system while resizing 64-bit file systems.
+ * Fixed a big which could cause resize2fs to corrupt bigalloc file systems.
* Fix a crash while mke2fs is parsing "-E resize=NNN" with the 64bit
file system feature enabled
* Added better error checking to mke2fs to check for invalid
@@ -48,7 +51,7 @@ e2fsprogs (1.42.7-1) unstable; urgency=low
* Update Czech, Dutch, French, German, Polish, Sweedish, and
Vietnamese translations
- -- Theodore Y. Ts'o <tytso@mit.edu> Tue, 15 Jan 2013 22:31:25 -0500
+ -- Theodore Y. Ts'o <tytso@mit.edu> Tue, 21 Jan 2013 21:52:58 -0500
e2fsprogs (1.43~WIP-2012-09-22-1) unstable; urgency=low
diff --git a/e2fsprogs.lsm b/e2fsprogs.lsm
index 424dd1f1..3d006dbe 100644
--- a/e2fsprogs.lsm
+++ b/e2fsprogs.lsm
@@ -1,14 +1,14 @@
Begin3
Title: EXT2 Filesystem utilities
Version: 1.42.7
-Entered-date: 15Jan2013
+Entered-date: 21Jan2013
Description: The filesystem utilities for the EXT2, EXT3, and EXT4
filesystems, including e2fsck, mke2fs, dumpe2fs, and others.
Keywords: utilities, filesystem, Ext2fs, ext3, ext4
Author: tytso@mit.edu (Theodore Tso)
Maintained-by: tytso@mit.edu (Theodore Tso)
Primary-site: download.sourceforge.net /pub/sourceforge/e2fsprogs
- 5840kB e2fsprogs-1.42.7.tar.gz
+ 5844kB e2fsprogs-1.42.7.tar.gz
560kB e2fsprogs-libs-1.42.7.tar.gz
1kB e2fsprogs-1.42.7.lsm
Alternate-site:
diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
index dd2773a9..42a97d4a 100644
--- a/lib/ext2fs/gen_bitmap64.c
+++ b/lib/ext2fs/gen_bitmap64.c
@@ -625,6 +625,8 @@ void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap)
int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bmap,
blk64_t block, unsigned int num)
{
+ __u64 end = block + num;
+
if (!bmap)
return EINVAL;
@@ -647,12 +649,26 @@ int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bmap,
INC_STAT(bmap, test_ext_count);
+ /* convert to clusters if necessary */
+ block >>= bmap->cluster_bits;
+ end += (1 << bmap->cluster_bits) - 1;
+ end >>= bmap->cluster_bits;
+ num = end - block;
+
+ if ((block < bmap->start) || (block+num-1 > bmap->end)) {
+ ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST, block,
+ bmap->description);
+ return;
+ }
+
return bmap->bitmap_ops->test_clear_bmap_extent(bmap, block, num);
}
void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bmap,
blk64_t block, unsigned int num)
{
+ __u64 end = block + num;
+
if (!bmap)
return;
@@ -671,6 +687,12 @@ void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bmap,
INC_STAT(bmap, mark_ext_count);
+ /* convert to clusters if necessary */
+ block >>= bmap->cluster_bits;
+ end += (1 << bmap->cluster_bits) - 1;
+ end >>= bmap->cluster_bits;
+ num = end - block;
+
if ((block < bmap->start) || (block+num-1 > bmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
bmap->description);
@@ -683,6 +705,8 @@ void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bmap,
void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bmap,
blk64_t block, unsigned int num)
{
+ __u64 end = block + num;
+
if (!bmap)
return;
@@ -701,6 +725,12 @@ void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bmap,
INC_STAT(bmap, unmark_ext_count);
+ /* convert to clusters if necessary */
+ block >>= bmap->cluster_bits;
+ end += (1 << bmap->cluster_bits) - 1;
+ end >>= bmap->cluster_bits;
+ num = end - block;
+
if ((block < bmap->start) || (block+num-1 > bmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
bmap->description);
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index dc24fd95..bbf477ae 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2019,6 +2019,18 @@ profile_error:
exit(1);
}
+ if (fs_param.s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_BIGALLOC)
+ fprintf(stderr, _("\nWarning: the bigalloc feature is still "
+ "under development\n"
+ "See https://ext4.wiki.kernel.org/"
+ "index.php/Bigalloc for more information\n\n"));
+
+ if (fs_param.s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_QUOTA)
+ fprintf(stderr, _("\nWarning: the quota feature is still "
+ "under development\n"
+ "See https://ext4.wiki.kernel.org/"
+ "index.php/Quota for more information\n\n"));
+
/* Since sparse_super is the default, we would only have a problem
* here if it was explicitly disabled.
*/
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 23277508..66fbc547 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1163,6 +1163,10 @@ void handle_quota_options(ext2_filsys fs)
quota_release_context(&qctx);
if ((usrquota == QOPT_ENABLE) || (grpquota == QOPT_ENABLE)) {
+ fprintf(stderr, _("\nWarning: the quota feature is still "
+ "under development\n"
+ "See https://ext4.wiki.kernel.org/"
+ "index.php/Quota for more information\n\n"));
fs->super->s_feature_ro_compat |= EXT4_FEATURE_RO_COMPAT_QUOTA;
ext2fs_mark_super_dirty(fs);
} else if (!fs->super->s_usr_quota_inum &&
diff --git a/po/e2fsprogs.pot b/po/e2fsprogs.pot
index 0f152bdc..81124cf2 100644
--- a/po/e2fsprogs.pot
+++ b/po/e2fsprogs.pot
@@ -68,7 +68,7 @@ msgid ""
msgstr ""
"Project-Id-Version: e2fsprogs 1.42.7\n"
"Report-Msgid-Bugs-To: tytso@alum.mit.edu\n"
-"POT-Creation-Date: 2013-01-16 13:40-0500\n"
+"POT-Creation-Date: 2013-01-21 21:46-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -95,7 +95,7 @@ msgstr ""
#: e2fsck/unix.c:1332 e2fsck/unix.c:1420 misc/badblocks.c:1214
#: misc/badblocks.c:1222 misc/badblocks.c:1236 misc/badblocks.c:1248
#: misc/dumpe2fs.c:588 misc/e2image.c:1196 misc/e2image.c:1318
-#: misc/e2image.c:1331 misc/mke2fs.c:194 misc/tune2fs.c:1902 resize/main.c:303
+#: misc/e2image.c:1331 misc/mke2fs.c:194 misc/tune2fs.c:1906 resize/main.c:315
#, c-format
msgid "while trying to open %s"
msgstr ""
@@ -194,7 +194,7 @@ msgstr ""
msgid "while opening %s for flushing"
msgstr ""
-#: e2fsck/iscan.c:86 e2fsck/unix.c:967 resize/main.c:276
+#: e2fsck/iscan.c:86 e2fsck/unix.c:967 resize/main.c:288
#, c-format
msgid "while trying to flush %s"
msgstr ""
@@ -2629,8 +2629,8 @@ msgid_plural "%12u files\n"
msgstr[0] ""
msgstr[1] ""
-#: e2fsck/unix.c:232 misc/badblocks.c:983 misc/tune2fs.c:1974 misc/util.c:147
-#: resize/main.c:247
+#: e2fsck/unix.c:232 misc/badblocks.c:983 misc/tune2fs.c:1978 misc/util.c:147
+#: resize/main.c:259
#, c-format
msgid "while determining whether %s is mounted."
msgstr ""
@@ -2757,8 +2757,8 @@ msgstr ""
msgid "The -t option is not supported on this version of e2fsck.\n"
msgstr ""
-#: e2fsck/unix.c:859 e2fsck/unix.c:931 misc/tune2fs.c:806 misc/tune2fs.c:1095
-#: misc/tune2fs.c:1113
+#: e2fsck/unix.c:859 e2fsck/unix.c:931 misc/tune2fs.c:810 misc/tune2fs.c:1099
+#: misc/tune2fs.c:1117
#, c-format
msgid "Unable to resolve '%s'"
msgstr ""
@@ -2806,7 +2806,7 @@ msgstr ""
msgid "while checking MMP block"
msgstr ""
-#: e2fsck/unix.c:1144 misc/tune2fs.c:1907
+#: e2fsck/unix.c:1144 misc/tune2fs.c:1911
msgid ""
"If you are sure the filesystem is not in use on any node, run:\n"
"'tune2fs -f -E clear_mmp {device}'\n"
@@ -3524,7 +3524,7 @@ msgstr ""
msgid "Journal users: %s\n"
msgstr ""
-#: misc/dumpe2fs.c:442 misc/mke2fs.c:664 misc/tune2fs.c:1132
+#: misc/dumpe2fs.c:442 misc/mke2fs.c:664 misc/tune2fs.c:1136
#, c-format
msgid "Couldn't allocate memory to parse options!\n"
msgstr ""
@@ -3558,8 +3558,8 @@ msgstr ""
msgid "\tUsing %s\n"
msgstr ""
-#: misc/dumpe2fs.c:590 misc/e2image.c:1320 misc/tune2fs.c:1918
-#: resize/main.c:305
+#: misc/dumpe2fs.c:590 misc/e2image.c:1320 misc/tune2fs.c:1922
+#: resize/main.c:317
#, c-format
msgid "Couldn't find valid filesystem superblock.\n"
msgstr ""
@@ -3626,7 +3626,7 @@ msgstr ""
msgid "e2label: not an ext2 filesystem\n"
msgstr ""
-#: misc/e2label.c:97 misc/tune2fs.c:2069
+#: misc/e2label.c:97 misc/tune2fs.c:2073
#, c-format
msgid "Warning: label too long, truncating.\n"
msgstr ""
@@ -3641,7 +3641,7 @@ msgstr ""
msgid "e2label: error writing superblock\n"
msgstr ""
-#: misc/e2label.c:117 misc/tune2fs.c:798
+#: misc/e2label.c:117 misc/tune2fs.c:802
#, c-format
msgid "Usage: e2label device [newlabel]\n"
msgstr ""
@@ -3871,7 +3871,7 @@ msgid ""
"Could not write %d blocks in inode table starting at %llu: %s\n"
msgstr ""
-#: misc/mke2fs.c:353 misc/mke2fs.c:2215 misc/mke2fs.c:2469
+#: misc/mke2fs.c:353 misc/mke2fs.c:2227 misc/mke2fs.c:2481
#, c-format
msgid "done \n"
msgstr ""
@@ -4023,7 +4023,7 @@ msgstr ""
msgid "Superblock backups stored on blocks: "
msgstr ""
-#: misc/mke2fs.c:689 misc/tune2fs.c:1160
+#: misc/mke2fs.c:689 misc/tune2fs.c:1164
#, c-format
msgid "Invalid mmp_update_interval: %s\n"
msgstr ""
@@ -4217,7 +4217,7 @@ msgstr ""
msgid "The -T option may only be used once"
msgstr ""
-#: misc/mke2fs.c:1552 misc/mke2fs.c:2548
+#: misc/mke2fs.c:1552 misc/mke2fs.c:2560
#, c-format
msgid "while trying to open journal device %s\n"
msgstr ""
@@ -4241,7 +4241,7 @@ msgstr ""
msgid "filesystem"
msgstr ""
-#: misc/mke2fs.c:1598 resize/main.c:355
+#: misc/mke2fs.c:1598 resize/main.c:367
msgid "while trying to determine filesystem size"
msgstr ""
@@ -4363,34 +4363,52 @@ msgstr ""
msgid "Can't support bigalloc feature without extents feature"
msgstr ""
-#: misc/mke2fs.c:1951
+#: misc/mke2fs.c:1946
+#, c-format
+msgid ""
+"\n"
+"Warning: the bigalloc feature is still under development\n"
+"See https://ext4.wiki.kernel.org/index.php/Bigalloc for more information\n"
+"\n"
+msgstr ""
+
+#: misc/mke2fs.c:1952 misc/tune2fs.c:739
+#, c-format
+msgid ""
+"\n"
+"Warning: the quota feature is still under development\n"
+"See https://ext4.wiki.kernel.org/index.php/Quota for more information\n"
+"\n"
+msgstr ""
+
+#: misc/mke2fs.c:1963
msgid "reserved online resize blocks not supported on non-sparse filesystem"
msgstr ""
-#: misc/mke2fs.c:1960
+#: misc/mke2fs.c:1972
msgid "blocks per group count out of range"
msgstr ""
-#: misc/mke2fs.c:1984
+#: misc/mke2fs.c:1996
msgid "Flex_bg feature not enabled, so flex_bg size may not be specified"
msgstr ""
-#: misc/mke2fs.c:1996
+#: misc/mke2fs.c:2008
#, c-format
msgid "invalid inode size %d (min %d/max %d)"
msgstr ""
-#: misc/mke2fs.c:2014
+#: misc/mke2fs.c:2026
#, c-format
msgid "too many inodes (%llu), raise inode ratio?"
msgstr ""
-#: misc/mke2fs.c:2021
+#: misc/mke2fs.c:2033
#, c-format
msgid "too many inodes (%llu), specify < 2^32 inodes"
msgstr ""
-#: misc/mke2fs.c:2035
+#: misc/mke2fs.c:2047
#, c-format
msgid ""
"inode_size (%u) * inodes_count (%u) too big for a\n"
@@ -4398,7 +4416,7 @@ msgid ""
"\tor lower inode count (-N).\n"
msgstr ""
-#: misc/mke2fs.c:2154
+#: misc/mke2fs.c:2166
#, c-format
msgid ""
"Overwriting existing filesystem; this can be undone using the command:\n"
@@ -4406,118 +4424,118 @@ msgid ""
"\n"
msgstr ""
-#: misc/mke2fs.c:2168
+#: misc/mke2fs.c:2180
msgid "while trying to setup undo file\n"
msgstr ""
-#: misc/mke2fs.c:2194
+#: misc/mke2fs.c:2206
msgid "Discarding device blocks: "
msgstr ""
-#: misc/mke2fs.c:2210
+#: misc/mke2fs.c:2222
msgid "failed - "
msgstr ""
-#: misc/mke2fs.c:2317
+#: misc/mke2fs.c:2329
msgid "while setting up superblock"
msgstr ""
-#: misc/mke2fs.c:2326
+#: misc/mke2fs.c:2338
#, c-format
msgid "Discard succeeded and will return 0s - skipping inode table wipe\n"
msgstr ""
-#: misc/mke2fs.c:2409
+#: misc/mke2fs.c:2421
#, c-format
msgid "unknown os - %s"
msgstr ""
-#: misc/mke2fs.c:2461
+#: misc/mke2fs.c:2473
#, c-format
msgid "Allocating group tables: "
msgstr ""
-#: misc/mke2fs.c:2465
+#: misc/mke2fs.c:2477
msgid "while trying to allocate filesystem tables"
msgstr ""
-#: misc/mke2fs.c:2474
+#: misc/mke2fs.c:2486
msgid ""
"\n"
"\twhile converting subcluster bitmap"
msgstr ""
-#: misc/mke2fs.c:2517
+#: misc/mke2fs.c:2529
#, c-format
msgid "while zeroing block %llu at end of filesystem"
msgstr ""
-#: misc/mke2fs.c:2530
+#: misc/mke2fs.c:2542
msgid "while reserving blocks for online resize"
msgstr ""
-#: misc/mke2fs.c:2541 misc/tune2fs.c:644
+#: misc/mke2fs.c:2553 misc/tune2fs.c:644
msgid "journal"
msgstr ""
-#: misc/mke2fs.c:2553
+#: misc/mke2fs.c:2565
#, c-format
msgid "Adding journal to device %s: "
msgstr ""
-#: misc/mke2fs.c:2560
+#: misc/mke2fs.c:2572
#, c-format
msgid ""
"\n"
"\twhile trying to add journal to device %s"
msgstr ""
-#: misc/mke2fs.c:2565 misc/mke2fs.c:2597 misc/tune2fs.c:673 misc/tune2fs.c:687
+#: misc/mke2fs.c:2577 misc/mke2fs.c:2609 misc/tune2fs.c:673 misc/tune2fs.c:687
#, c-format
msgid "done\n"
msgstr ""
-#: misc/mke2fs.c:2574
+#: misc/mke2fs.c:2586
#, c-format
msgid "Skipping journal creation in super-only mode\n"
msgstr ""
-#: misc/mke2fs.c:2585
+#: misc/mke2fs.c:2597
#, c-format
msgid "Creating journal (%u blocks): "
msgstr ""
-#: misc/mke2fs.c:2593
+#: misc/mke2fs.c:2605
msgid ""
"\n"
"\twhile trying to create journal"
msgstr ""
-#: misc/mke2fs.c:2604 misc/tune2fs.c:450
+#: misc/mke2fs.c:2616 misc/tune2fs.c:450
#, c-format
msgid ""
"\n"
"Error while enabling multiple mount protection feature."
msgstr ""
-#: misc/mke2fs.c:2609
+#: misc/mke2fs.c:2621
#, c-format
msgid "Multiple mount protection is enabled with update interval %d seconds.\n"
msgstr ""
-#: misc/mke2fs.c:2622
+#: misc/mke2fs.c:2634
#, c-format
msgid "Writing superblocks and filesystem accounting information: "
msgstr ""
-#: misc/mke2fs.c:2629
+#: misc/mke2fs.c:2641
#, c-format
msgid ""
"\n"
"Warning, had trouble writing out superblocks."
msgstr ""
-#: misc/mke2fs.c:2631
+#: misc/mke2fs.c:2643
#, c-format
msgid ""
"done\n"
@@ -4722,11 +4740,11 @@ msgid ""
"\twhile trying to create journal file"
msgstr ""
-#: misc/tune2fs.c:758
+#: misc/tune2fs.c:762
msgid "Couldn't allocate memory to parse quota options!\n"
msgstr ""
-#: misc/tune2fs.c:780
+#: misc/tune2fs.c:784
msgid ""
"\n"
"Bad quota options specified.\n"
@@ -4739,70 +4757,70 @@ msgid ""
"\n"
msgstr ""
-#: misc/tune2fs.c:841
+#: misc/tune2fs.c:845
#, c-format
msgid "Couldn't parse date/time specifier: %s"
msgstr ""
-#: misc/tune2fs.c:865 misc/tune2fs.c:878
+#: misc/tune2fs.c:869 misc/tune2fs.c:882
#, c-format
msgid "bad mounts count - %s"
msgstr ""
-#: misc/tune2fs.c:894
+#: misc/tune2fs.c:898
#, c-format
msgid "bad error behavior - %s"
msgstr ""
-#: misc/tune2fs.c:921
+#: misc/tune2fs.c:925
#, c-format
msgid "bad gid/group name - %s"
msgstr ""
-#: misc/tune2fs.c:954
+#: misc/tune2fs.c:958
#, c-format
msgid "bad interval - %s"
msgstr ""
-#: misc/tune2fs.c:983
+#: misc/tune2fs.c:987
#, c-format
msgid "bad reserved block ratio - %s"
msgstr ""
-#: misc/tune2fs.c:998
+#: misc/tune2fs.c:1002
msgid "-o may only be specified once"
msgstr ""
-#: misc/tune2fs.c:1007
+#: misc/tune2fs.c:1011
msgid "-O may only be specified once"
msgstr ""
-#: misc/tune2fs.c:1022
+#: misc/tune2fs.c:1026
#, c-format
msgid "bad reserved blocks count - %s"
msgstr ""
-#: misc/tune2fs.c:1051
+#: misc/tune2fs.c:1055
#, c-format
msgid "bad uid/user name - %s"
msgstr ""
-#: misc/tune2fs.c:1068
+#: misc/tune2fs.c:1072
#, c-format
msgid "bad inode size - %s"
msgstr ""
-#: misc/tune2fs.c:1075
+#: misc/tune2fs.c:1079
#, c-format
msgid "Inode size must be a power of two- %s"
msgstr ""
-#: misc/tune2fs.c:1169
+#: misc/tune2fs.c:1173
#, c-format
msgid "mmp_update_interval too big: %lu\n"
msgstr ""
-#: misc/tune2fs.c:1174
+#: misc/tune2fs.c:1178
#, c-format
msgid "Setting multiple mount protection update interval to %lu second\n"
msgid_plural ""
@@ -4810,27 +4828,27 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
-#: misc/tune2fs.c:1197
+#: misc/tune2fs.c:1201
#, c-format
msgid "Invalid RAID stride: %s\n"
msgstr ""
-#: misc/tune2fs.c:1212
+#: misc/tune2fs.c:1216
#, c-format
msgid "Invalid RAID stripe-width: %s\n"
msgstr ""
-#: misc/tune2fs.c:1227
+#: misc/tune2fs.c:1231
#, c-format
msgid "Invalid hash algorithm: %s\n"
msgstr ""
-#: misc/tune2fs.c:1233
+#: misc/tune2fs.c:1237
#, c-format
msgid "Setting default hash algorithm to %s (%d)\n"
msgstr ""
-#: misc/tune2fs.c:1252
+#: misc/tune2fs.c:1256
#, c-format
msgid ""
"\n"
@@ -4849,46 +4867,46 @@ msgid ""
"\t^test_fs\n"
msgstr ""
-#: misc/tune2fs.c:1718
+#: misc/tune2fs.c:1722
msgid "Failed to read inode bitmap\n"
msgstr ""
-#: misc/tune2fs.c:1723
+#: misc/tune2fs.c:1727
msgid "Failed to read block bitmap\n"
msgstr ""
-#: misc/tune2fs.c:1740 resize/resize2fs.c:829
+#: misc/tune2fs.c:1744 resize/resize2fs.c:838
msgid "blocks to be moved"
msgstr ""
-#: misc/tune2fs.c:1743
+#: misc/tune2fs.c:1747
msgid "Failed to allocate block bitmap when increasing inode size\n"
msgstr ""
-#: misc/tune2fs.c:1749
+#: misc/tune2fs.c:1753
msgid "Not enough space to increase inode size \n"
msgstr ""
-#: misc/tune2fs.c:1754
+#: misc/tune2fs.c:1758
msgid "Failed to relocate blocks during inode resize \n"
msgstr ""
-#: misc/tune2fs.c:1786
+#: misc/tune2fs.c:1790
msgid ""
"Error in resizing the inode size.\n"
"Run e2undo to undo the file system changes. \n"
msgstr ""
-#: misc/tune2fs.c:1813
+#: misc/tune2fs.c:1817
msgid "Couldn't allocate memory for tdb filename\n"
msgstr ""
-#: misc/tune2fs.c:1835
+#: misc/tune2fs.c:1839
#, c-format
msgid "while trying to delete %s"
msgstr ""
-#: misc/tune2fs.c:1845
+#: misc/tune2fs.c:1849
#, c-format
msgid ""
"To undo the tune2fs operation please run the command\n"
@@ -4896,141 +4914,141 @@ msgid ""
"\n"
msgstr ""
-#: misc/tune2fs.c:1914
+#: misc/tune2fs.c:1918
#, c-format
msgid ""
"MMP block magic is bad. Try to fix it by running:\n"
"'e2fsck -f %s'\n"
msgstr ""
-#: misc/tune2fs.c:1932
+#: misc/tune2fs.c:1936
#, c-format
msgid "The inode size is already %lu\n"
msgstr ""
-#: misc/tune2fs.c:1938
+#: misc/tune2fs.c:1942
#, c-format
msgid "Shrinking the inode size is not supported\n"
msgstr ""
-#: misc/tune2fs.c:1985
+#: misc/tune2fs.c:1989
#, c-format
msgid "Setting maximal mount count to %d\n"
msgstr ""
-#: misc/tune2fs.c:1991
+#: misc/tune2fs.c:1995
#, c-format
msgid "Setting current mount count to %d\n"
msgstr ""
-#: misc/tune2fs.c:1996
+#: misc/tune2fs.c:2000
#, c-format
msgid "Setting error behavior to %d\n"
msgstr ""
-#: misc/tune2fs.c:2001
+#: misc/tune2fs.c:2005
#, c-format
msgid "Setting reserved blocks gid to %lu\n"
msgstr ""
-#: misc/tune2fs.c:2006
+#: misc/tune2fs.c:2010
#, c-format
msgid "interval between checks is too big (%lu)"
msgstr ""
-#: misc/tune2fs.c:2013
+#: misc/tune2fs.c:2017
#, c-format
msgid "Setting interval between checks to %lu seconds\n"
msgstr ""
-#: misc/tune2fs.c:2020
+#: misc/tune2fs.c:2024
#, c-format
msgid "Setting reserved blocks percentage to %g%% (%llu blocks)\n"
msgstr ""
-#: misc/tune2fs.c:2026
+#: misc/tune2fs.c:2030
#, c-format
msgid "reserved blocks count is too big (%llu)"
msgstr ""
-#: misc/tune2fs.c:2033
+#: misc/tune2fs.c:2037
#, c-format
msgid "Setting reserved blocks count to %llu\n"
msgstr ""
-#: misc/tune2fs.c:2039
+#: misc/tune2fs.c:2043
msgid ""
"\n"
"The filesystem already has sparse superblocks.\n"
msgstr ""
-#: misc/tune2fs.c:2046
+#: misc/tune2fs.c:2050
#, c-format
msgid ""
"\n"
"Sparse superblock flag set. %s"
msgstr ""
-#: misc/tune2fs.c:2051
+#: misc/tune2fs.c:2055
msgid ""
"\n"
"Clearing the sparse superflag not supported.\n"
msgstr ""
-#: misc/tune2fs.c:2059
+#: misc/tune2fs.c:2063
#, c-format
msgid "Setting time filesystem last checked to %s\n"
msgstr ""
-#: misc/tune2fs.c:2065
+#: misc/tune2fs.c:2069
#, c-format
msgid "Setting reserved blocks uid to %lu\n"
msgstr ""
-#: misc/tune2fs.c:2097
+#: misc/tune2fs.c:2101
msgid "Error in using clear_mmp. It must be used with -f\n"
msgstr ""
-#: misc/tune2fs.c:2115
+#: misc/tune2fs.c:2119
msgid ""
"The quota feature may only be changed when the filesystem is unmounted.\n"
msgstr ""
-#: misc/tune2fs.c:2148
+#: misc/tune2fs.c:2152
msgid "Invalid UUID format\n"
msgstr ""
-#: misc/tune2fs.c:2161
+#: misc/tune2fs.c:2165
msgid "The inode size may only be changed when the filesystem is unmounted.\n"
msgstr ""
-#: misc/tune2fs.c:2169
+#: misc/tune2fs.c:2173
msgid ""
"Changing the inode size not supported for filesystems with the flex_bg\n"
"feature enabled.\n"
msgstr ""
-#: misc/tune2fs.c:2182
+#: misc/tune2fs.c:2186
#, c-format
msgid "Setting inode size %lu\n"
msgstr ""
-#: misc/tune2fs.c:2185
+#: misc/tune2fs.c:2189
#, c-format
msgid "Failed to change inode size\n"
msgstr ""
-#: misc/tune2fs.c:2196
+#: misc/tune2fs.c:2200
#, c-format
msgid "Setting stride size to %d\n"
msgstr ""
-#: misc/tune2fs.c:2201
+#: misc/tune2fs.c:2205
#, c-format
msgid "Setting stripe width to %d\n"
msgstr ""
-#: misc/tune2fs.c:2208
+#: misc/tune2fs.c:2212
#, c-format
msgid "Setting extended default mount options to '%s'\n"
msgstr ""
@@ -5306,47 +5324,56 @@ msgstr ""
msgid "Begin pass %d (max = %lu)\n"
msgstr ""
-#: resize/main.c:259
+#: resize/main.c:154
+#, c-format
+msgid ""
+"\n"
+"Resizing bigalloc file systems has not been fully tested. Proceed\n"
+"at your own risk! Use the force option if you want to go ahead anyway.\n"
+"\n"
+msgstr ""
+
+#: resize/main.c:271
#, c-format
msgid "while opening %s"
msgstr ""
-#: resize/main.c:267
+#: resize/main.c:279
#, c-format
msgid "while getting stat information for %s"
msgstr ""
-#: resize/main.c:325 resize/main.c:437
+#: resize/main.c:337 resize/main.c:450
#, c-format
msgid ""
"Please run 'e2fsck -f %s' first.\n"
"\n"
msgstr ""
-#: resize/main.c:329
+#: resize/main.c:341
#, c-format
msgid "Estimated minimum size of the filesystem: %llu\n"
msgstr ""
-#: resize/main.c:365
+#: resize/main.c:377
#, c-format
msgid "Invalid new size: %s\n"
msgstr ""
-#: resize/main.c:381
+#: resize/main.c:393
msgid "New size too large to be expressed in 32 bits\n"
msgstr ""
-#: resize/main.c:389
+#: resize/main.c:401
#, c-format
msgid "New size smaller than minimum (%llu)\n"
msgstr ""
-#: resize/main.c:395
+#: resize/main.c:407
msgid "Invalid stride length"
msgstr ""
-#: resize/main.c:419
+#: resize/main.c:431
#, c-format
msgid ""
"The containing partition (or device) is only %llu (%dk) blocks.\n"
@@ -5354,38 +5381,38 @@ msgid ""
"\n"
msgstr ""
-#: resize/main.c:426
+#: resize/main.c:438
#, c-format
msgid ""
"The filesystem is already %llu blocks long. Nothing to do!\n"
"\n"
msgstr ""
-#: resize/main.c:441
+#: resize/main.c:455
#, c-format
msgid "Resizing the filesystem on %s to %llu (%dk) blocks.\n"
msgstr ""
-#: resize/main.c:450
+#: resize/main.c:464
#, c-format
msgid "while trying to resize %s"
msgstr ""
-#: resize/main.c:453
+#: resize/main.c:467
#, c-format
msgid ""
"Please run 'e2fsck -fy %s' to fix the filesystem\n"
"after the aborted resize operation.\n"
msgstr ""
-#: resize/main.c:459
+#: resize/main.c:473
#, c-format
msgid ""
"The filesystem on %s is now %llu blocks long.\n"
"\n"
msgstr ""
-#: resize/main.c:474
+#: resize/main.c:488
#, c-format
msgid "while trying to truncate %s"
msgstr ""
@@ -5454,20 +5481,20 @@ msgid ""
"this system.\n"
msgstr ""
-#: resize/resize2fs.c:361
+#: resize/resize2fs.c:370
#, c-format
msgid "inodes (%llu) must be less than %u"
msgstr ""
-#: resize/resize2fs.c:594
+#: resize/resize2fs.c:603
msgid "reserved blocks"
msgstr ""
-#: resize/resize2fs.c:834
+#: resize/resize2fs.c:843
msgid "meta-data blocks"
msgstr ""
-#: resize/resize2fs.c:1778
+#: resize/resize2fs.c:1805
#, c-format
msgid "Should never happen: resize inode corrupt!\n"
msgstr ""
@@ -6053,6 +6080,46 @@ msgid "MMP: open with O_DIRECT failed"
msgstr ""
#: lib/ext2fs/ext2_err.c:156
+msgid "Block group descriptor size incorrect"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:157
+msgid "Inode checksum does not match inode"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:158
+msgid "Inode bitmap checksum does not match bitmap"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:159
+msgid "Extent block checksum does not match extent block"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:160
+msgid "Directory block does not have space for checksum"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:161
+msgid "Directory block checksum does not match directory block"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:162
+msgid "Extended attribute block checksum does not match block"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:163
+msgid "Superblock checksum does not match superblock"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:164
+msgid "Unknown checksum algorithm"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:165
+msgid "MMP block checksum does not match MMP block"
+msgstr ""
+
+#: lib/ext2fs/ext2_err.c:166
msgid "Ext2 file already exists"
msgstr ""
diff --git a/resize/main.c b/resize/main.c
index 711e3754..4cbfe69b 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -147,6 +147,18 @@ static void determine_fs_stride(ext2_filsys fs)
#endif
}
+static bigalloc_check(ext2_filsys fs, int force)
+{
+ if (!force && EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+ EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
+ fprintf(stderr, _("\nResizing bigalloc file systems has "
+ "not been fully tested. Proceed\n"
+ "at your own risk! Use the force option "
+ "if you want to go ahead anyway.\n\n"));
+ exit(1);
+ }
+}
+
int main (int argc, char ** argv)
{
errcode_t retval;
@@ -428,6 +440,7 @@ int main (int argc, char ** argv)
exit(0);
}
if (mount_flags & EXT2_MF_MOUNTED) {
+ bigalloc_check(fs, force);
retval = online_resize_fs(fs, mtpt, &new_size, flags);
} else {
if (!force && ((fs->super->s_lastcheck < fs->super->s_mtime) ||
@@ -438,6 +451,7 @@ int main (int argc, char ** argv)
device_name);
exit(1);
}
+ bigalloc_check(fs, force);
printf(_("Resizing the filesystem on "
"%s to %llu (%dk) blocks.\n"),
device_name, new_size, fs->blocksize / 1024);
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 8ef65133..2f20410f 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -62,6 +62,15 @@ static errcode_t fix_sb_journal_backup(ext2_filsys fs);
((blk) < (ext2fs_inode_table_loc((fs), (i)) + \
(fs)->inode_blocks_per_group)))
+/* Some bigalloc helper macros which are more succint... */
+#define B2C(x) EXT2FS_B2C(fs, (x))
+#define C2B(x) EXT2FS_C2B(fs, (x))
+#define EQ_CLSTR(x, y) (B2C(x) == B2C(y))
+#define LE_CLSTR(x, y) (B2C(x) <= B2C(y))
+#define LT_CLSTR(x, y) (B2C(x) < B2C(y))
+#define GE_CLSTR(x, y) (B2C(x) >= B2C(y))
+#define GT_CLSTR(x, y) (B2C(x) > B2C(y))
+
int lazy_itable_init;
/*
@@ -1166,8 +1175,9 @@ static errcode_t block_mover(ext2_resize_t rfs)
*/
to_move = moved = 0;
init_block_alloc(rfs);
- for (blk = old_fs->super->s_first_data_block;
- blk < ext2fs_blocks_count(old_fs->super); blk++) {
+ for (blk = B2C(old_fs->super->s_first_data_block);
+ blk < ext2fs_blocks_count(old_fs->super);
+ blk += EXT2FS_CLUSTER_RATIO(fs)) {
if (!ext2fs_test_block_bitmap2(old_fs->block_map, blk))
continue;
if (!ext2fs_test_block_bitmap2(rfs->move_blocks, blk))
@@ -1184,7 +1194,7 @@ static errcode_t block_mover(ext2_resize_t rfs)
goto errout;
}
ext2fs_block_alloc_stats2(fs, new_blk, +1);
- ext2fs_add_extent_entry(rfs->bmap, blk, new_blk);
+ ext2fs_add_extent_entry(rfs->bmap, B2C(blk), B2C(new_blk));
to_move++;
}
@@ -1214,6 +1224,9 @@ static errcode_t block_mover(ext2_resize_t rfs)
if (retval) goto errout;
if (!size)
break;
+ old_blk = C2B(old_blk);
+ new_blk = C2B(new_blk);
+ size = C2B(size);
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_BMOVE)
printf("Moving %llu blocks %llu->%llu\n",
@@ -1264,6 +1277,20 @@ errout:
*/
+/*
+ * The extent translation table is stored in clusters so we need to
+ * take special care when mapping a source block number to its
+ * destination block number.
+ */
+__u64 extent_translate(ext2_filsys fs, ext2_extent extent, __u64 old_loc)
+{
+ __u64 new_block = C2B(ext2fs_extent_translate(extent, B2C(old_loc)));
+
+ if (new_block != 0)
+ new_block += old_loc & (EXT2FS_CLUSTER_RATIO(fs) - 1);
+ return new_block;
+}
+
struct process_block_struct {
ext2_resize_t rfs;
ext2_ino_t ino;
@@ -1286,7 +1313,7 @@ static int process_block(ext2_filsys fs, blk64_t *block_nr,
pb = (struct process_block_struct *) priv_data;
block = *block_nr;
if (pb->rfs->bmap) {
- new_block = ext2fs_extent_translate(pb->rfs->bmap, block);
+ new_block = extent_translate(fs, pb->rfs->bmap, block);
if (new_block) {
*block_nr = new_block;
ret |= BLOCK_CHANGED;
@@ -1412,7 +1439,7 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
pb.changed = 0;
if (ext2fs_file_acl_block(rfs->old_fs, inode) && rfs->bmap) {
- new_block = ext2fs_extent_translate(rfs->bmap,
+ new_block = extent_translate(rfs->old_fs, rfs->bmap,
ext2fs_file_acl_block(rfs->old_fs, inode));
if (new_block) {
ext2fs_file_acl_block_set(rfs->old_fs, inode,
@@ -1819,26 +1846,27 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
else
old_desc_blocks = fs->desc_blocks +
fs->super->s_reserved_gdt_blocks;
- for (blk = fs->super->s_first_data_block;
- blk < ext2fs_blocks_count(fs->super); blk++) {
+ for (blk = B2C(fs->super->s_first_data_block);
+ blk < ext2fs_blocks_count(fs->super);
+ blk += EXT2FS_CLUSTER_RATIO(fs)) {
if ((uninit &&
- !((blk == super_blk) ||
+ !(EQ_CLSTR(blk, super_blk) ||
((old_desc_blk && old_desc_blocks &&
- (blk >= old_desc_blk) &&
- (blk < old_desc_blk + old_desc_blocks))) ||
- ((new_desc_blk && (blk == new_desc_blk))) ||
- (blk == ext2fs_block_bitmap_loc(fs, group)) ||
- (blk == ext2fs_inode_bitmap_loc(fs, group)) ||
- ((blk >= ext2fs_inode_table_loc(fs, group) &&
- (blk < ext2fs_inode_table_loc(fs, group)
- + fs->inode_blocks_per_group))))) ||
+ GE_CLSTR(blk, old_desc_blk) &&
+ LT_CLSTR(blk, old_desc_blk + old_desc_blocks))) ||
+ ((new_desc_blk && EQ_CLSTR(blk, new_desc_blk))) ||
+ EQ_CLSTR(blk, ext2fs_block_bitmap_loc(fs, group)) ||
+ EQ_CLSTR(blk, ext2fs_inode_bitmap_loc(fs, group)) ||
+ ((GE_CLSTR(blk, ext2fs_inode_table_loc(fs, group)) &&
+ LT_CLSTR(blk, ext2fs_inode_table_loc(fs, group)
+ + fs->inode_blocks_per_group))))) ||
(!ext2fs_fast_test_block_bitmap2(fs->block_map, blk))) {
group_free++;
total_blocks_free++;
}
count++;
- if ((count == fs->super->s_blocks_per_group) ||
- (blk == ext2fs_blocks_count(fs->super)-1)) {
+ if ((count == fs->super->s_clusters_per_group) ||
+ EQ_CLSTR(blk, ext2fs_blocks_count(fs->super)-1)) {
ext2fs_bg_free_blocks_count_set(fs, group, group_free);
ext2fs_group_desc_csum_set(fs, group);
group++;
@@ -1858,6 +1886,7 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
fs->super->s_reserved_gdt_blocks;
}
}
+ total_blocks_free = C2B(total_blocks_free);
ext2fs_free_blocks_count_set(fs->super, total_blocks_free);
/*
diff --git a/version.h b/version.h
index fd3ee9df..10be88db 100644
--- a/version.h
+++ b/version.h
@@ -8,4 +8,4 @@
*/
#define E2FSPROGS_VERSION "1.43-WIP"
-#define E2FSPROGS_DATE "15-Jan-2013"
+#define E2FSPROGS_DATE "21-Jan-2013"