Whamcloud - gitweb
LU-3318 llite: Always build 64bit ino internally
[fs/lustre-release.git] / libcfs / libcfs / tracefile.c
index f31e000..916bdc9 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -149,20 +149,21 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len)
         }
 
         if (tcd->tcd_cur_pages < tcd->tcd_max_pages) {
-                if (tcd->tcd_cur_stock_pages > 0) {
-                        tage = cfs_tage_from_list(tcd->tcd_stock_pages.prev);
-                        -- tcd->tcd_cur_stock_pages;
-                        cfs_list_del_init(&tage->linkage);
-                } else {
-                        tage = cfs_tage_alloc(CFS_ALLOC_ATOMIC);
-                        if (tage == NULL) {
-                                if (printk_ratelimit())
-                                        printk(CFS_KERN_WARNING
-                                               "cannot allocate a tage (%ld)\n",
-                                       tcd->tcd_cur_pages);
-                                return NULL;
-                        }
-                }
+               if (tcd->tcd_cur_stock_pages > 0) {
+                       tage = cfs_tage_from_list(tcd->tcd_stock_pages.prev);
+                       --tcd->tcd_cur_stock_pages;
+                       cfs_list_del_init(&tage->linkage);
+               } else {
+                       tage = cfs_tage_alloc(CFS_ALLOC_ATOMIC);
+                       if (unlikely(tage == NULL)) {
+                               if ((!cfs_memory_pressure_get() ||
+                                    cfs_in_interrupt()) && printk_ratelimit())
+                                       printk(CFS_KERN_WARNING
+                                              "cannot allocate a tage (%ld)\n",
+                                              tcd->tcd_cur_pages);
+                               return NULL;
+                       }
+               }
 
                 tage->used = 0;
                 tage->cpu = cfs_smp_processor_id();