This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main in repository gfs2-utils.
commit a98fdbf98081f7b0be4022e61e7086883341097b Author: Andrew Price anprice@redhat.com AuthorDate: Thu Jan 6 15:37:18 2022 +0000
fsck.gfs2: Use PRIu64 instead of casting uint64_t to unsigned long long
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/fsck/afterpass1_common.c | 12 +-- gfs2/fsck/fs_recovery.c | 25 ++---- gfs2/fsck/initialize.c | 64 +++++--------- gfs2/fsck/link.c | 39 ++++---- gfs2/fsck/main.c | 21 ++--- gfs2/fsck/metawalk.c | 65 +++++--------- gfs2/fsck/pass1.c | 101 ++++++++------------- gfs2/fsck/pass1b.c | 201 ++++++++++++++++-------------------------- gfs2/fsck/pass2.c | 119 ++++++++++--------------- gfs2/fsck/pass3.c | 6 +- gfs2/fsck/pass4.c | 48 ++++------ gfs2/fsck/pass5.c | 43 ++++----- gfs2/fsck/rgrepair.c | 73 +++++++-------- gfs2/fsck/util.c | 33 +++---- 14 files changed, 322 insertions(+), 528 deletions(-)
diff --git a/gfs2/fsck/afterpass1_common.c b/gfs2/fsck/afterpass1_common.c index 6e5fbe0c..12a9f647 100644 --- a/gfs2/fsck/afterpass1_common.c +++ b/gfs2/fsck/afterpass1_common.c @@ -139,10 +139,8 @@ int remove_dentry_from_dir(struct gfs2_sbd *sdp, uint64_t dir, int q; int error;
- log_debug( _("Removing dentry %llu (0x%llx) from directory %llu" - " (0x%llx)\n"), (unsigned long long)dentryblock, - (unsigned long long)dentryblock, - (unsigned long long)dir, (unsigned long long)dir); + log_debug(_("Removing dentry %"PRIu64" (0x%"PRIx64") from directory %"PRIu64" (0x%"PRIx64")\n"), + dentryblock, dentryblock, dir, dir); if (!valid_block(sdp, dir)) { log_err( _("Parent directory is invalid\n")); return 1; @@ -290,10 +288,8 @@ int delete_eattr_extentry(struct gfs2_inode *ip, int i, __be64 *ea_data_ptr, error = delete_block_if_notdup(ip, block, NULL, _("extended attribute"), NULL, private); if (error) { - log_err(_("Bad extended attribute found at block %lld " - "(0x%llx)"), - (unsigned long long)be64_to_cpu(*ea_data_ptr), - (unsigned long long)be64_to_cpu(*ea_data_ptr)); + log_err(_("Bad extended attribute found at block %"PRIu64 " (0x%"PRIx64")"), + be64_to_cpu(*ea_data_ptr), be64_to_cpu(*ea_data_ptr)); if (query( _("Repair the bad Extended Attribute? (y/n) "))) { ea_hdr->ea_num_ptrs = i; ea_hdr->ea_data_len = cpu_to_be32(tot_ealen); diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c index 12b8d704..48d98626 100644 --- a/gfs2/fsck/fs_recovery.c +++ b/gfs2/fsck/fs_recovery.c @@ -151,10 +151,8 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start, if (error) return error;
- log_info( _("Journal replay writing metadata block #" - "%lld (0x%llx) for journal+0x%x\n"), - (unsigned long long)blkno, (unsigned long long)blkno, - start); + log_info(_("Journal replay writing metadata block #%"PRIu64" (0x%"PRIx64") for journal+0x%x\n"), + blkno, blkno, start); bh_ip = bget(sdp, blkno); if (!bh_ip) { log_err(_("Out of memory when replaying journals.\n")); @@ -164,10 +162,8 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
mhp = (struct gfs2_meta_header *)bh_ip->b_data; if (be32_to_cpu(mhp->mh_magic) != GFS2_MAGIC) { - log_err(_("Journal corruption detected at block #" - "%lld (0x%llx) for journal+0x%x.\n"), - (unsigned long long)blkno, (unsigned long long)blkno, - start); + log_err(_("Journal corruption detected at block #%"PRIu64" (0x%"PRIx64") for journal+0x%x.\n"), + blkno, blkno, start); error = -EIO; } else { bmodified(bh_ip); @@ -215,11 +211,8 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start, } while (offset + sizeof(uint64_t) <= sdp->sd_bsize) { blkno = be64_to_cpu(*(__be64 *)(bh->b_data + offset)); - log_info( _("Journal replay processing revoke for " - "block #%lld (0x%llx) for journal+0x%x\n"), - (unsigned long long)blkno, - (unsigned long long)blkno, - start); + log_info(_("Journal replay processing revoke for block #%"PRIu64" (0x%"PRIx64") for journal+0x%x\n"), + blkno, blkno, start); error = gfs2_revoke_add(sdp, blkno, start); if (error < 0) return error; @@ -269,10 +262,8 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start, if (error) return error;
- log_info( _("Journal replay writing data block #%lld (0x%llx)" - " for journal+0x%x\n"), - (unsigned long long)blkno, (unsigned long long)blkno, - start); + log_info(_("Journal replay writing data block #%"PRIu64" (0x%"PRIx64") for journal+0x%x\n"), + blkno, blkno, start); bh_ip = bget(sdp, blkno); if (!bh_ip) { log_err(_("Out of memory when replaying journals.\n")); diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c index 86f032e7..a3ab7f7e 100644 --- a/gfs2/fsck/initialize.c +++ b/gfs2/fsck/initialize.c @@ -33,7 +33,7 @@ static int was_mounted_ro = 0; static uint64_t possible_root = HIGHEST_BLOCK; static struct master_dir fix_md; -static unsigned long long blks_2free = 0; +static uint64_t blks_2free = 0;
/** * block_mounters @@ -152,10 +152,9 @@ static int set_block_ranges(struct gfs2_sbd *sdp)
last_fs_block = rmax; if (last_fs_block > 0xffffffff && sizeof(unsigned long) <= 4) { - log_crit( _("This file system is too big for this computer to handle.\n")); - log_crit( _("Last fs block = 0x%llx, but sizeof(unsigned long) is %zu bytes.\n"), - (unsigned long long)last_fs_block, - sizeof(unsigned long)); + log_crit(_("This file system is too big for this computer to handle.\n")); + log_crit(_("Last fs block = 0x%"PRIx64", but sizeof(unsigned long) is %zu bytes.\n"), + last_fs_block, sizeof(unsigned long)); goto fail; }
@@ -163,24 +162,21 @@ static int set_block_ranges(struct gfs2_sbd *sdp) first_data_block = rmin;
if (fsck_lseek(sdp->device_fd, (last_fs_block * sdp->sd_bsize))){ - log_crit( _("Can't seek to last block in file system: %llu" - " (0x%llx)\n"), (unsigned long long)last_fs_block, - (unsigned long long)last_fs_block); + log_crit(_("Can't seek to last block in file system: %"PRIu64" (0x%"PRIx64")\n"), + last_fs_block, last_fs_block); goto fail; }
memset(buf, 0, sdp->sd_bsize); error = read(sdp->device_fd, buf, sdp->sd_bsize); if (error != sdp->sd_bsize){ - log_crit( _("Can't read last block in file system (error %u), " - "last_fs_block: %llu (0x%llx)\n"), error, - (unsigned long long)last_fs_block, - (unsigned long long)last_fs_block); + log_crit(_("Can't read last block in file system (error %u), " + "last_fs_block: %"PRIu64" (0x%"PRIx64")\n"), + error, last_fs_block, last_fs_block); goto fail; }
- log_info(_("0x%llx to 0x%llx\n"), (unsigned long long)first_data_block, - (unsigned long long)last_data_block); + log_info(_("0x%"PRIx64" to 0x%"PRIx64"\n"), first_data_block, last_data_block); return 0;
fail: @@ -256,13 +252,11 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, } /* GFS2_BLKST_UNLINKED */ if (sdp->gfs1) - log_info(_("Free metadata block 0x%llx" - " found.\n"), - (unsigned long long)diblock); + log_info(_("Free metadata block 0x%"PRIx64" found.\n"), + diblock); else - log_info(_("Unlinked dinode 0x%llx " - "found.\n"), - (unsigned long long)diblock); + log_info(_("Unlinked dinode 0x%"PRIx64" found.\n"), + diblock); if (!asked) { char msg[256];
@@ -288,17 +282,15 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, rgd->rt_free++; if (sdp->gfs1 && rgd->rt_freemeta) rgd->rt_freemeta--; - log_info(_("Free metadata block %lld (0x%llx) " - "reclaimed.\n"), - (unsigned long long)diblock, - (unsigned long long)diblock); + log_info(_("Free metadata block %"PRIu64" (0x%"PRIx64") reclaimed.\n"), + diblock, diblock); bh = bread(sdp, diblock); if (!gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI)) { struct gfs2_inode *ip = fsck_inode_get(sdp, rgd, bh); if (ip->i_blocks > 1) { blks_2free += ip->i_blocks - 1; - log_info(_("%llu blocks " + log_info(_("%"PRIu64" blocks " "(total) may need " "to be freed in " "pass 5.\n"), @@ -393,14 +385,6 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, } else log_err( _("The rgrp was not fixed.\n")); } - /* - else { - log_debug( _("Resource group %lld (0x%llx) free space " - "is consistent: free: %d reclaimed: %d\n"), - (unsigned long long)rgd->ri.ri_addr, - (unsigned long long)rgd->ri.ri_addr, - rg_free, rg_reclaimed); - }*/ }
/** @@ -441,9 +425,9 @@ static void check_rgrps_integrity(struct gfs2_sbd *sdp) rgs_good, rgs_cleaned, rgs_bad, rgs_fixed, rgs_good + rgs_bad + rgs_cleaned); if (rgs_cleaned && blks_2free) - log_err(_("%lld blocks may need to be freed in pass 5 " + log_err(_("%"PRIu64" blocks may need to be freed in pass 5 " "due to the cleaned resource groups.\n"), - blks_2free); + blks_2free); } }
@@ -1181,10 +1165,9 @@ static int find_rgs_for_bsize(struct gfs2_sbd *sdp, uint64_t startblock, be32_to_cpu(mh->mh_type) == GFS2_METATYPE_RB); brelse(rb_bh); if (is_rb) { - log_debug(_("boff:%d bsize2:%d rg:0x%llx, " - "rb:0x%llx\n"), bsize, bsize2, - (unsigned long long)blk, - (unsigned long long)rb_addr); + log_debug(_("boff:%d bsize2:%d rg:0x%"PRIx64", " + "rb:0x%"PRIx64"\n"), bsize, bsize2, + blk, rb_addr); *known_bsize = bsize2; break; } @@ -1285,8 +1268,7 @@ static int sb_repair(struct gfs2_sbd *sdp) "be the root; using master - 1.\n")); possible_root = sdp->sd_meta_dir.in_addr - 1; } - log_err(_("Found a possible root at: 0x%llx\n"), - (unsigned long long)possible_root); + log_err(_("Found a possible root at: 0x%"PRIx64"\n"), possible_root); sdp->sd_root_dir.in_addr = possible_root; sdp->md.rooti = lgfs2_inode_read(sdp, possible_root); if (!sdp->md.rooti || sdp->md.rooti->i_magic != GFS2_MAGIC) { diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c index 06d4a022..d5421a0d 100644 --- a/gfs2/fsck/link.c +++ b/gfs2/fsck/link.c @@ -72,11 +72,10 @@ int set_di_nlink(struct gfs2_inode *ip)
/* I'm making whyincr a macro rather than function so that the debug output * matches older versions. */ -#define whyincr(no_addr, why, referenced_from, counted_links) \ - log_debug(_("Dir (0x%llx) incremented counted links to %u " \ - "for (0x%llx) via %s\n"), \ - (unsigned long long)referenced_from, counted_links, \ - (unsigned long long)no_addr, why); +#define whyincr(no_addr, why, referenced_from, counted_links) \ + log_debug(_("Dir (0x%"PRIx64") incremented counted links to %u " \ + "for (0x%"PRIx64") via %s\n"), \ + referenced_from, counted_links, no_addr, why);
int incr_link_count(struct lgfs2_inum no, struct gfs2_inode *ip, const char *why) { @@ -125,10 +124,8 @@ int incr_link_count(struct lgfs2_inum no, struct gfs2_inode *ip, const char *why inodetree entry and set its counted links to 2 */ ii = inodetree_insert(no); if (!ii) { - log_debug( _("Ref: (0x%llx) Error incrementing link for " - "(0x%llx)!\n"), - (unsigned long long)referenced_from, - (unsigned long long)no.in_addr); + log_debug(_("Ref: 0x%"PRIx64" Error incrementing link for 0x%"PRIx64"\n"), + referenced_from, no.in_addr); fsck_inode_put(&link_ip); return INCR_LINK_BAD; } @@ -146,11 +143,10 @@ int incr_link_count(struct lgfs2_inum no, struct gfs2_inode *ip, const char *why return INCR_LINK_CHECK_ORIG; }
-#define whydecr(no_addr, why, referenced_from, counted_links) \ - log_debug(_("Dir (0x%llx) decremented counted links to %u " \ - "for (0x%llx) via %s\n"), \ - (unsigned long long)referenced_from, counted_links, \ - (unsigned long long)no_addr, why); +#define whydecr(no_addr, why, referenced_from, counted_links) \ + log_debug(_("Dir (0x%"PRIx64") decremented counted links to %u " \ + "for (0x%"PRIx64") via %s\n"), \ + referenced_from, counted_links, no_addr, why);
int decr_link_count(uint64_t inode_no, uint64_t referenced_from, int gfs1, const char *why) @@ -161,10 +157,8 @@ int decr_link_count(uint64_t inode_no, uint64_t referenced_from, int gfs1, di = dirtree_find(inode_no); if (di) { if (!di->counted_links) { - log_debug( _("Dir (0x%llx)'s link to " - "(0x%llx) via %s is zero!\n"), - (unsigned long long)referenced_from, - (unsigned long long)inode_no, why); + log_debug(_("Dir 0x%"PRIx64"'s link to 0x%"PRIx64" via %s is zero!\n"), + referenced_from, inode_no, why); return 0; } di->counted_links--; @@ -177,10 +171,8 @@ int decr_link_count(uint64_t inode_no, uint64_t referenced_from, int gfs1, * inode_no */ if (ii) { if (!ii->counted_links) { - log_debug( _("Dir (0x%llx)'s link to " - "(0x%llx) via %s is zero!\n"), - (unsigned long long)referenced_from, - (unsigned long long)inode_no, why); + log_debug(_("Dir 0x%"PRIx64"'s link to 0x%"PRIx64" via %s is zero!\n"), + referenced_from, inode_no, why); return 0; } ii->counted_links--; @@ -193,8 +185,7 @@ int decr_link_count(uint64_t inode_no, uint64_t referenced_from, int gfs1, return 0; }
- log_debug( _("No match found when decrementing link for (0x%llx)!\n"), - (unsigned long long)inode_no); + log_debug(_("No match found when decrementing link for (0x%"PRIx64")!\n"), inode_no); return -1;
} diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c index b528b5ee..35b13950 100644 --- a/gfs2/fsck/main.c +++ b/gfs2/fsck/main.c @@ -146,9 +146,8 @@ static void interrupt(int sig) if (!last_reported_block || last_reported_block == last_fs_block) sprintf(progress, _("progress unknown.\n")); else - sprintf(progress, _("processing block %llu out of %llu\n"), - (unsigned long long)last_reported_block, - (unsigned long long)last_fs_block); + sprintf(progress, _("processing block %"PRIu64" out of %"PRIu64"\n"), + last_reported_block, last_fs_block);
response = generic_interrupt("fsck.gfs2", pass_name, progress, _("Do you want to abort fsck.gfs2, skip " \ @@ -215,15 +214,13 @@ static int check_statfs(struct gfs2_sbd *sdp) log_err( _("free: %"PRId64" (0x%"PRIx64")\n"), sc_free, sc_free); log_err( _("dinodes: %"PRId64" (0x%"PRIx64")\n\n"), sc_dinodes, sc_dinodes); log_err( _("Calculated statfs values:\n")); - log_err( _("blocks: %lld (0x%llx)\n"), - (unsigned long long)sdp->blks_total, - (unsigned long long)sdp->blks_total); - log_err( _("free: %lld (0x%llx)\n"), - (unsigned long long)(sdp->blks_total - sdp->blks_alloced), - (unsigned long long)(sdp->blks_total - sdp->blks_alloced)); - log_err( _("dinodes: %lld (0x%llx)\n"), - (unsigned long long)sdp->dinodes_alloced, - (unsigned long long)sdp->dinodes_alloced); + log_err( _("blocks: %"PRIu64" (0x%"PRIx64")\n"), + sdp->blks_total, sdp->blks_total); + log_err( _("free: %"PRIu64" (0x%"PRIx64")\n"), + (sdp->blks_total - sdp->blks_alloced), + (sdp->blks_total - sdp->blks_alloced)); + log_err( _("dinodes: %"PRIu64" (0x%"PRIx64")\n"), + sdp->dinodes_alloced, sdp->dinodes_alloced);
errors_found++; if (!query( _("Okay to fix the master statfs file? (y/n)"))) { diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c index deaa1ed8..b5e7c865 100644 --- a/gfs2/fsck/metawalk.c +++ b/gfs2/fsck/metawalk.c @@ -49,9 +49,9 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, } old_state = lgfs2_get_bitmap(sdp, blk, rgd); if (old_state < 0) { - log_err( _("Block %llu (0x%llx) is not represented in the " + log_err(_("Block %"PRIu64" (0x%"PRIx64") is not represented in the " "system bitmap; part of an rgrp or superblock.\n"), - (unsigned long long)blk, (unsigned long long)blk); + blk, blk); return -1; } if (old_state == new_state) @@ -59,19 +59,15 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
if (error_on_dinode && old_state == GFS2_BLKST_DINODE && new_state != GFS2_BLKST_FREE) { - log_debug(_("Reference as '%s' to block %llu (0x%llx) which " - "was marked as dinode. Needs further " - "investigation.\n"), - allocdesc[sdp->gfs1][new_state], - (unsigned long long)blk, (unsigned long long)blk); + log_debug(_("Reference as '%s' to block %"PRIu64" (0x%"PRIx64") which " + "was marked as dinode. Needs further investigation.\n"), + allocdesc[sdp->gfs1][new_state], blk, blk); return 1; } /* Keep these messages as short as possible, or the output gets to be huge and unmanageable. */ - log_err( _("Block %llu (0x%llx) was '%s', should be %s.\n"), - (unsigned long long)blk, (unsigned long long)blk, - allocdesc[sdp->gfs1][old_state], - allocdesc[sdp->gfs1][new_state]); + log_err(_("Block %"PRIu64" (0x%"PRIx64") was '%s', should be %s.\n"), + blk, blk, allocdesc[sdp->gfs1][old_state], allocdesc[sdp->gfs1][new_state]); if (!query( _("Fix the bitmap? (y/n)"))) { log_err( _("The bitmap inconsistency was ignored.\n")); return 0; @@ -402,9 +398,8 @@ static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh, dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_dinode)); } else { dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_leaf)); - log_debug( _("Checking leaf %llu (0x%llx)\n"), - (unsigned long long)bh->b_blocknr, - (unsigned long long)bh->b_blocknr); + log_debug(_("Checking leaf %"PRIu64" (0x%"PRIx64")\n"), + bh->b_blocknr, bh->b_blocknr); }
prev = NULL; @@ -550,10 +545,9 @@ int check_leaf(struct gfs2_inode *ip, int lindex, struct metawalk_fxns *pass, if (error >= 0 && pass->check_leaf) { error = pass->check_leaf(ip, *leaf_no, pass->private); if (error == -EEXIST) { - log_info(_("Previous reference to leaf %lld (0x%llx) " + log_info(_("Previous reference to leaf %"PRIu64" (0x%"PRIx64") " "has already checked it; skipping.\n"), - (unsigned long long)*leaf_no, - (unsigned long long)*leaf_no); + *leaf_no, *leaf_no); brelse(lbh); return error; } @@ -802,10 +796,9 @@ int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass) error = check_leaf(ip, lindex, pass, &leaf_no, &leaf, &ref_count); if (ref_count != orig_ref_count) { - log_debug(_("Ref count of leaf 0x%llx " - "changed from %d to %d.\n"), - (unsigned long long)leaf_no, - orig_ref_count, ref_count); + log_debug(_("Ref count of leaf 0x%"PRIx64 + " changed from %d to %d.\n"), + leaf_no, orig_ref_count, ref_count); tbl_valid = 0; } if (error < 0) { @@ -816,8 +809,8 @@ int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass) break; leaf_no = leaf.lf_next; chained_leaf++; - log_debug( _("Leaf chain #%d (0x%llx) detected.\n"), - chained_leaf, (unsigned long long)leaf_no); + log_debug(_("Leaf chain #%d (0x%"PRIx64") detected.\n"), + chained_leaf, leaf_no); } while (1); /* while we have chained leaf blocks */ if (orig_di_depth != ip->i_depth) { log_debug(_("Depth of 0x%"PRIx64" changed from %d to %d\n"), @@ -981,26 +974,18 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect, err = check_leaf_eattr(ip, block, indirect, pass); if (err) { error = err; - log_err(_("Error detected in leaf block %lld (0x%llx) " - "referenced by indirect block %lld (0x%llx)" - ".\n"), - (unsigned long long)block, - (unsigned long long)block, - (unsigned long long)indirect, - (unsigned long long)indirect); + log_err(_("Error detected in leaf block %"PRIu64" (0x%"PRIx64") " + "referenced by indirect block %"PRIu64" (0x%"PRIx64").\n"), + block, block, indirect, indirect); log_err(_("Subsequent leaf block pointers should be " "cleared.\n")); } if (error) { /* leaf blocks following an error must also be treated as error blocks and cleared. */ leaf_pointer_errors++; - log_err(_("Pointer to EA leaf block %lld (0x%llx) in " - "indirect block %lld (0x%llx) should be " - "cleared.\n"), - (unsigned long long)block, - (unsigned long long)block, - (unsigned long long)indirect, - (unsigned long long)indirect); + log_err(_("Pointer to EA leaf block %"PRIu64" (0x%"PRIx64") in " + "indirect block %"PRIu64" (0x%"PRIx64") should be cleared.\n"), + block, block, indirect, indirect); } /* If the first eattr lead is bad, we can't have a hole, so we have to treat this as an unrecoverable eattr error and @@ -1593,10 +1578,8 @@ undo_metalist: bh = osi_list_entry(list->next, struct gfs2_buffer_head, b_altlist); - log_err(_("Undoing metadata work for block %llu " - "(0x%llx)\n"), - (unsigned long long)bh->b_blocknr, - (unsigned long long)bh->b_blocknr); + log_err(_("Undoing metadata work for block %"PRIu64" (0x%"PRIx64")\n"), + bh->b_blocknr, bh->b_blocknr); if (i) rc = pass->undo_check_meta(ip, bh->b_blocknr, i, pass->private); diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c index b283c752..724a8237 100644 --- a/gfs2/fsck/pass1.c +++ b/gfs2/fsck/pass1.c @@ -418,10 +418,9 @@ static int undo_reference(struct gfs2_inode *ip, uint64_t block, int meta, } while (id);
if (dt->refs) { - log_err(_("Block %llu (0x%llx) is still referenced " + log_err(_("Block %"PRIu64" (0x%"PRIx64") is still referenced " "from another inode; not freeing.\n"), - (unsigned long long)block, - (unsigned long long)block); + block, block); if (dt->refs == 1) { log_err(_("This was the only duplicate " "reference so far; removing it.\n")); @@ -532,9 +531,8 @@ static int pass1_check_data(struct gfs2_inode *ip, uint64_t metablock, if (metablock == ip->i_num.in_addr) log_err("\n"); else - log_err(_("from metadata block %llu (0x%llx)\n"), - (unsigned long long)metablock, - (unsigned long long)metablock); + log_err(_("from metadata block %"PRIu64" (0x%"PRIx64")\n"), + metablock, metablock);
switch (q) { case GFS2_BLKST_DINODE: @@ -587,15 +585,13 @@ static int pass1_check_data(struct gfs2_inode *ip, uint64_t metablock, In gfs2, "meta" is only for dinodes. So here we dummy up the blocks so that the bitmap isn't changed improperly. */ if (ip->i_sbd->gfs1 && ip == ip->i_sbd->md.riinode) { - log_info(_("Block %lld (0x%llx) is a GFS1 rindex block\n"), - (unsigned long long)block, (unsigned long long)block); + log_info(_("Block %"PRIu64" (0x%"PRIx64") is a GFS1 rindex block\n"), + block, block); gfs2_special_set(&gfs1_rindex_blks, block); fsck_blockmap_set(ip, block, "rgrp", GFS2_BLKST_DINODE); - /*gfs2_meta_rgrp);*/ } else if (ip->i_sbd->gfs1 && ip->i_flags & GFS2_DIF_JDATA) { - log_info(_("Block %lld (0x%llx) is a GFS1 journaled data " - "block\n"), - (unsigned long long)block, (unsigned long long)block); + log_info(_("Block %"PRIu64" (0x%"PRIx64") is a GFS1 journaled data block\n"), + block, block); fsck_blockmap_set(ip, block, "jdata", GFS2_BLKST_DINODE); } else return blockmap_set_as_data(ip, block); @@ -844,10 +840,8 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, int i, if (bh) brelse(bh); if (error) { - log_err(_("Bad extended attribute found at block %lld " - "(0x%llx)"), - (unsigned long long)be64_to_cpu(*data_ptr), - (unsigned long long)be64_to_cpu(*data_ptr)); + log_err(_("Bad extended attribute found at block %"PRIu64" (0x%"PRIx64")"), + be64_to_cpu(*data_ptr), be64_to_cpu(*data_ptr)); if (query( _("Repair the bad Extended Attribute? (y/n) "))) { ea_hdr->ea_num_ptrs = i; ea_hdr->ea_data_len = cpu_to_be32(tot_ealen); @@ -910,12 +904,10 @@ static int ask_remove_eattr_entry(struct gfs2_sbd *sdp, be32_to_cpu(prev->ea_rec_len); prev->ea_rec_len = cpu_to_be32(tmp32); if (curr->ea_flags & GFS2_EAFLAG_LAST) - prev->ea_flags |= GFS2_EAFLAG_LAST; + prev->ea_flags |= GFS2_EAFLAG_LAST; } - log_err( _("Bad Extended Attribute at block #%llu" - " (0x%llx) removed.\n"), - (unsigned long long)leaf_bh->b_blocknr, - (unsigned long long)leaf_bh->b_blocknr); + log_err(_("Bad Extended Attribute at block %"PRIu64" (0x%"PRIx64") removed.\n"), + leaf_bh->b_blocknr, leaf_bh->b_blocknr); bmodified(leaf_bh); return 1; } @@ -1172,10 +1164,8 @@ static int alloc_metalist(struct iptr iptr, struct gfs2_buffer_head **bh, int h, *bh = bread(ip->i_sbd, block); q = bitmap_type(ip->i_sbd, block); if (q == GFS2_BLKST_FREE) { - log_debug(_("%s reference to new metadata block " - "%lld (0x%llx) is now marked as indirect.\n"), - desc, (unsigned long long)block, - (unsigned long long)block); + log_debug(_("%s reference to new metadata block %"PRIu64" (0x%"PRIx64") is now marked as indirect.\n"), + desc, block, block); gfs2_blockmap_set(bl, block, ip->i_sbd->gfs1 ? GFS2_BLKST_DINODE : GFS2_BLKST_USED); } @@ -1194,10 +1184,8 @@ static int alloc_data(struct gfs2_inode *ip, uint64_t metablock, after the bitmap has been set but before the blockmap has. */ q = bitmap_type(ip->i_sbd, block); if (q == GFS2_BLKST_FREE) { - log_debug(_("%s reference to new data block " - "%lld (0x%llx) is now marked as data.\n"), - desc, (unsigned long long)block, - (unsigned long long)block); + log_debug(_("%s reference to new data block %"PRIu64" (0x%"PRIx64") is now marked as data.\n"), + desc, block, block); gfs2_blockmap_set(bl, block, GFS2_BLKST_USED); } return 0; @@ -1439,10 +1427,8 @@ static int handle_di(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, ip->i_num.in_formal_ino = block; bmodified(ip->i_bh); } else - log_err( _("Inode number in inode at block #%lld " - "(0x%llx) not fixed\n"), - (unsigned long long)block, - (unsigned long long)block); + log_err(_("Inode number in inode at block %"PRIu64" (0x%"PRIx64") not fixed\n"), + block, block); } check_i_goal(sdp, ip); error = handle_ip(sdp, ip); @@ -1469,15 +1455,11 @@ static int check_system_inode(struct gfs2_sbd *sdp, /* Read in the system inode, look at its dentries, and start * reading through them */ iblock = (*sysinode)->i_num.in_addr; - log_info( _("System inode for '%s' is located at block %llu" - " (0x%llx)\n"), filename, - (unsigned long long)iblock, - (unsigned long long)iblock); + log_info(_("System inode for '%s' is located at block %"PRIu64" (0x%"PRIx64")\n"), + filename, iblock, iblock); if (gfs2_check_meta((*sysinode)->i_bh->b_data, GFS2_METATYPE_DI)) { - log_err( _("Found invalid system dinode at block #" - "%llu (0x%llx)\n"), - (unsigned long long)iblock, - (unsigned long long)iblock); + log_err(_("Found invalid system dinode at block %"PRIu64" (0x%"PRIx64")\n"), + iblock, iblock); gfs2_blockmap_set(bl, iblock, GFS2_BLKST_FREE); check_n_fix_bitmap(sdp, (*sysinode)->i_rgd, iblock, 0, GFS2_BLKST_FREE); @@ -1716,10 +1698,8 @@ static int pass1_process_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, uin
/* skip gfs1 rindex indirect blocks */ if (sdp->gfs1 && blockfind(&gfs1_rindex_blks, block)) { - log_debug(_("Skipping rindex indir block " - "%lld (0x%llx)\n"), - (unsigned long long)block, - (unsigned long long)block); + log_debug(_("Skipping rindex indir block %"PRIu64" (0x%"PRIx64")\n"), + block, block); continue; } warm_fuzzy_stuff(block); @@ -1734,10 +1714,8 @@ static int pass1_process_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, uin fflush(stdout); } if (fsck_system_inode(sdp, block)) { - log_debug(_("Already processed system inode " - "%lld (0x%llx)\n"), - (unsigned long long)block, - (unsigned long long)block); + log_debug(_("Already processed system inode %"PRIu64" (0x%"PRIx64")\n"), + block, block); continue; }
@@ -1754,18 +1732,16 @@ static int pass1_process_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, uin if (q != GFS2_BLKST_FREE) { if (be32_to_cpu(check_magic) == GFS2_MAGIC && sdp->gfs1 && !is_inode) { - log_debug(_("Block 0x%llx assumed to be " + log_debug(_("Block 0x%"PRIx64" assumed to be " "previously processed GFS1 " "non-dinode metadata.\n"), - (unsigned long long)block); + block); brelse(bh); continue; } - log_err( _("Found a duplicate inode block at #%llu " - "(0x%llx) previously marked as a %s\n"), - (unsigned long long)block, - (unsigned long long)block, - block_type_string(q)); + log_err(_("Found a duplicate inode block at %"PRIu64" (0x%"PRIx64") " + "previously marked as a %s\n"), + block, block, block_type_string(q)); ip = fsck_inode_get(sdp, rgd, bh); if (is_inode && ip->i_num.in_addr == block) add_duplicate_ref(ip, block, REF_IS_INODE, 0, @@ -1798,12 +1774,9 @@ static int pass1_process_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, uin continue; } } - log_err( _("Found invalid inode at block #" - "%llu (0x%llx)\n"), - (unsigned long long)block, - (unsigned long long)block); - check_n_fix_bitmap(sdp, rgd, block, 0, - GFS2_BLKST_FREE); + log_err(_("Found invalid inode at block %"PRIu64" (0x%"PRIx64")\n"), + block, block); + check_n_fix_bitmap(sdp, rgd, block, 0, GFS2_BLKST_FREE); } else if (handle_di(sdp, rgd, bh) < 0) { stack; brelse(bh); @@ -1930,8 +1903,8 @@ static void *gfs2_bmap_destroy(struct gfs2_sbd *sdp, struct gfs2_bmap *il) static void enomem(uint64_t addl_mem_needed) { log_crit( _("This system doesn't have enough memory and swap space to fsck this file system.\n")); - log_crit( _("Additional memory needed is approximately: %lluMB\n"), - (unsigned long long)(addl_mem_needed / 1048576ULL)); + log_crit( _("Additional memory needed is approximately: %"PRIu64"MB\n"), + (uint64_t)(addl_mem_needed / 1048576ULL)); log_crit( _("Please increase your swap space by that amount and run fsck.gfs2 again.\n")); }
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c index ad997b56..16bec798 100644 --- a/gfs2/fsck/pass1b.c +++ b/gfs2/fsck/pass1b.c @@ -61,12 +61,9 @@ static void log_inode_reference(struct duptree *dt, osi_list_t *tmp, int inval) id->reftypecount[REF_AS_EA]); if (inval) log_warn( _("Invalid ")); - log_warn( _("Inode %s (%lld/0x%llx) has %d reference(s) to " - "block %llu (0x%llx) (%s)\n"), id->name, - (unsigned long long)id->block_no, - (unsigned long long)id->block_no, id->dup_count, - (unsigned long long)dt->block, - (unsigned long long)dt->block, reftypestring); + log_warn(_("Inode %s (%"PRIu64"/0x%"PRIx64") has %d reference(s) to block %"PRIu64" (0x%"PRIx64") (%s)\n"), + id->name, id->block_no, id->block_no, id->dup_count, dt->block, dt->block, + reftypestring); }
static int findref_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int h, @@ -86,9 +83,8 @@ static int findref_data(struct gfs2_inode *ip, uint64_t metablock, if (block == mbr->block) { mbr->metablock = bh->b_blocknr; mbr->off = (ptr - (__be64 *)bh->b_data); - log_debug("Duplicate data reference located on metadata " - "block 0x%llx, offset 0x%x\n", - (unsigned long long)mbr->metablock, mbr->off); + log_debug("Duplicate data reference located on metadata block 0x%"PRIx64", offset 0x%x\n", + mbr->metablock, mbr->off); } return META_IS_GOOD; } @@ -107,12 +103,8 @@ static void clone_data_block(struct gfs2_sbd *sdp, struct duptree *dt, struct gfs2_buffer_head *bh; __be64 *ptr;
- if (!(query(_("Okay to clone data block %lld (0x%llx) for inode " - "%lld (0x%llx)? (y/n) "), - (unsigned long long)dt->block, - (unsigned long long)dt->block, - (unsigned long long)id->block_no, - (unsigned long long)id->block_no))) { + if (!(query(_("Okay to clone data block %"PRIu64" (0x%"PRIx64") for inode %"PRIu64" (0x%"PRIx64")? (y/n) "), + dt->block, dt->block, id->block_no, id->block_no))) { log_warn(_("The duplicate reference was not cloned.\n")); return; } @@ -233,15 +225,12 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt, list, it's better to delete it. */ if (q == GFS2_BLKST_DINODE) { found_good_ref = 1; - log_warn( _("Inode %s (%lld/0x%llx)'s " - "reference to block %llu (0x%llx) " + log_warn(_("Inode %s (%"PRIu64"/0x%"PRIx64")'s " + "reference to block %"PRIu64" (0x%"PRIx64") " "as '%s' is acceptable.\n"), - id->name, - (unsigned long long)id->block_no, - (unsigned long long)id->block_no, - (unsigned long long)dt->block, - (unsigned long long)dt->block, - reftypes[this_ref]); + id->name, + id->block_no, id->block_no, dt->block, dt->block, + reftypes[this_ref]); continue; /* don't delete the dinode */ } } @@ -253,20 +242,16 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt, found_good_ref = 1; continue; /* don't delete the dinode */ } - log_warn( _("Inode %s (%lld/0x%llx) references block " - "%llu (0x%llx) as '%s', but the block is " + log_warn(_("Inode %s (%"PRIu64"/0x%"PRIx64") references block " + "%"PRIu64" (0x%"PRIx64") as '%s', but the block is " "really %s.\n"), - id->name, (unsigned long long)id->block_no, - (unsigned long long)id->block_no, - (unsigned long long)dt->block, - (unsigned long long)dt->block, + id->name, id->block_no, id->block_no, dt->block, dt->block, reftypes[this_ref], reftypes[acceptable_ref]); if (this_ref == REF_AS_EA) { - if (!(query( _("Okay to remove extended attributes " - "from %s inode %lld (0x%llx)? (y/n) "), + if (!(query(_("Okay to remove extended attributes " + "from %s inode %"PRIu64" (0x%"PRIx64")? (y/n) "), (inval ? _("invalidated") : ""), - (unsigned long long)id->block_no, - (unsigned long long)id->block_no))) { + id->block_no, id->block_no))) { log_warn( _("The bad EA reference was not " "cleared.")); /* delete the list entry so we don't leak @@ -284,11 +269,9 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt, dup_listent_delete(dt, id); revise_dup_handler(dt->block, dh); continue; - } else if (!(query( _("Okay to delete %s inode %lld (0x%llx)? " - "(y/n) "), + } else if (!(query(_("Okay to delete %s inode %"PRIu64" (0x%"PRIx64")? (y/n) "), (inval ? _("invalidated") : ""), - (unsigned long long)id->block_no, - (unsigned long long)id->block_no))) { + id->block_no, id->block_no))) { log_warn( _("The bad inode was not cleared.")); /* delete the list entry so we don't leak memory but leave the reference count. If we decrement the @@ -299,19 +282,14 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt, continue; } if (q == GFS2_BLKST_FREE) - log_warn( _("Inode %lld (0x%llx) was previously " - "deleted.\n"), - (unsigned long long)id->block_no, - (unsigned long long)id->block_no); + log_warn(_("Inode %"PRIu64" (0x%"PRIx64") was previously deleted.\n"), + id->block_no, id->block_no); else if (this_ref == REF_AS_EA) - log_warn(_("Pass1b is removing extended attributes " - "from inode %lld (0x%llx).\n"), - (unsigned long long)id->block_no, - (unsigned long long)id->block_no); + log_warn(_("Pass1b is removing extended attributes from inode %"PRIu64" (0x%"PRIx64").\n"), + id->block_no, id->block_no); else - log_warn(_("Pass1b is deleting inode %lld (0x%llx).\n"), - (unsigned long long)id->block_no, - (unsigned long long)id->block_no); + log_warn(_("Pass1b is deleting inode %"PRIu64" (0x%"PRIx64").\n"), + id->block_no, id->block_no);
ip = fsck_load_inode(sdp, id->block_no); /* If we've already deleted this dinode, don't try to delete @@ -444,34 +422,27 @@ static int clone_data(struct gfs2_inode *ip, uint64_t metablock, /* Now fix the reference: */ *ptr = cpu_to_be64(cloneblock); bmodified(bh); - log_err(_("Duplicate reference to block %lld " - "(0x%llx) was cloned to block %lld " - "(0x%llx).\n"), - (unsigned long long)block, - (unsigned long long)block, - (unsigned long long)cloneblock, - (unsigned long long)cloneblock); + log_err(_("Duplicate reference to block %"PRIu64 + " (0x%"PRIx64") was cloned to block %"PRIu64 + " (0x%"PRIx64").\n"), + block, block, cloneblock, cloneblock); return 0; } } log_err(_("Error: Unable to allocate a new data block.\n")); if (!query("Should I zero the reference instead? (y/n)")) { - log_err(_("Duplicate reference to block %lld " - "(0x%llx) was not fixed.\n"), - (unsigned long long)block, - (unsigned long long)block); + log_err(_("Duplicate reference to block %"PRIu64 + " (0x%"PRIx64") was not fixed.\n"), + block, block); return 0; } *ptr = 0; bmodified(bh); - log_err(_("Duplicate reference to block %lld (0x%llx) was " - "zeroed.\n"), - (unsigned long long)block, - (unsigned long long)block); + log_err(_("Duplicate reference to block %"PRIu64" (0x%"PRIx64") was zeroed.\n"), + block, block); } else { - log_err(_("Duplicate reference to block %lld (0x%llx) " - "was not fixed.\n"), (unsigned long long)block, - (unsigned long long)block); + log_err(_("Duplicate reference to block %"PRIu64" (0x%"PRIx64") was not fixed.\n"), + block, block); } return 0; } @@ -549,10 +520,8 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt, osi_list_t *tmp; int q;
- log_notice( _("Block %llu (0x%llx) has only one remaining " - "valid inode referencing it.\n"), - (unsigned long long)dt->block, - (unsigned long long)dt->block); + log_notice(_("Block %"PRIu64" (0x%"PRIx64") has only one remaining valid inode referencing it.\n"), + dt->block, dt->block); /* If we're down to a single reference (and not all references deleted, which may be the case of an inode that has only itself and a reference), we need to reset the block type @@ -560,11 +529,10 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt, in the list, not the structure's place holder. */ tmp = dt->ref_inode_list.next; id = osi_list_entry(tmp, struct inode_with_dups, list); - log_debug( _("----------------------------------------------\n" + log_debug(_("----------------------------------------------\n" "Step 4. Set block type based on the remaining " - "reference in inode %lld (0x%llx).\n"), - (unsigned long long)id->block_no, - (unsigned long long)id->block_no); + "reference in inode %"PRIu64" (0x%"PRIx64").\n"), + id->block_no, id->block_no); ip = fsck_load_inode(sdp, id->block_no);
if (dt->dup_flags & DUPFLAG_REF1_IS_DUPL) @@ -572,10 +540,9 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
q = bitmap_type(sdp, id->block_no); if (q == GFS2_BLKST_FREE) { - log_debug( _("The remaining reference inode %lld (0x%llx) was " + log_debug(_("The remaining reference inode %"PRIu64" (0x%"PRIx64") was " "already marked free.\n"), - (unsigned long long)id->block_no, - (unsigned long long)id->block_no); + id->block_no, id->block_no); } else if (id->reftypecount[REF_IS_INODE]) { set_ip_bitmap(ip); } else if (id->reftypecount[REF_AS_DATA]) { @@ -601,18 +568,14 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt, GFS2_BLKST_USED); else { log_err(_("Error: The remaining reference to block " - " %lld (0x%llx) is as extended attribute, " - "in inode %lld (0x%llx) but the block is " - "not an EA.\n"), - (unsigned long long)dt->block, - (unsigned long long)dt->block, - (unsigned long long)id->block_no, - (unsigned long long)id->block_no); + " %"PRIu64" (0x%"PRIx64") is as extended attribute, " + "in inode %"PRIu64" (0x%"PRIx64") but the block is " + "not an extended attribute block.\n"), + dt->block, dt->block, id->block_no, id->block_no); if (query(_("Okay to remove the bad extended " - "attribute from inode %lld (0x%llx)? " + "attribute from inode %"PRIu64" (0x%"PRIx64")? " "(y/n) "), - (unsigned long long)id->block_no, - (unsigned long long)id->block_no)) { + id->block_no, id->block_no)) { ip->i_eattr = 0; ip->i_flags &= ~GFS2_DIF_EA_INDIRECT; ip->i_blocks--; @@ -629,8 +592,7 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt, } } fsck_inode_put(&ip); /* out, brelse, free */ - log_debug(_("Done with duplicate reference to block 0x%llx\n"), - (unsigned long long)dt->block); + log_debug(_("Done with duplicate reference to block 0x%"PRIx64"\n"), dt->block); dup_delete(dt); }
@@ -652,11 +614,9 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt) revise_dup_handler(dup_blk, &dh);
/* Log the duplicate references */ - log_notice( _("Block %llu (0x%llx) has %d inodes referencing it" + log_notice(_("Block %"PRIu64" (0x%"PRIx64") has %d inodes referencing it" " for a total of %d duplicate references:\n"), - (unsigned long long)dt->block, - (unsigned long long)dt->block, - dh.ref_inode_count, dh.ref_count); + dt->block, dt->block, dh.ref_inode_count, dh.ref_count);
osi_list_foreach(tmp, &dt->ref_invinode_list) log_inode_reference(dt, tmp, 1); @@ -709,12 +669,11 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt) * All block types are unacceptable, so we use REF_TYPES. */ if (dh.ref_count > 1) { - log_debug( _("----------------------------------------------\n" - "Step 1: Eliminate references to block %llu " - "(0x%llx) that were previously marked " + log_debug(_("----------------------------------------------\n" + "Step 1: Eliminate references to block %"PRIu64" " + "(0x%"PRIx64") that were previously marked " "invalid.\n"), - (unsigned long long)dt->block, - (unsigned long long)dt->block); + dt->block, dt->block); resolve_dup_references(sdp, dt, &dt->ref_invinode_list, &dh, 1, REF_TYPES); revise_dup_handler(dup_blk, &dh); @@ -725,11 +684,10 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt) * directory inode referencing a data block as a leaf block. */ if (dh.ref_count > 1) { - log_debug( _("----------------------------------------------\n" - "Step 2: Eliminate references to block %llu " - "(0x%llx) that need the wrong block type.\n"), - (unsigned long long)dt->block, - (unsigned long long)dt->block); + log_debug(_("----------------------------------------------\n" + "Step 2: Eliminate references to block %"PRIu64" " + "(0x%"PRIx64") that need the wrong block type.\n"), + dt->block, dt->block); resolve_dup_references(sdp, dt, &dt->ref_inode_list, &dh, 0, acceptable_ref); revise_dup_handler(dup_blk, &dh); @@ -739,11 +697,10 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt) * All block types are fair game, so we use REF_TYPES. */ if (dh.ref_count > 1) { - log_debug( _("----------------------------------------------\n" - "Step 3: Choose one reference to block %llu " - "(0x%llx) to keep.\n"), - (unsigned long long)dt->block, - (unsigned long long)dt->block); + log_debug(_("----------------------------------------------\n" + "Step 3: Choose one reference to block %"PRIu64" " + "(0x%"PRIx64") to keep.\n"), + dt->block, dt->block); resolve_dup_references(sdp, dt, &dt->ref_inode_list, &dh, 0, REF_TYPES); revise_dup_handler(dup_blk, &dh); @@ -755,17 +712,15 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt) resolve_last_reference(sdp, dt, acceptable_ref); } else { /* They may have answered no and not fixed all references. */ - log_debug( _("All duplicate references to block 0x%llx were " - "processed.\n"), (unsigned long long)dup_blk); + log_debug( _("All duplicate references to block 0x%"PRIx64" were processed.\n"), dup_blk); if (dh.ref_count) { log_debug(_("Done with duplicate reference to block " - "0x%llx, but %d references remain.\n"), - (unsigned long long)dup_blk, dh.ref_count); + "0x%"PRIx64", but %d references remain.\n"), + dup_blk, dh.ref_count); } else { - log_notice( _("Block %llu (0x%llx) has no more " + log_notice(_("Block %"PRIu64" (0x%"PRIx64") has no more " "references; Marking as 'free'.\n"), - (unsigned long long)dup_blk, - (unsigned long long)dup_blk); + dup_blk, dup_blk); if (dh.dt) dup_delete(dh.dt); check_n_fix_bitmap(sdp, NULL, dup_blk, 0, @@ -877,9 +832,8 @@ static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode) if (ip->i_magic != GFS2_MAGIC || ip->i_mh_type != GFS2_METATYPE_DI) { if (!sdp->gfs1) - log_debug( _("Block %lld (0x%llx) is not a dinode.\n"), - (unsigned long long)inode, - (unsigned long long)inode); + log_debug(_("Block %"PRIu64" (0x%"PRIx64") is not a dinode.\n"), + inode, inode); error = 1; goto out; } @@ -922,9 +876,8 @@ int pass1b(struct gfs2_sbd *sdp) /* Rescan the fs looking for pointers to blocks that are in * the duplicate block map */ log_info( _("Scanning filesystem for inodes containing duplicate blocks...\n")); - log_debug( _("Filesystem has %llu (0x%llx) blocks total\n"), - (unsigned long long)last_fs_block, - (unsigned long long)last_fs_block); + log_debug(_("Filesystem has %"PRIu64" (0x%"PRIx64") blocks total\n"), + last_fs_block, last_fs_block); for (i = 0; i < last_fs_block; i++) { if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ goto out; @@ -940,10 +893,8 @@ int pass1b(struct gfs2_sbd *sdp) continue;
if (q == GFS2_BLKST_UNLINKED) { - log_debug( _("Error: block %lld (0x%llx) is still " - "marked UNLINKED.\n"), - (unsigned long long)i, - (unsigned long long)i); + log_debug(_("Error: block %"PRIu64" (0x%"PRIx64") is still marked UNLINKED.\n"), + i, i); return FSCK_ERROR; }
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c index 67833491..8075773c 100644 --- a/gfs2/fsck/pass2.c +++ b/gfs2/fsck/pass2.c @@ -320,11 +320,8 @@ static int wrong_leaf(struct gfs2_inode *ip, struct lgfs2_inum *entry, return -1; } planned_leaf = be64_to_cpu(tbl[hash_index]); - log_err(_("Moving it from leaf %llu (0x%llx) to %llu (0x%llx)\n"), - (unsigned long long)be64_to_cpu(tbl[*lindex]), - (unsigned long long)be64_to_cpu(tbl[*lindex]), - (unsigned long long)planned_leaf, - (unsigned long long)planned_leaf); + log_err(_("Moving it from leaf %"PRIu64" (0x%"PRIx64") to %"PRIu64" (0x%"PRIx64")\n"), + be64_to_cpu(tbl[*lindex]), be64_to_cpu(tbl[*lindex]), planned_leaf, planned_leaf); /* Can't trust lf_depth; we have to count */ dest_ref = 0; for (li = 0; li < (1 << ip->i_depth); li++) { @@ -968,10 +965,10 @@ static int write_new_leaf(struct gfs2_inode *dip, int start_lindex, } fsck_bitmap_set(dip, *bn, _("directory leaf"), dip->i_sbd->gfs1 ? GFS2_BLKST_DINODE : GFS2_BLKST_USED); - log_err(_("A new directory leaf was allocated at block %lld " - "(0x%llx) to fill the %d (0x%x) pointer gap %s the existing " - "pointer at index %d (0x%x).\n"), (unsigned long long)*bn, - (unsigned long long)*bn, num_copies, num_copies, + log_err(_("A new directory leaf was allocated at block %"PRIu64" " + "(0x%"PRIx64") to fill the %d (0x%x) pointer gap %s the existing " + "pointer at index %d (0x%x).\n"), *bn, *bn, + num_copies, num_copies, before_or_after, start_lindex, start_lindex); dip->i_blocks++; bmodified(dip->i_bh); @@ -1049,11 +1046,9 @@ static void pad_with_leafblks(struct gfs2_inode *ip, __be64 *tbl, new_len <<= 1; } write_new_leaf(ip, lindex, new_len, "after", &new_leaf_blk); - log_err(_("New leaf block was allocated at %llu (0x%llx) for " + log_err(_("New leaf block was allocated at %"PRIu64" (0x%"PRIx64") for " "index %d (0x%x), length %d\n"), - (unsigned long long)new_leaf_blk, - (unsigned long long)new_leaf_blk, - lindex, lindex, new_len); + new_leaf_blk, new_leaf_blk, lindex, lindex, new_len); fsck_bitmap_set(ip, new_leaf_blk, _("pad leaf"), ip->i_sbd->gfs1 ? GFS2_BLKST_DINODE : GFS2_BLKST_USED); @@ -1084,9 +1079,9 @@ static int lost_leaf(struct gfs2_inode *ip, __be64 *tbl, uint64_t leafno, int error; int isdir = 0;
- log_err(_("Leaf block %llu (0x%llx) seems to be out of place and its " + log_err(_("Leaf block %"PRIu64" (0x%"PRIx64") seems to be out of place and its " "contents need to be moved to lost+found.\n"), - (unsigned long long)leafno, (unsigned long long)leafno); + leafno, leafno); if (!query( _("Attempt to fix it? (y/n) "))) { log_err( _("Directory leaf was not fixed.\n")); return 0; @@ -1341,10 +1336,9 @@ static int fix_hashtable(struct gfs2_inode *ip, __be64 *tbl, unsigned hsize, (dentry.dr_inum.in_formal_ino == 0)) { brelse(lbh); gfs2_free_block(ip->i_sbd, leafblk); - log_err(_("Out of place leaf block %llu (0x%llx) had no " + log_err(_("Out of place leaf block %"PRIu64" (0x%"PRIx64") had no " "entries, so it was deleted.\n"), - (unsigned long long)leafblk, - (unsigned long long)leafblk); + leafblk, leafblk); pad_with_leafblks(ip, tbl, lindex, len); log_err(_("Reprocessing index 0x%x (case 1).\n"), lindex); return 1; @@ -1410,19 +1404,17 @@ static int fix_hashtable(struct gfs2_inode *ip, __be64 *tbl, unsigned hsize, /* re-read the leaf to pick up dir_split_leaf's changes */ lgfs2_leaf_in(&leaf, lbh->b_data); *proper_len = 1 << (ip->i_depth - leaf.lf_depth); - log_err(_("Leaf block %llu (0x%llx) was split from length " - "%d to %d\n"), (unsigned long long)leafblk, - (unsigned long long)leafblk, len, *proper_len); + log_err(_("Leaf block %"PRIu64" (0x%"PRIx64") was split from length %d to %d\n"), + leafblk, leafblk, len, *proper_len); if (*proper_len < 0) { log_err(_("Programming error: proper_len=%d, " "di_depth = %d, lf_depth = %d.\n"), *proper_len, ip->i_depth, leaf.lf_depth); exit(FSCK_ERROR); } - log_err(_("New split-off leaf block was allocated at %lld " - "(0x%llx) for index %d (0x%x)\n"), - (unsigned long long)new_leaf_blk, - (unsigned long long)new_leaf_blk, lindex, lindex); + log_err(_("New split-off leaf block was allocated at %"PRIu64" " + "(0x%"PRIx64") for index %d (0x%x)\n"), + new_leaf_blk, new_leaf_blk, lindex, lindex); fsck_bitmap_set(ip, new_leaf_blk, _("split leaf"), ip->i_sbd->gfs1 ? GFS2_BLKST_DINODE : GFS2_BLKST_USED); @@ -1440,9 +1432,9 @@ static int fix_hashtable(struct gfs2_inode *ip, __be64 *tbl, unsigned hsize, len -= (*proper_len); } if (*proper_len < len) { - log_err(_("There are %d pointers, but leaf 0x%llx's " + log_err(_("There are %d pointers, but leaf 0x%"PRIx64"'s " "depth, %d, only allows %d\n"), - len, (unsigned long long)leafblk, leaf.lf_depth, + len, leafblk, leaf.lf_depth, *proper_len); } brelse(lbh); @@ -1459,9 +1451,8 @@ static int fix_hashtable(struct gfs2_inode *ip, __be64 *tbl, unsigned hsize, break; } if (extras) { - log_err(_("Found %d extra pointers to leaf %llu (0x%llx)\n"), - extras, (unsigned long long)leafblk, - (unsigned long long)leafblk); + log_err(_("Found %d extra pointers to leaf %"PRIu64" (0x%"PRIx64")\n"), + extras, leafblk, leafblk); pad_with_leafblks(ip, tbl, lindex, extras); log_err(_("Reprocessing index 0x%x (case 2).\n"), lindex); return 1; @@ -1537,9 +1528,8 @@ static int check_hash_tbl_dups(struct gfs2_inode *ip, __be64 *tbl, bmodified(ip->i_bh); pad_with_leafblks(ip, tbl, l, len2); } else { - log_debug(_("Hash index 0x%x is the proper " - "reference to leaf 0x%llx.\n"), - l, (unsigned long long)leafblk); + log_debug(_("Hash index 0x%x is the proper reference to leaf 0x%"PRIx64".\n"), + l, leafblk); } /* Check the original ref: both references might be bad. If both were bad, just return and if we encounter it @@ -1560,9 +1550,8 @@ static int check_hash_tbl_dups(struct gfs2_inode *ip, __be64 *tbl, return to start fresh */ return -EFAULT; } else { - log_debug(_("Hash index 0x%x is the proper " - "reference to leaf 0x%llx.\n"), - lindex, (unsigned long long)leafblk); + log_debug(_("Hash index 0x%x is the proper reference to leaf 0x%"PRIx64".\n"), + lindex, leafblk); } } return 0; @@ -1667,12 +1656,9 @@ static int check_hash_tbl(struct gfs2_inode *ip, __be64 *tbl, is the calculation used by the kernel, and dir_split_leaf */ proper_start = (lindex & ~(proper_len - 1)); if (lindex != proper_start) { - log_debug(_("lindex 0x%llx is not a proper starting " - "point for leaf %llu (0x%llx): 0x%llx\n"), - (unsigned long long)lindex, - (unsigned long long)leafblk, - (unsigned long long)leafblk, - (unsigned long long)proper_start); + log_debug(_("lindex 0x%x is not a proper starting " + "point for leaf %"PRIu64" (0x%"PRIx64"): 0x%"PRIx32"\n"), + lindex, leafblk, leafblk, proper_start); changes = fix_hashtable(ip, tbl, hsize, leafblk, lindex, proper_start, len, &proper_len, factor); @@ -1694,11 +1680,9 @@ static int check_hash_tbl(struct gfs2_inode *ip, __be64 *tbl, depth, and adjust the hash table accordingly. */ if (len != proper_len) { log_err(_("Length %d (0x%x) is not a proper length " - "for leaf %llu (0x%llx). Valid boundary " + "for leaf %"PRIu64" (0x%"PRIx64"). Valid boundary " "assumed to be %d (0x%x).\n"), len, len, - (unsigned long long)leafblk, - (unsigned long long)leafblk, - proper_len, proper_len); + leafblk, leafblk, proper_len, proper_len); lbh = bread(ip->i_sbd, leafblk); lgfs2_leaf_in(&leaf, lbh->b_data); if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF) || @@ -1746,9 +1730,8 @@ static int check_hash_tbl(struct gfs2_inode *ip, __be64 *tbl, proper_len = 1 << (ip->i_depth - leaf.lf_depth); if (proper_len != len) { log_debug(_("Length 0x%x is not proper for " - "leaf %llu (0x%llx): 0x%x\n"), - len, (unsigned long long)leafblk, - (unsigned long long)leafblk, + "leaf %"PRIu64" (0x%"PRIx64"): 0x%x\n"), + len, leafblk, leafblk, proper_len); changes = fix_hashtable(ip, tbl, hsize, leafblk, lindex, @@ -1804,9 +1787,9 @@ static int check_data_qc(struct gfs2_inode *ip, uint64_t metablock,
bh = bread(ip->i_sbd, block); if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_QC) != 0) { - log_crit(_("Error: quota_change block at %lld (0x%llx) is " + log_crit(_("Error: quota_change block at %"PRIu64" (0x%"PRIx64") is " "the wrong metadata type.\n"), - (unsigned long long)block, (unsigned long long)block); + block, block); brelse(bh); return -1; } @@ -1830,7 +1813,7 @@ static struct metawalk_fxns quota_change_fxns = { * * Returns: 0 if all went well, else error. */ static int check_pernode_for(int x, struct gfs2_inode *pernode, const char *fn, - unsigned long long filelen, int multiple, + size_t filelen, int multiple, struct metawalk_fxns *pass, int builder(struct gfs2_inode *per_node, unsigned int j)) @@ -1853,8 +1836,8 @@ static int check_pernode_for(int x, struct gfs2_inode *pernode, const char *fn, else if (multiple && (ip->i_size % filelen)) valid_size = 0; if (!valid_size) { - log_err(_("System file %s has an invalid size. Is %"PRIu64", " - "should be %llu.\n"), fn, ip->i_size, filelen); + log_err(_("System file %s has an invalid size. Is %"PRIu64", should be %zu.\n"), + fn, ip->i_size, filelen); if (!query( _("Rebuild the system file? (y/n) "))) goto out_good; fsck_inode_put(&ip); @@ -2026,37 +2009,29 @@ static int pass2_check_dir(struct gfs2_sbd *sdp, struct gfs2_inode *ip) stack; return FSCK_ERROR; } - if (query(_("Remove directory entry for bad inode " - "%llu (0x%llx) in %llu (0x%llx)? (y/n)"), - (unsigned long long)dirblk, - (unsigned long long)dirblk, - (unsigned long long)di->treewalk_parent, - (unsigned long long)di->treewalk_parent)) { + if (query(_("Remove directory entry for bad inode %"PRIu64" (0x%"PRIx64") in %"PRIu64" (0x%"PRIx64")? (y/n)"), + dirblk, dirblk, di->treewalk_parent, di->treewalk_parent)) { error = remove_dentry_from_dir(sdp, di->treewalk_parent, dirblk); if (error < 0) { stack; return FSCK_ERROR; } if (error > 0) { - log_warn(_("Unable to find dentry for %llu (0x%llx) " - "in %llu (0x%llx)\n"), - (unsigned long long)dirblk, - (unsigned long long)dirblk, - (unsigned long long)di->treewalk_parent, - (unsigned long long)di->treewalk_parent); + log_warn(_("Unable to find dentry for %"PRIu64" (0x%"PRIx64") in %"PRIu64" (0x%"PRIx64")\n"), + dirblk, dirblk, di->treewalk_parent, di->treewalk_parent); } log_warn(_("Directory entry removed\n")); } else log_err(_("Directory entry to invalid inode remains.\n"));
- log_debug(_("Directory block %lld (0x%llx) is now marked as 'invalid'\n"), - (unsigned long long)dirblk, (unsigned long long)dirblk); + log_debug(_("Directory block %"PRIu64" (0x%"PRIx64") is now marked as 'invalid'\n"), + dirblk, dirblk); check_n_fix_bitmap(sdp, ip->i_rgd, dirblk, 0, GFS2_BLKST_FREE); }
if (!ds.dotdir) { - log_err(_("No '.' entry found for directory inode at block %llu (0x%llx)\n"), - (unsigned long long)dirblk, (unsigned long long)dirblk); + log_err(_("No '.' entry found for directory inode at block %"PRIu64" (0x%"PRIx64")\n"), + dirblk, dirblk);
if (query( _("Is it okay to add '.' entry? (y/n) "))) { struct lgfs2_inum no = ip->i_num; @@ -2158,8 +2133,8 @@ int pass2(struct gfs2_sbd *sdp) continue; }
- log_debug(_("Checking directory inode at block %llu (0x%llx)\n"), - (unsigned long long)dirblk, (unsigned long long)dirblk); + log_debug(_("Checking directory inode at block %"PRIu64" (0x%"PRIx64")\n"), + dirblk, dirblk);
ip = fsck_load_inode(sdp, dirblk); if (ip == NULL) { diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c index fa2fd388..fce3c7f9 100644 --- a/gfs2/fsck/pass3.c +++ b/gfs2/fsck/pass3.c @@ -99,10 +99,8 @@ static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sdp, "lost+found\n")); return NULL; } else { - log_warn( _("Treewalk parent is correct, fixing " - "dotdot -> %llu (0x%llx)\n"), - (unsigned long long)di->treewalk_parent, - (unsigned long long)di->treewalk_parent); + log_warn(_("Treewalk parent is correct, fixing dotdot -> %"PRIu64" (0x%"PRIx64")\n"), + di->treewalk_parent, di->treewalk_parent); attach_dotdot_to(sdp, di->treewalk_parent, di->dotdot_parent.in_addr, di->dinode.in_addr); diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c index 6da95726..78faf71d 100644 --- a/gfs2/fsck/pass4.c +++ b/gfs2/fsck/pass4.c @@ -55,15 +55,13 @@ static int handle_unlinked(struct gfs2_sbd *sdp, uint64_t no_addr, struct gfs2_inode *ip; int q;
- log_err( _("Found unlinked inode at %llu (0x%llx)\n"), - (unsigned long long)no_addr, (unsigned long long)no_addr); + log_err(_("Found unlinked inode at %"PRIu64" (0x%"PRIx64")\n"), + no_addr, no_addr); q = bitmap_type(sdp, no_addr); if (q == GFS2_BLKST_FREE) { - log_err( _("Unlinked inode %llu (0x%llx) contains bad " - "blocks\n"), (unsigned long long)no_addr, - (unsigned long long)no_addr); - if (query(_("Delete unlinked inode with bad blocks? " - "(y/n) "))) { + log_err(_("Unlinked inode %"PRIu64" (0x%"PRIx64") contains bad blocks\n"), + no_addr, no_addr); + if (query(_("Delete unlinked inode with bad blocks? (y/n) "))) { ip = fsck_load_inode(sdp, no_addr); check_inode_eattr(ip, &pass4_fxns_delete); check_metatree(ip, &pass4_fxns_delete); @@ -72,15 +70,12 @@ static int handle_unlinked(struct gfs2_sbd *sdp, uint64_t no_addr, fsck_inode_put(&ip); return 1; } else { - log_err( _("Unlinked inode with bad blocks not " - "cleared\n")); + log_err(_("Unlinked inode with bad blocks not cleared\n")); } } if (q != GFS2_BLKST_DINODE) { - log_err( _("Unlinked block %lld (0x%llx) marked as inode is " - "not an inode (%d)\n"), - (unsigned long long)no_addr, - (unsigned long long)no_addr, q); + log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") marked as inode is not an inode (%d)\n"), + no_addr, no_addr, q); ip = fsck_load_inode(sdp, no_addr); if (query(_("Delete unlinked inode? (y/n) "))) { check_inode_eattr(ip, &pass4_fxns_delete); @@ -126,28 +121,22 @@ static int handle_unlinked(struct gfs2_sbd *sdp, uint64_t no_addr, static void handle_inconsist(struct gfs2_sbd *sdp, uint64_t no_addr, uint32_t *di_nlink, uint32_t counted_links) { - log_err( _("Link count inconsistent for inode %llu" - " (0x%llx) has %u but fsck found %u.\n"), - (unsigned long long)no_addr, (unsigned long long)no_addr, - *di_nlink, counted_links); + log_err(_("Link count inconsistent for inode %"PRIu64" (0x%"PRIx64") has %u but fsck found %u.\n"), + no_addr, no_addr, *di_nlink, counted_links); /* Read in the inode, adjust the link count, and write it back out */ - if (query( _("Update link count for inode %llu (0x%llx) ? (y/n) "), - (unsigned long long)no_addr, (unsigned long long)no_addr)) { + if (query(_("Update link count for inode %"PRIu64" (0x%"PRIx64")? (y/n) "), + no_addr, no_addr)) { struct gfs2_inode *ip;
ip = fsck_load_inode(sdp, no_addr); /* bread, inode_get */ fix_link_count(counted_links, ip); *di_nlink = counted_links; fsck_inode_put(&ip); /* out, brelse, free */ - log_warn(_("Link count updated to %d for inode %llu " - "(0x%llx)\n"), *di_nlink, - (unsigned long long)no_addr, - (unsigned long long)no_addr); + log_warn(_("Link count updated to %d for inode %"PRIu64" (0x%"PRIx64")\n"), + *di_nlink, no_addr, no_addr); } else { - log_err( _("Link count for inode %llu (0x%llx) still " - "incorrect\n"), - (unsigned long long)no_addr, - (unsigned long long)no_addr); + log_err(_("Link count for inode %"PRIu64" (0x%"PRIx64") still incorrect\n"), + no_addr, no_addr); } }
@@ -199,9 +188,8 @@ static int scan_inode_list(struct gfs2_sbd *sdp) handle_inconsist(sdp, ii->num.in_addr, &ii->di_nlink, ii->counted_links); } - log_debug( _("block %llu (0x%llx) has link count %d\n"), - (unsigned long long)ii->num.in_addr, - (unsigned long long)ii->num.in_addr, ii->di_nlink); + log_debug(_("block %"PRIu64" (0x%"PRIx64") has link count %d\n"), + ii->num.in_addr, ii->num.in_addr, ii->di_nlink); } /* osi_list_foreach(tmp, list) */
return adjust_lf_links(lf_addition); diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c index cb60415b..6dd3276b 100644 --- a/gfs2/fsck/pass5.c +++ b/gfs2/fsck/pass5.c @@ -64,56 +64,43 @@ static int check_block_status(struct gfs2_sbd *sdp, struct gfs2_bmap *bl, and should be cleaned up by the file system eventually. So we ignore it. */ if (q == GFS2_BLKST_UNLINKED) { - log_err( _("Unlinked inode found at block %llu " - "(0x%llx).\n"), - (unsigned long long)block, - (unsigned long long)block); + log_err(_("Unlinked inode found at block %"PRIu64" (0x%"PRIx64").\n"), + block, block); if (query(_("Do you want to reclaim the block? " "(y/n) "))) { lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block); if (gfs2_set_bitmap(rg, block, GFS2_BLKST_FREE)) - log_err(_("Unlinked block %llu " - "(0x%llx) bitmap not fixed." - "\n"), - (unsigned long long)block, - (unsigned long long)block); + log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") bitmap not fixed.\n"), + block, block); else { - log_err(_("Unlinked block %llu " - "(0x%llx) bitmap fixed.\n"), - (unsigned long long)block, - (unsigned long long)block); + log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") bitmap fixed.\n"), + block, block); count[GFS2_BLKST_UNLINKED]--; count[GFS2_BLKST_FREE]++; } } else { - log_info( _("Unlinked block found at block %llu" - " (0x%llx), left unchanged.\n"), - (unsigned long long)block, - (unsigned long long)block); + log_info(_("Unlinked block found at block %"PRIu64" (0x%"PRIx64"), left unchanged.\n"), + block, block); } } else if (rg_status != q) { - log_err( _("Block %llu (0x%llx) bitmap says %u (%s) " - "but FSCK saw %u (%s)\n"), - (unsigned long long)block, - (unsigned long long)block, rg_status, + log_err(_("Block %"PRIu64" (0x%"PRIx64") bitmap says %u (%s) but FSCK saw %u (%s)\n"), + block, block, rg_status, block_type_string(rg_status), q, block_type_string(q)); if (q) /* Don't print redundant "free" */ log_err( _("Metadata type is %u (%s)\n"), q, block_type_string(q));
- if (query(_("Fix bitmap for block %llu (0x%llx) ? (y/n) "), - (unsigned long long)block, - (unsigned long long)block)) { + if (query(_("Fix bitmap for block %"PRIu64" (0x%"PRIx64")? (y/n) "), + block, block)) { lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block); if (gfs2_set_bitmap(rg, block, q)) log_err( _("Repair failed.\n")); else log_err( _("Fixed.\n")); } else - log_err( _("Bitmap at block %llu (0x%llx) left inconsistent\n"), - (unsigned long long)block, - (unsigned long long)block); + log_err(_("Bitmap at block %"PRIu64" (0x%"PRIx64") left inconsistent\n"), + block, block); } (*rg_block)++; bit += GFS2_BIT_SIZE; @@ -219,7 +206,7 @@ int pass5(struct gfs2_sbd *sdp, struct gfs2_bmap *bl) next = osi_next(n); if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ return FSCK_OK; - log_info( _("Verifying Resource Group #%llu\n"), (unsigned long long)rg_count); + log_info(_("Verifying resource group %"PRIu64"\n"), rg_count); memset(count, 0, sizeof(count)); rgp = (struct rgrp_tree *)n;
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c index 3163f17f..55e99143 100644 --- a/gfs2/fsck/rgrepair.c +++ b/gfs2/fsck/rgrepair.c @@ -131,11 +131,10 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array, if (rgs_sampled >= 6) { uint64_t nblk;
- log_info(_("rgrp not found at block 0x%llx. " - "Last found rgrp was 0x%llx. " + log_info(_("rgrp not found at block 0x%"PRIx64". " + "Last found rgrp was 0x%"PRIx64". " "Checking the next one.\n"), - (unsigned long long)blk, - (unsigned long long)block_last_rg); + blk, block_last_rg); /* check for just a damaged rgrp */ nblk = blk + dist_array[gsegment]; if (is_false_rg(nblk)) { @@ -180,15 +179,13 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array, array minus 1. */ continue; } - log_info(_("segment %d: rgrp found at block 0x%llx\n"), - gsegment + 1, (unsigned long long)blk); + log_info(_("segment %d: rgrp found at block 0x%"PRIx64"\n"), + gsegment + 1, blk); dist = blk - block_last_rg; if (blk > LGFS2_SB_ADDR(sdp) + 1) { /* not the very first rgrp */
- log_info("dist 0x%llx = 0x%llx - 0x%llx ", - (unsigned long long)dist, - (unsigned long long)blk, - (unsigned long long)block_last_rg); + log_info("dist 0x%"PRIx64" = 0x%"PRIx64" - 0x%"PRIx64" ", + dist, blk, block_last_rg); /** * We found an RG. Check to see if we need to set the * first_rg_dist based on whether it is still at its @@ -208,10 +205,8 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array, log_info("\n"); if (++rgs_sampled == 6) { dist_array[gsegment] = shortest_dist_btwn_rgs; - log_info(_("Settled on distance 0x%llx for " - "segment %d\n"), - (unsigned long long) - dist_array[gsegment], gsegment + 1); + log_info(_("Settled on distance 0x%"PRIx64" for segment %d\n"), + dist_array[gsegment], gsegment + 1); } } else { gsegment++; @@ -244,15 +239,14 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array, if (be64_to_cpu(ri.ri_addr) > LGFS2_SB_ADDR(sdp) + 1) { /* sanity check */ log_warn( _("rgrp 2 is damaged: getting dist from index: ")); *dist_array = be64_to_cpu(ri.ri_addr) - (LGFS2_SB_ADDR(sdp) + 1); - log_warn("0x%llx\n", (unsigned long long)*dist_array); + log_warn("0x%"PRIx64"\n", *dist_array); } else { log_warn( _("rgrp index 2 is damaged: extrapolating dist: ")); *dist_array = sdp->device.length - (sdp->rgrps - 1) * (sdp->device.length / sdp->rgrps); - log_warn("0x%llx\n", (unsigned long long)*dist_array); + log_warn("0x%"PRIx64"\n", *dist_array); } - log_debug( _("Adjusted first rgrp distance: 0x%llx\n"), - (unsigned long long)*dist_array); + log_debug(_("Adjusted first rgrp distance: 0x%"PRIx64"\n"), *dist_array); } /* if first RG distance is within tolerance */
gfs2_special_free(&false_rgrps); @@ -442,9 +436,8 @@ static uint64_t hunt_and_peck(struct gfs2_sbd *sdp, uint64_t blk, mh = (struct gfs2_meta_header *)bh->b_data; if (be32_to_cpu(mh->mh_magic) == GFS2_MAGIC && be32_to_cpu(mh->mh_type) == GFS2_METATYPE_RG) { - log_info( _("rgrp found at 0x%llx, length=%lld\n"), - (unsigned long long)blk + last_bump, - (unsigned long long)last_bump); + log_info(_("rgrp found at 0x%"PRIx64", length=%"PRIu64"\n"), + blk + last_bump, last_bump); brelse(bh); return last_bump; } @@ -548,8 +541,8 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow) rgcalc.osi_node = NULL; grow_segments = find_shortest_rgdist(sdp, &rg_dist[0], &rg_dcnt[0]); for (i = 0; i < grow_segments; i++) - log_info(_("Segment %d: rgrp distance: 0x%llx, count: %d\n"), - i + 1, (unsigned long long)rg_dist[i], rg_dcnt[i]); + log_info(_("Segment %d: rgrp distance: 0x%"PRIx64", count: %d\n"), + i + 1, rg_dist[i], rg_dcnt[i]); number_of_rgs = segment_rgs = 0; /* -------------------------------------------------------------- */ /* Now go through the RGs and verify their integrity, fixing as */ @@ -559,7 +552,7 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow) block_bump = rg_dist[0]; blk = LGFS2_SB_ADDR(sdp) + 1; while (blk <= sdp->device.length) { - log_debug( _("Block 0x%llx\n"), (unsigned long long)blk); + log_debug( _("Block 0x%"PRIx64"\n"), blk); bh = bread(sdp, blk); rg_was_fnd = (!gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG)); brelse(bh); @@ -576,10 +569,8 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow) /* ------------------------------------------------- */ corrupt_rgs++; if (corrupt_rgs < 5) - log_debug(_("Missing or damaged rgrp at block " - "%llu (0x%llx)\n"), - (unsigned long long)blk, - (unsigned long long)blk); + log_debug(_("Missing or damaged rgrp at block %"PRIu64" (0x%"PRIx64")\n"), + blk, blk); else { log_crit( _("Error: too many missing or " "damaged rgrps using this method. " @@ -619,11 +610,11 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow) number_of_rgs++; segment_rgs++; if (rg_was_fnd) - log_info( _(" rgrp %d at block 0x%llx intact\n"), - number_of_rgs, (unsigned long long)blk); + log_info( _(" rgrp %d at block 0x%"PRIx64" intact\n"), + number_of_rgs, blk); else - log_warn( _("* rgrp %d at block 0x%llx *** DAMAGED ***\n"), - number_of_rgs, (unsigned long long)blk); + log_warn( _("* rgrp %d at block 0x%"PRIx64" *** DAMAGED ***\n"), + number_of_rgs, blk); prev_rgd = calc_rgd; /* * Figure out where our next rgrp should be. @@ -651,11 +642,9 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow) block_bump); if (block_bump != 1) { if (rg_was_fnd) - log_info( _(" [length 0x%llx]\n"), - (unsigned long long)block_bump); + log_info(_(" [length 0x%"PRIx64"]\n"), block_bump); else - log_warn( _(" [length 0x%llx]\n"), - (unsigned long long)block_bump); + log_warn(_(" [length 0x%"PRIx64"]\n"), block_bump); } else { log_warn("\n"); } @@ -836,9 +825,8 @@ static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, int *num_rgs) sdp->rgsize /= 2) { num_rgrps = how_many_rgrps(sdp, &sdp->device); if (num_rgrps == *num_rgs) { - log_info(_("rgsize must be: %lld (0x%llx)\n"), - (unsigned long long)sdp->rgsize, - (unsigned long long)sdp->rgsize); + log_info(_("rgsize must be: %u (0x%x)\n"), + sdp->rgsize, sdp->rgsize); break; } } @@ -848,8 +836,7 @@ static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, int *num_rgs) fprintf(stderr, _("Failed to build resource groups\n")); exit(-1); } - log_debug( _("fs_total_size = 0x%llx blocks.\n"), - (unsigned long long)sdp->device.length); + log_debug(_("fs_total_size = 0x%"PRIx64" blocks.\n"), sdp->device.length); log_warn( _("L3: number of rgs in the index = %d.\n"), *num_rgs); return 0; } @@ -1026,8 +1013,8 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok) bmodified(sdp->md.riinode->i_bh); log_err(_("Changing rindex size to %"PRIu64".\n"), sdp->md.riinode->i_size); } - log_warn( _("L%d: number of rgs expected = %lld.\n"), trust_lvl + 1, - (unsigned long long)sdp->rgrps); + log_warn(_("L%d: number of rgs expected = %"PRIu64".\n"), trust_lvl + 1, + sdp->rgrps); if (calc_rg_count != sdp->rgrps) { int most_that_fit;
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c index 7ea2dfb8..382acb52 100644 --- a/gfs2/fsck/util.c +++ b/gfs2/fsck/util.c @@ -78,8 +78,7 @@ void warm_fuzzy_stuff(uint64_t block) seconds = tv.tv_sec; if (last_fs_block) { percent = (block * 100) / last_fs_block; - log_notice( _("\r%llu percent complete.\r"), - (unsigned long long)percent); + log_notice(_("\r%"PRIu64" percent complete.\r"), percent); fflush(stdout); } } @@ -357,11 +356,10 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block, reference the same as the first. If we do, we'll never be able to resolve it. The first reference can't be the second reference. */ if (id && first && !(dt->dup_flags & DUPFLAG_REF1_FOUND)) { - log_info(_("Original reference to block %llu (0x%llx) was " + log_info(_("Original reference to block %"PRIu64" (0x%"PRIx64") was " "either found to be bad and deleted, or else " "a duplicate within the same inode.\n"), - (unsigned long long)block, - (unsigned long long)block); + block, block); log_info(_("I'll consider the reference from inode %"PRIu64 " (0x%"PRIx64") the first reference.\n"), ip->i_num.in_addr, ip->i_num.in_addr); @@ -504,12 +502,10 @@ enum dup_ref_type get_ref_type(struct inode_with_dups *id)
void dup_listent_delete(struct duptree *dt, struct inode_with_dups *id) { - log_err( _("Removing duplicate reference to block %llu (0x%llx) " - "referenced as %s by dinode %llu (0x%llx)\n"), - (unsigned long long)dt->block, (unsigned long long)dt->block, - reftypes[get_ref_type(id)], (unsigned long long)id->block_no, - (unsigned long long)id->block_no); - dt->refs--; /* one less reference */ + log_err(_("Removing duplicate reference to block %"PRIu64" (0x%"PRIx64") " + "referenced as %s by dinode %"PRIu64" (0x%"PRIx64")\n"), + dt->block, dt->block, reftypes[get_ref_type(id)], id->block_no, id->block_no); + dt->refs--; if (id->name) free(id->name); osi_list_del(&id->list); @@ -626,13 +622,13 @@ void delete_all_dups(struct gfs2_inode *ip) continue;
if (dt->refs == 0) { - log_debug(_("This was the last reference: 0x%llx is " + log_debug(_("This was the last reference: 0x%"PRIx64" is " "no longer a duplicate.\n"), - (unsigned long long)dt->block); - dup_delete(dt); /* not duplicate now */ + dt->block); + dup_delete(dt); } else { - log_debug(_("%d references remain to 0x%llx\n"), - dt->refs, (unsigned long long)dt->block); + log_debug(_("%d references remain to 0x%"PRIx64"\n"), + dt->refs, dt->block); if (dt->refs > 1) continue;
@@ -646,9 +642,8 @@ void delete_all_dups(struct gfs2_inode *ip) struct inode_with_dups, list); if (id) - log_debug("Last reference is from inode " - "0x%llx\n", - (unsigned long long)id->block_no); + log_debug("Last reference is from inode 0x%"PRIx64"\n", + id->block_no); } } }
cluster-commits@lists.fedorahosted.org