[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <411ed863916031511d8c2ce5150f06be141b2a8c.1322609672.git.joe@perches.com>
Date: Tue, 29 Nov 2011 18:14:00 -0800
From: Joe Perches <joe@...ches.com>
To: Alexander Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 02/28] mbcache: Use current logging styles
Convert mb_<level> uses to current logging styles.
Add newlines to uses, remove from #define to consolidate
output and avoid possible message interleaving.
Add #define pr_fmt.
Align arguments.
Neaten macro defines.
Signed-off-by: Joe Perches <joe@...ches.com>
---
fs/mbcache.c | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/fs/mbcache.c b/fs/mbcache.c
index 8c32ef3..a3c533c 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -26,6 +26,8 @@
* back on the lru list.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/kernel.h>
#include <linux/module.h>
@@ -37,23 +39,22 @@
#include <linux/init.h>
#include <linux/mbcache.h>
-
#ifdef MB_CACHE_DEBUG
-# define mb_debug(f...) do { \
- printk(KERN_DEBUG f); \
- printk("\n"); \
- } while (0)
-#define mb_assert(c) do { if (!(c)) \
- printk(KERN_ERR "assertion " #c " failed\n"); \
- } while(0)
+# define mb_debug(fmt, ...) \
+ pr_debug(fmt, ##__VA_ARGS__)
+# define mb_assert(c) \
+do { \
+ if (!(c)) \
+ pr_err("assertion " #c " failed\n"); \
+} while (0)
#else
-# define mb_debug(f...) do { } while(0)
-# define mb_assert(c) do { } while(0)
+# define mb_debug(fmt, ...) \
+ no_printk(fmt, ##__VA_ARGS__)
+# define mb_assert(c) \
+ do { } while (0)
#endif
-#define mb_error(f...) do { \
- printk(KERN_ERR f); \
- printk("\n"); \
- } while(0)
+#define mb_err(fmt, ...) \
+ pr_err(fmt, ##__VA_ARGS__)
#define MB_CACHE_WRITER ((unsigned short)~0U >> 1)
@@ -171,7 +172,7 @@ mb_cache_shrink_fn(struct shrinker *shrink, struct shrink_control *sc)
int nr_to_scan = sc->nr_to_scan;
gfp_t gfp_mask = sc->gfp_mask;
- mb_debug("trying to free %d entries", nr_to_scan);
+ mb_debug("trying to free %d entries\n", nr_to_scan);
spin_lock(&mb_cache_spinlock);
while (nr_to_scan-- && !list_empty(&mb_cache_lru_list)) {
struct mb_cache_entry *ce =
@@ -181,8 +182,8 @@ mb_cache_shrink_fn(struct shrinker *shrink, struct shrink_control *sc)
__mb_cache_entry_unhash(ce);
}
list_for_each_entry(cache, &mb_cache_list, c_cache_list) {
- mb_debug("cache %s (%d)", cache->c_name,
- atomic_read(&cache->c_entry_count));
+ mb_debug("cache %s (%d)\n",
+ cache->c_name, atomic_read(&cache->c_entry_count));
count += atomic_read(&cache->c_entry_count);
}
spin_unlock(&mb_cache_spinlock);
@@ -318,9 +319,8 @@ mb_cache_destroy(struct mb_cache *cache)
}
if (atomic_read(&cache->c_entry_count) > 0) {
- mb_error("cache %s: %d orphaned entries",
- cache->c_name,
- atomic_read(&cache->c_entry_count));
+ mb_err("cache %s: %d orphaned entries\n",
+ cache->c_name, atomic_read(&cache->c_entry_count));
}
kmem_cache_destroy(cache->c_entry_cache);
--
1.7.6.405.gc1be0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists