JFS: use print_hex_dump() rather than private dump_mem() function
authorDave Kleikamp <shaggy@linux.vnet.ibm.com>
Wed, 6 Jun 2007 21:30:17 +0000 (16:30 -0500)
committerDave Kleikamp <shaggy@linux.vnet.ibm.com>
Wed, 6 Jun 2007 21:30:17 +0000 (16:30 -0500)
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
fs/jfs/jfs_debug.c
fs/jfs/jfs_debug.h
fs/jfs/jfs_imap.c
fs/jfs/jfs_logmgr.c
fs/jfs/jfs_metapage.c
fs/jfs/jfs_txnmgr.c
fs/jfs/xattr.c

index 9c5d59632aac98730aea6df4f5a50cac665e7a2c..887f5759e53643bdba5086363d587d82a789c5d3 100644 (file)
 #include "jfs_filsys.h"
 #include "jfs_debug.h"
 
-#ifdef CONFIG_JFS_DEBUG
-void dump_mem(char *label, void *data, int length)
-{
-       int i, j;
-       int *intptr = data;
-       char *charptr = data;
-       char buf[10], line[80];
-
-       printk("%s: dump of %d bytes of data at 0x%p\n\n", label, length,
-              data);
-       for (i = 0; i < length; i += 16) {
-               line[0] = 0;
-               for (j = 0; (j < 4) && (i + j * 4 < length); j++) {
-                       sprintf(buf, " %08x", intptr[i / 4 + j]);
-                       strcat(line, buf);
-               }
-               buf[0] = ' ';
-               buf[2] = 0;
-               for (j = 0; (j < 16) && (i + j < length); j++) {
-                       buf[1] =
-                           isprint(charptr[i + j]) ? charptr[i + j] : '.';
-                       strcat(line, buf);
-               }
-               printk("%s\n", line);
-       }
-}
-#endif
-
 #ifdef PROC_FS_JFS /* see jfs_debug.h */
 
 static struct proc_dir_entry *base;
index 7378798f0b2151c1a0df6e9146ac9cf6b08995b1..044c1e654cc00e4f1790bd16e67ecc053944a213 100644 (file)
@@ -62,7 +62,6 @@ extern void jfs_proc_clean(void);
 
 extern int jfsloglevel;
 
-extern void dump_mem(char *label, void *data, int length);
 extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *);
 
 /* information message: e.g., configuration, major event */
@@ -94,7 +93,6 @@ extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *);
  *     ---------
  */
 #else                          /* CONFIG_JFS_DEBUG */
-#define dump_mem(label,data,length) do {} while (0)
 #define ASSERT(p) do {} while (0)
 #define jfs_info(fmt, arg...) do {} while (0)
 #define jfs_debug(fmt, arg...) do {} while (0)
index f5c5227b0d1f69081c959fbdee0d646aab0a47ab..19da0e17e4dec2f5281fe543b2a292be1616e1c2 100644 (file)
@@ -890,7 +890,8 @@ int diFree(struct inode *ip)
         * the map.
         */
        if (iagno >= imap->im_nextiag) {
-               dump_mem("imap", imap, 32);
+               printk(KERN_ERR "Dump of imap:\n");
+               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, imap, 32);
                jfs_error(ip->i_sb,
                          "diFree: inum = %d, iagno = %d, nextiag = %d",
                          (uint) inum, iagno, imap->im_nextiag);
index 88eae45a464427f692d3739bf60e38a03e2e0b8d..2917ede90d6775dac6110f4cb82b01acf94bfdc9 100644 (file)
@@ -1622,16 +1622,22 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
        if (!list_empty(&log->synclist)) {
                struct logsyncblk *lp;
 
+               printk(KERN_ERR "jfs_flush_journal: synclist not empty\n");
                list_for_each_entry(lp, &log->synclist, synclist) {
                        if (lp->xflag & COMMIT_PAGE) {
                                struct metapage *mp = (struct metapage *)lp;
-                               dump_mem("orphan metapage", lp,
-                                        sizeof(struct metapage));
-                               dump_mem("page", mp->page, sizeof(struct page));
+                               printk (KERN_ERR "orphan metapage:\n");
+                               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS,
+                                              lp, sizeof(struct metapage));
+                               printk (KERN_ERR "page:\n");
+                               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS,
+                                              mp->page, sizeof(struct page));
+                       }
+                       else {
+                               printk (KERN_ERR "orphan tblock:\n");
+                               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS,
+                                              lp, sizeof(struct tblock));
                        }
-                       else
-                               dump_mem("orphan tblock", lp,
-                                        sizeof(struct tblock));
                }
        }
 #endif
index 43d4f69afbeca923878a45d77fa68d4eb53a55f9..1c4fced1e6d858c2b38b089019d3c6d64b91b9be 100644 (file)
@@ -472,7 +472,8 @@ add_failed:
        printk(KERN_ERR "JFS: bio_add_page failed unexpectedly\n");
        goto skip;
 dump_bio:
-       dump_mem("bio", bio, sizeof(*bio));
+       printk(KERN_ERR "JFS: dump of bio:\n");
+       print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, bio, sizeof(*bio));
 skip:
        bio_put(bio);
        unlock_page(page);
index f2dc4b9863926e7c9f17ec39164d83cdceab9749..d6f23f90ad363625086dba9dba18ece7c8e2212d 100644 (file)
@@ -829,12 +829,17 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
        /* Only locks on ipimap or ipaimap should reach here */
        /* assert(jfs_ip->fileset == AGGREGATE_I); */
        if (jfs_ip->fileset != AGGREGATE_I) {
-               jfs_err("txLock: trying to lock locked page!");
-               dump_mem("ip", ip, sizeof(struct inode));
-               dump_mem("mp", mp, sizeof(struct metapage));
-               dump_mem("Locker's tblk", tid_to_tblock(tid),
-                        sizeof(struct tblock));
-               dump_mem("Tlock", tlck, sizeof(struct tlock));
+               printk(KERN_ERR "txLock: trying to lock locked page!");
+               printk(KERN_ERR "ip:\n");
+               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, ip, sizeof(*ip));
+               printk(KERN_ERR "mp:\n");
+               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, mp, sizeof(*mp));
+               printk(KERN_ERR "Locker's tblk:\n");
+               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS,
+                              tid_to_tblock(tid), sizeof(struct tblock));
+               printk(KERN_ERR "Tlock:\n");
+               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, tlck,
+                              sizeof(*tlck));
                BUG();
        }
        INCREMENT(stattx.waitlock);     /* statistics */
index 5c0f2de01316ea86ba022da7b167aba98f30267f..2dcb1327542963d5348f16750dc768f38aa12a83 100644 (file)
@@ -590,7 +590,8 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
       size_check:
        if (EALIST_SIZE(ea_buf->xattr) != ea_size) {
                printk(KERN_ERR "ea_get: invalid extended attribute\n");
-               dump_mem("xattr", ea_buf->xattr, ea_size);
+               print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, ea_buf->xattr,
+                              ea_size);
                ea_release(inode, ea_buf);
                rc = -EIO;
                goto clean_up;