Whamcloud - gitweb
debugging fixes and small memory leak fix.
authorbraam <braam>
Tue, 16 Oct 2001 03:51:52 +0000 (03:51 +0000)
committerbraam <braam>
Tue, 16 Oct 2001 03:51:52 +0000 (03:51 +0000)
lustre/include/linux/obd_support.h
lustre/obdclass/class_obd.c
lustre/obdfs/flushd.c

index b8202c3..0d37002 100644 (file)
@@ -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)
 
 
index d29ed08..be7387c 100644 (file)
@@ -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: {
index 439eff3..bdccfae 100644 (file)
@@ -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;
-
 }