From 1c0cfb13a62045f7a4d06b48fb57ab8dc8838921 Mon Sep 17 00:00:00 2001 From: braam Date: Tue, 16 Oct 2001 03:51:52 +0000 Subject: [PATCH] debugging fixes and small memory leak fix. --- lustre/include/linux/obd_support.h | 32 ++++++++++---------------------- lustre/obdclass/class_obd.c | 2 +- lustre/obdfs/flushd.c | 11 ++++++++--- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index b8202c3..0d37002 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -165,36 +165,24 @@ static inline void obd_iput(struct inode *inode) #define OBD_ALLOC(ptr, cast, size) \ do { \ - if (size <= 4096) { \ - ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \ - CDEBUG(D_MALLOC, "kmalloced: %d at %x.\n", \ - (int) size, (int) ptr); \ - } else { \ - ptr = (cast)vmalloc((unsigned long) size); \ - CDEBUG(D_MALLOC, "vmalloced: %d at %x.\n", \ - (int) size, (int) ptr); \ - } \ + ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \ + obd_memory += size; \ + CDEBUG(D_MALLOC, "kmalloced: %d at %x (tot %ld).\n", \ + (int) size, (int) ptr, obd_memory); \ if (ptr == 0) { \ printk("kernel malloc returns 0 at %s:%d\n", \ __FILE__, __LINE__); \ } else { \ memset(ptr, 0, size); \ - obd_memory += size; \ } \ } while (0) -#define OBD_FREE(ptr,size) \ -do { \ - if (size <= 4096) { \ - kfree((ptr)); \ - CDEBUG(D_MALLOC, "kfreed: %d at %x.\n", \ - (int) size, (int) ptr); \ - } else { \ - vfree((ptr)); \ - CDEBUG(D_MALLOC, "vfreed: %d at %x.\n", \ - (int) size, (int) ptr); \ - } \ - obd_memory -= size; \ +#define OBD_FREE(ptr,size) \ +do { \ + kfree((ptr)); \ + obd_memory -= size; \ + CDEBUG(D_MALLOC, "kfreed: %d at %x (tot %ld).\n", \ + (int) size, (int) ptr, obd_memory); \ } while (0) diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index d29ed08..be7387c 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -430,7 +430,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, obddev->obd_flags |= OBD_SET_UP; EXIT; } - + OBD_FREE(setup->setup_data, setup->setup_datalen); return err; } case OBD_IOC_CLEANUP: { diff --git a/lustre/obdfs/flushd.c b/lustre/obdfs/flushd.c index 439eff3..bdccfae 100644 --- a/lustre/obdfs/flushd.c +++ b/lustre/obdfs/flushd.c @@ -444,18 +444,23 @@ int obdfs_flushd_cleanup(void) pupdated->state == TASK_INTERRUPTIBLE )) { unsigned long timeout = HZ/20; unsigned long count = 0; + CDEBUG(D_CACHE, "\n"); send_sig_info(SIGTERM, (struct siginfo *)1, pupdated); + CDEBUG(D_CACHE, "\n"); while (pupdated) { + CDEBUG(D_CACHE, "\n"); if ((count % 2*HZ) == timeout) printk(KERN_INFO "wait for pupdated to stop\n"); - count += timeout; + CDEBUG(D_CACHE, "\n"); + count += timeout; set_current_state(TASK_INTERRUPTIBLE); + CDEBUG(D_CACHE, "\n"); schedule_timeout(timeout); + CDEBUG(D_CACHE, "\n"); } + CDEBUG(D_CACHE, "\n"); } EXIT; - /* not reached */ return 0; - } -- 1.8.3.1