aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2024-03-28 13:51:24 -0400
committerTheodore Ts'o <tytso@mit.edu>2024-03-28 13:51:24 -0400
commitd656357241b50b2bd54c7099b6f2b987b58150df (patch)
tree020ff52295f4d88b5a67dc9ea07873956eac73cf
parent1094c175940d38013dd87145c18169f04530c978 (diff)
parentb112f906212ff8067da82c9449413e93944b67f4 (diff)
downloade2fsprogs-d656357241b50b2bd54c7099b6f2b987b58150df.tar.gz
Merge branch 'maint' into next
-rw-r--r--e2fsck/ea_refcount.c4
-rw-r--r--e2fsck/extents.c9
-rw-r--r--e2fsck/sigcatcher.c2
-rw-r--r--lib/blkid/blkidP.h2
-rw-r--r--lib/blkid/read.c9
-rw-r--r--lib/ext2fs/imager.c4
-rw-r--r--lib/ext2fs/initialize.c16
-rw-r--r--misc/tune2fs.c8
8 files changed, 32 insertions, 22 deletions
diff --git a/e2fsck/ea_refcount.c b/e2fsck/ea_refcount.c
index 7154b47c3..7ca56696e 100644
--- a/e2fsck/ea_refcount.c
+++ b/e2fsck/ea_refcount.c
@@ -120,7 +120,7 @@ static struct ea_refcount_el *insert_refcount_el(ext2_refcount_t refcount,
if (refcount->count >= refcount->size) {
new_size = refcount->size + 100;
#ifdef DEBUG
- printf("Reallocating refcount %d entries...\n", new_size);
+ printf("Reallocating refcount %zu entries...\n", new_size);
#endif
retval = ext2fs_resize_mem((size_t) refcount->size *
sizeof(struct ea_refcount_el),
@@ -177,7 +177,7 @@ retry:
if (ea_key == refcount->list[refcount->cursor].ea_key)
return &refcount->list[refcount->cursor++];
#ifdef DEBUG
- printf("Non-cursor get_refcount_el: %u\n", ea_key);
+ printf("Non-cursor get_refcount_el: %llu\n", (unsigned long long) ea_key);
#endif
while (low <= high) {
mid = (low+high)/2;
diff --git a/e2fsck/extents.c b/e2fsck/extents.c
index 70798f346..652e938dc 100644
--- a/e2fsck/extents.c
+++ b/e2fsck/extents.c
@@ -201,7 +201,10 @@ static errcode_t rewrite_extent_replay(e2fsck_t ctx, struct extent_list *list,
{
errcode_t retval;
ext2_extent_handle_t handle;
- unsigned int i, ext_written;
+ unsigned int i;
+#if defined(DEBUG) || defined(DEBUG_SUMMARY)
+ unsigned int ext_written = 0;
+#endif
struct ext2fs_extent *ex, extent;
blk64_t start_val, delta;
@@ -223,8 +226,6 @@ static errcode_t rewrite_extent_replay(e2fsck_t ctx, struct extent_list *list,
if (retval)
return retval;
- ext_written = 0;
-
start_val = ext2fs_get_stat_i_blocks(ctx->fs, EXT2_INODE(inode));
for (i = 0, ex = list->extents; i < list->count; i++, ex++) {
@@ -263,7 +264,9 @@ static errcode_t rewrite_extent_replay(e2fsck_t ctx, struct extent_list *list,
retval = ext2fs_extent_fix_parents(handle);
if (retval)
goto err;
+#if defined(DEBUG) || defined(DEBUG_SUMMARY)
ext_written++;
+#endif
}
delta = ext2fs_get_stat_i_blocks(ctx->fs, EXT2_INODE(inode)) -
diff --git a/e2fsck/sigcatcher.c b/e2fsck/sigcatcher.c
index a9d3b7f2c..e20273486 100644
--- a/e2fsck/sigcatcher.c
+++ b/e2fsck/sigcatcher.c
@@ -413,7 +413,7 @@ int main(int argc, char** argv)
struct sigaction sa;
char *p = 0;
int i, c;
- volatile x=0;
+ volatile int x = 0;
memset(&sa, 0, sizeof(struct sigaction));
sa.sa_sigaction = die_signal_handler;
diff --git a/lib/blkid/blkidP.h b/lib/blkid/blkidP.h
index 68ea5724f..dad8bfbbf 100644
--- a/lib/blkid/blkidP.h
+++ b/lib/blkid/blkidP.h
@@ -152,8 +152,10 @@ extern char *blkid_strndup(const char *s, const int length);
#include <stdio.h>
extern int blkid_debug_mask;
#define DBG(m,x) if ((m) & blkid_debug_mask) x;
+#define INC_LINENO lineno++
#else
#define DBG(m,x)
+#define INC_LINENO
#endif
#ifdef CONFIG_BLKID_DEBUG
diff --git a/lib/blkid/read.c b/lib/blkid/read.c
index b8948564c..ad4f44f0a 100644
--- a/lib/blkid/read.c
+++ b/lib/blkid/read.c
@@ -382,7 +382,10 @@ void blkid_read_cache(blkid_cache cache)
{
FILE *file;
char buf[4096];
- int fd, lineno = 0;
+ int fd;
+#ifdef CONFIG_BLKID_DEBUG
+ int lineno = 0;
+#endif
struct stat st;
if (!cache)
@@ -414,7 +417,7 @@ void blkid_read_cache(blkid_cache cache)
blkid_dev dev;
unsigned int end;
- lineno++;
+ INC_LINENO;
if (buf[0] == 0)
continue;
end = strlen(buf) - 1;
@@ -422,7 +425,7 @@ void blkid_read_cache(blkid_cache cache)
while (buf[end] == '\\' && end < sizeof(buf) - 2 &&
fgets(buf + end, sizeof(buf) - end, file)) {
end = strlen(buf) - 1;
- lineno++;
+ INC_LINENO;
}
if (blkid_parse_line(cache, &dev, buf) < 0) {
diff --git a/lib/ext2fs/imager.c b/lib/ext2fs/imager.c
index 23290a6a2..16b09770c 100644
--- a/lib/ext2fs/imager.c
+++ b/lib/ext2fs/imager.c
@@ -299,7 +299,7 @@ errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd,
ssize_t actual, size;
errcode_t retval;
- size = (ssize_t)fs->blocksize * (fs->group_desc_count + 1);
+ size = (ssize_t)fs->blocksize * (fs->desc_blocks + 1);
buf = malloc(size);
if (!buf)
return ENOMEM;
@@ -323,7 +323,7 @@ errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd,
memcpy(fs->super, buf, SUPERBLOCK_SIZE);
memcpy(fs->group_desc, buf + fs->blocksize,
- (ssize_t)fs->blocksize * fs->group_desc_count);
+ (ssize_t)fs->blocksize * fs->desc_blocks);
retval = 0;
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index edd692bb9..e96f3cabd 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -308,13 +308,6 @@ retry:
set_field(s_inodes_count, ext2fs_blocks_count(super) / i);
/*
- * Make sure we have at least EXT2_FIRST_INO + 1 inodes, so
- * that we have enough inodes for the filesystem(!)
- */
- if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1)
- super->s_inodes_count = EXT2_FIRST_INODE(super)+1;
-
- /*
* There should be at least as many inodes as the user
* requested. Figure out how many inodes per group that
* should be. But make sure that we don't allocate more than
@@ -375,6 +368,15 @@ ipg_retry:
}
super->s_inodes_count = super->s_inodes_per_group *
fs->group_desc_count;
+ /*
+ * Make sure we have at least EXT2_FIRST_INO + 1 inodes, so
+ * that we have enough inodes for the filesystem(!)
+ */
+ if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1) {
+ ipg += 8;
+ goto ipg_retry;
+ }
+
super->s_free_inodes_count = super->s_inodes_count;
/*
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 78b58347f..f0af3cae8 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3519,9 +3519,9 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
}
if (Q_flag) {
- if (mount_flags & EXT2_MF_MOUNTED) {
+ if (mount_flags & (EXT2_MF_BUSY | EXT2_MF_MOUNTED)) {
fputs(_("The quota feature may only be changed when "
- "the filesystem is unmounted.\n"), stderr);
+ "the filesystem is unmounted and not in use.\n"), stderr);
rc = 1;
goto closefs;
}
@@ -3672,10 +3672,10 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
}
if (I_flag) {
- if (mount_flags & EXT2_MF_MOUNTED) {
+ if (mount_flags & (EXT2_MF_BUSY | EXT2_MF_MOUNTED)) {
fputs(_("The inode size may only be "
"changed when the filesystem is "
- "unmounted.\n"), stderr);
+ "unmounted and not in use.\n"), stderr);
rc = 1;
goto closefs;
}