From: Andreas Dilger <adilger@sun.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH] print unsigned RAM usage statistics
Date: Tue, 28 Oct 2008 14:44:21 -0600 [thread overview]
Message-ID: <20081028204420.GA3184@webber.adilger.int> (raw)
Running e2fsck against a 14.5TB filesystem with -tt it reported
-200904kB for RAM usage in pass3 instead of the correct 2300773kB.
The RAM usage statistics were being printed with %d instead of %u.
Also fix a few places using %ld for inode numbers instead of %lu.
Signed-off-by: Andreas Dilger <adilger@sun.com>
============================================================================
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 256100c..cf156bd 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -63,7 +63,7 @@ void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size,
char buf[256];
#ifdef DEBUG_ALLOCATE_MEMORY
- printf("Allocating %d bytes for %s...\n", size, description);
+ printf("Allocating %u bytes for %s...\n", size, description);
#endif
ret = malloc(size);
if (!ret) {
@@ -329,11 +329,11 @@ void print_resource_track(const char *desc, struct resource_track *track,
#define kbytes(x) (((x) + 1023) / 1024)
malloc_info = mallinfo();
- printf(_("Memory used: %dk/%dk (%dk/%dk), "),
+ printf(_("Memory used: %uk/%uk (%uk/%uk), "),
kbytes(malloc_info.arena), kbytes(malloc_info.hblkhd),
kbytes(malloc_info.uordblks), kbytes(malloc_info.fordblks));
#else
- printf(_("Memory used: %d, "),
+ printf(_("Memory used: %u, "),
(int) (((char *) sbrk(0)) - ((char *) track->brk_start)));
#endif
#ifdef HAVE_GETRUSAGE
@@ -378,7 +378,7 @@ void e2fsck_read_inode(e2fsck_t ctx, unsigned long ino,
retval = ext2fs_read_inode(ctx->fs, ino, inode);
if (retval) {
com_err("ext2fs_read_inode", retval,
- _("while reading inode %ld in %s"), ino, proc);
+ _("while reading inode %lu in %s"), ino, proc);
fatal_error(ctx, 0);
}
}
@@ -392,7 +392,7 @@ void e2fsck_read_inode_full(e2fsck_t ctx, unsigned long ino,
retval = ext2fs_read_inode_full(ctx->fs, ino, inode, bufsize);
if (retval) {
com_err("ext2fs_read_inode_full", retval,
- _("while reading inode %ld in %s"), ino, proc);
+ _("while reading inode %lu in %s"), ino, proc);
fatal_error(ctx, 0);
}
}
@@ -406,7 +406,7 @@ extern void e2fsck_write_inode_full(e2fsck_t ctx, unsigned long ino,
retval = ext2fs_write_inode_full(ctx->fs, ino, inode, bufsize);
if (retval) {
com_err("ext2fs_write_inode", retval,
- _("while writing inode %ld in %s"), ino, proc);
+ _("while writing inode %lu in %s"), ino, proc);
fatal_error(ctx, 0);
}
}
@@ -419,7 +419,7 @@ extern void e2fsck_write_inode(e2fsck_t ctx, unsigned long ino,
retval = ext2fs_write_inode(ctx->fs, ino, inode);
if (retval) {
com_err("ext2fs_write_inode", retval,
- _("while writing inode %ld in %s"), ino, proc);
+ _("while writing inode %lu in %s"), ino, proc);
fatal_error(ctx, 0);
}
}
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
next reply other threads:[~2008-10-28 20:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-28 20:44 Andreas Dilger [this message]
2009-04-07 17:24 ` [PATCH] print unsigned RAM usage statistics Theodore Tso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081028204420.GA3184@webber.adilger.int \
--to=adilger@sun.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.