Skip to content

Commit 209e101

Browse files
author
Dave Kleikamp
committed
JFS: use print_hex_dump() rather than private dump_mem() function
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
1 parent f720e3b commit 209e101

7 files changed

Lines changed: 29 additions & 45 deletions

File tree

‎fs/jfs/jfs_debug.c‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,6 @@
2626
#include "jfs_filsys.h"
2727
#include "jfs_debug.h"
2828

29-
#ifdef CONFIG_JFS_DEBUG
30-
void dump_mem(char *label, void *data, int length)
31-
{
32-
int i, j;
33-
int *intptr = data;
34-
char *charptr = data;
35-
char buf[10], line[80];
36-
37-
printk("%s: dump of %d bytes of data at 0x%p\n\n", label, length,
38-
data);
39-
for (i = 0; i < length; i += 16) {
40-
line[0] = 0;
41-
for (j = 0; (j < 4) && (i + j * 4 < length); j++) {
42-
sprintf(buf, " %08x", intptr[i / 4 + j]);
43-
strcat(line, buf);
44-
}
45-
buf[0] = ' ';
46-
buf[2] = 0;
47-
for (j = 0; (j < 16) && (i + j < length); j++) {
48-
buf[1] =
49-
isprint(charptr[i + j]) ? charptr[i + j] : '.';
50-
strcat(line, buf);
51-
}
52-
printk("%s\n", line);
53-
}
54-
}
55-
#endif
56-
5729
#ifdef PROC_FS_JFS /* see jfs_debug.h */
5830

5931
static struct proc_dir_entry *base;

‎fs/jfs/jfs_debug.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ extern void jfs_proc_clean(void);
6262

6363
extern int jfsloglevel;
6464

65-
extern void dump_mem(char *label, void *data, int length);
6665
extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *);
6766

6867
/* information message: e.g., configuration, major event */
@@ -94,7 +93,6 @@ extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *);
9493
* ---------
9594
*/
9695
#else /* CONFIG_JFS_DEBUG */
97-
#define dump_mem(label,data,length) do {} while (0)
9896
#define ASSERT(p) do {} while (0)
9997
#define jfs_info(fmt, arg...) do {} while (0)
10098
#define jfs_debug(fmt, arg...) do {} while (0)

‎fs/jfs/jfs_imap.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,8 @@ int diFree(struct inode *ip)
890890
* the map.
891891
*/
892892
if (iagno >= imap->im_nextiag) {
893-
dump_mem("imap", imap, 32);
893+
printk(KERN_ERR "Dump of imap:\n");
894+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, imap, 32);
894895
jfs_error(ip->i_sb,
895896
"diFree: inum = %d, iagno = %d, nextiag = %d",
896897
(uint) inum, iagno, imap->im_nextiag);

‎fs/jfs/jfs_logmgr.c‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,16 +1622,22 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
16221622
if (!list_empty(&log->synclist)) {
16231623
struct logsyncblk *lp;
16241624

1625+
printk(KERN_ERR "jfs_flush_journal: synclist not empty\n");
16251626
list_for_each_entry(lp, &log->synclist, synclist) {
16261627
if (lp->xflag & COMMIT_PAGE) {
16271628
struct metapage *mp = (struct metapage *)lp;
1628-
dump_mem("orphan metapage", lp,
1629-
sizeof(struct metapage));
1630-
dump_mem("page", mp->page, sizeof(struct page));
1629+
printk (KERN_ERR "orphan metapage:\n");
1630+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS,
1631+
lp, sizeof(struct metapage));
1632+
printk (KERN_ERR "page:\n");
1633+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS,
1634+
mp->page, sizeof(struct page));
1635+
}
1636+
else {
1637+
printk (KERN_ERR "orphan tblock:\n");
1638+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS,
1639+
lp, sizeof(struct tblock));
16311640
}
1632-
else
1633-
dump_mem("orphan tblock", lp,
1634-
sizeof(struct tblock));
16351641
}
16361642
}
16371643
#endif

‎fs/jfs/jfs_metapage.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
472472
printk(KERN_ERR "JFS: bio_add_page failed unexpectedly\n");
473473
goto skip;
474474
dump_bio:
475-
dump_mem("bio", bio, sizeof(*bio));
475+
printk(KERN_ERR "JFS: dump of bio:\n");
476+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, bio, sizeof(*bio));
476477
skip:
477478
bio_put(bio);
478479
unlock_page(page);

‎fs/jfs/jfs_txnmgr.c‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -829,12 +829,17 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
829829
/* Only locks on ipimap or ipaimap should reach here */
830830
/* assert(jfs_ip->fileset == AGGREGATE_I); */
831831
if (jfs_ip->fileset != AGGREGATE_I) {
832-
jfs_err("txLock: trying to lock locked page!");
833-
dump_mem("ip", ip, sizeof(struct inode));
834-
dump_mem("mp", mp, sizeof(struct metapage));
835-
dump_mem("Locker's tblk", tid_to_tblock(tid),
836-
sizeof(struct tblock));
837-
dump_mem("Tlock", tlck, sizeof(struct tlock));
832+
printk(KERN_ERR "txLock: trying to lock locked page!");
833+
printk(KERN_ERR "ip:\n");
834+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, ip, sizeof(*ip));
835+
printk(KERN_ERR "mp:\n");
836+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, mp, sizeof(*mp));
837+
printk(KERN_ERR "Locker's tblk:\n");
838+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS,
839+
tid_to_tblock(tid), sizeof(struct tblock));
840+
printk(KERN_ERR "Tlock:\n");
841+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, tlck,
842+
sizeof(*tlck));
838843
BUG();
839844
}
840845
INCREMENT(stattx.waitlock); /* statistics */

‎fs/jfs/xattr.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,8 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
590590
size_check:
591591
if (EALIST_SIZE(ea_buf->xattr) != ea_size) {
592592
printk(KERN_ERR "ea_get: invalid extended attribute\n");
593-
dump_mem("xattr", ea_buf->xattr, ea_size);
593+
print_hex_dump(KERN_ERR, DUMP_PREFIX_ADDRESS, ea_buf->xattr,
594+
ea_size);
594595
ea_release(inode, ea_buf);
595596
rc = -EIO;
596597
goto clean_up;

0 commit comments

Comments
 (0)