Skip to content

Commit

Permalink
Merge branch 'maint' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
tytso committed Mar 28, 2024
2 parents 1094c17 + b112f90 commit d656357
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 22 deletions.
4 changes: 2 additions & 2 deletions e2fsck/ea_refcount.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -177,7 +177,7 @@ static struct ea_refcount_el *get_refcount_el(ext2_refcount_t refcount,
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;
Expand Down
9 changes: 6 additions & 3 deletions e2fsck/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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++) {
Expand Down Expand Up @@ -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)) -
Expand Down
2 changes: 1 addition & 1 deletion e2fsck/sigcatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions lib/blkid/blkidP.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions lib/blkid/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -414,15 +417,15 @@ 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;
/* Continue reading next line if it ends with a backslash */
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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/ext2fs/imager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
16 changes: 9 additions & 7 deletions lib/ext2fs/initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,6 @@ errcode_t ext2fs_initialize(const char *name, int flags,
else
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
Expand Down Expand Up @@ -375,6 +368,15 @@ errcode_t ext2fs_initialize(const char *name, int flags,
}
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;

/*
Expand Down
8 changes: 4 additions & 4 deletions misc/tune2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d656357

Please sign in to comment.