]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - e2fsck/pass5.c
Merge branch 'maint' into next
[thirdparty/e2fsprogs.git] / e2fsck / pass5.c
index 86ac9fd9a7a36afe773b53360d165061a62a2799..7803e8b80178031e2e874f7209659b6395a8d79a 100644 (file)
@@ -21,8 +21,6 @@
 #include "e2fsck.h"
 #include "problem.h"
 
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-
 static void check_block_bitmaps(e2fsck_t ctx);
 static void check_inode_bitmaps(e2fsck_t ctx);
 static void check_inode_end(e2fsck_t ctx);
@@ -84,14 +82,13 @@ void e2fsck_pass5(e2fsck_t ctx)
 static void check_inode_bitmap_checksum(e2fsck_t ctx)
 {
        struct problem_context  pctx;
-       char            *buf;
+       char            *buf = NULL;
        dgrp_t          i;
        int             nbytes;
        ext2_ino_t      ino_itr;
        errcode_t       retval;
 
-       if (!EXT2_HAS_RO_COMPAT_FEATURE(ctx->fs->super,
-                                       EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+       if (!ext2fs_has_feature_metadata_csum(ctx->fs->super))
                return;
 
        /* If bitmap is dirty from being fixed, checksum will be corrected */
@@ -99,8 +96,7 @@ static void check_inode_bitmap_checksum(e2fsck_t ctx)
                return;
 
        nbytes = (size_t)(EXT2_INODES_PER_GROUP(ctx->fs->super) / 8);
-       retval = ext2fs_get_memalign(ctx->fs->blocksize, ctx->fs->blocksize,
-                                    &buf);
+       retval = ext2fs_get_mem(ctx->fs->blocksize, &buf);
        if (retval) {
                com_err(ctx->program_name, 0, "%s",
                    _("check_inode_bitmap_checksum: Memory allocation error"));
@@ -140,14 +136,13 @@ static void check_inode_bitmap_checksum(e2fsck_t ctx)
 static void check_block_bitmap_checksum(e2fsck_t ctx)
 {
        struct problem_context  pctx;
-       char            *buf;
+       char            *buf = NULL;
        dgrp_t          i;
        int             nbytes;
        blk64_t         blk_itr;
        errcode_t       retval;
 
-       if (!EXT2_HAS_RO_COMPAT_FEATURE(ctx->fs->super,
-                                       EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+       if (!ext2fs_has_feature_metadata_csum(ctx->fs->super))
                return;
 
        /* If bitmap is dirty from being fixed, checksum will be corrected */
@@ -155,8 +150,7 @@ static void check_block_bitmap_checksum(e2fsck_t ctx)
                return;
 
        nbytes = (size_t)(EXT2_CLUSTERS_PER_GROUP(ctx->fs->super) / 8);
-       retval = ext2fs_get_memalign(ctx->fs->blocksize, ctx->fs->blocksize,
-                                    &buf);
+       retval = ext2fs_get_mem(ctx->fs->blocksize, &buf);
        if (retval) {
                com_err(ctx->program_name, 0, "%s",
                    _("check_block_bitmap_checksum: Memory allocation error"));
@@ -306,7 +300,7 @@ static void print_bitmap_problem(e2fsck_t ctx, problem_t problem,
        pctx->ino = pctx->ino2 = 0;
 }
 
-/* Just to be more succint */
+/* Just to be more succinct */
 #define B2C(x) EXT2FS_B2C(fs, (x))
 #define EQ_CLSTR(x, y) (B2C(x) == B2C(y))
 #define LE_CLSTR(x, y) (B2C(x) <= B2C(y))
@@ -394,7 +388,7 @@ redo_counts:
                 * to do a discard operation.
                 */
                if (!first_block_in_bg ||
-                   (group == (int)fs->group_desc_count - 1) ||
+                   (group == fs->group_desc_count - 1) ||
                    (ctx->options & E2F_OPT_DISCARD))
                        goto no_optimize;