Whamcloud - gitweb
b=19860
[fs/lustre-release.git] / lnet / libcfs / linux / linux-mem.c
index 30ecf6a..8ac341a 100644 (file)
@@ -1,22 +1,37 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
+ * GPL HEADER START
  *
- *   This file is part of Lustre, http://www.lustre.org.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
  *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
  */
 #define DEBUG_SUBSYSTEM S_LNET
 
@@ -60,10 +75,14 @@ void *
 cfs_alloc(size_t nr_bytes, u_int32_t flags)
 {
        void *ptr = NULL;
+        int *ltd = JOURNAL_ENTER();
 
        ptr = kmalloc(nr_bytes, cfs_alloc_flags_to_gfp(flags));
        if (ptr != NULL && (flags & CFS_ALLOC_ZERO))
                memset(ptr, 0, nr_bytes);
+
+        JOURNAL_EXIT(ltd);
+
        return ptr;
 }
 
@@ -87,11 +106,18 @@ cfs_free_large(void *addr)
 
 cfs_page_t *cfs_alloc_pages(unsigned int flags, unsigned int order)
 {
+        cfs_page_t *pages = NULL;
+        int *ltd = JOURNAL_ENTER();
+
         /*
          * XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT)
          * from here: this will lead to infinite recursion.
          */
-        return alloc_pages(cfs_alloc_flags_to_gfp(flags), order);
+        pages = alloc_pages(cfs_alloc_flags_to_gfp(flags), order);
+
+        JOURNAL_EXIT(ltd);
+
+        return pages;
 }
 
 void __cfs_free_pages(cfs_page_t *page, unsigned int order)
@@ -124,7 +150,14 @@ cfs_mem_cache_destroy (cfs_mem_cache_t * cachep)
 void *
 cfs_mem_cache_alloc(cfs_mem_cache_t *cachep, int flags)
 {
-        return kmem_cache_alloc(cachep, cfs_alloc_flags_to_gfp(flags));
+        void *obj = NULL;
+        int *ltd = JOURNAL_ENTER();
+
+        obj = kmem_cache_alloc(cachep, cfs_alloc_flags_to_gfp(flags));
+
+        JOURNAL_EXIT(ltd);
+
+        return obj;
 }
 
 void