From dbede9df16bae80c5763ce893167229b005b8f84 Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 24 Apr 2002 08:34:15 +0000 Subject: [PATCH] Nice change to the OBD_ALLOC and OBD_FREE macros - it prints the name of the pointer which is being allocated or freed, to make debugging easier. --- lustre/include/linux/obd_support.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index f92b817..ac82272 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -122,22 +122,22 @@ do { \ long s = (size); \ (ptr) = kmalloc(s, GFP_KERNEL); \ if ((ptr) == NULL) { \ - CERROR("kernel malloc of %ld bytes failed at " \ - "%s:%d\n", s, __FILE__, __LINE__); \ + CERROR("kmalloc of '" #ptr "' (%ld bytes) failed " \ + "at %s:%d\n", s, __FILE__, __LINE__); \ } else { \ memset((ptr), 0, s); \ obd_memory += s; \ + CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %ld at "\ + "%p (tot %ld).\n", s, (ptr), obd_memory);\ } \ - CDEBUG(D_MALLOC, "kmalloced: %ld at %x (tot %ld).\n", \ - s, (int)(ptr), obd_memory); \ } while (0) #define OBD_FREE(ptr, size) \ do { \ int s = (size); \ kfree((ptr)); \ - CDEBUG(D_MALLOC, "kfreed: %d at %x (tot %ld).\n", \ - s, (int)(ptr), obd_memory); \ + CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %ld).\n", \ + s, (ptr), obd_memory); \ obd_memory -= s; \ } while (0) -- 1.8.3.1