Skip to contentSkip to conversation

dm-core-add-ratelimit-printing.patch

PATCH In review Jonathan Brassow 3 participants 4 messages Apr 5, 2007 – Apr 10, 2007 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-core-add-ratelimit-printing.patch

This patch adds macros for ratelimiting messages.

brassow

drivers/md/dm.h +9 -0
Index: linux-2.6.19-rc4-mm2/drivers/md/dm.h
===================================================================
@@ -19,8 +19,17 @@
 #define DM_NAME "device-mapper"
 
 #define DMERR(f, arg...) printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
+#define DMERR_LIMIT(f, arg...) \
+	if (printk_ratelimit())	\
+		printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
 #define DMWARN(f, arg...) printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
+#define DMWARN_LIMIT(f, arg...) \
+	if (printk_ratelimit())	\
+		printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
 #define DMINFO(f, arg...) printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
+#define DMINFO_LIMIT(f, arg...) \
+	if (printk_ratelimit())	\
+		printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
 #ifdef CONFIG_DM_DEBUG
 #  define DMDEBUG(f, arg...) printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " f "\n", ## arg)
 #else
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

drivers/md/dm.h line 35

Quoted 8 lines · Jonathan Brassow

#define DMINFO(f, arg...) printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)

drivers/md/dm.h +3 -0
+#define DMINFO_LIMIT(f, arg...) \
+	if (printk_ratelimit())	\
+		printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
 #ifdef CONFIG_DM_DEBUG
 #  define DMDEBUG(f, arg...) printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " f "\n", ## arg)
 #else

Cool! Can we get one for DMDEBUG too? There are some uses of DMDEBUG messages where it'd be really nice to have a rate limited version of the macro.

Regards,
Bryn.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFGFSsF6YSQoMYUY94RAouZAJ9kuBSCfJalAnION286Ne/7hrOU7QCgnWJV Awno4+Q38pWdPH3/d7oaNrk=
=L2hN
-----END PGP SIGNATURE-----

#2 lore raw
In reply to Jonathan Brassow

drivers/md/dm.h line 24

Quoted 4 lines · Jonathan Brassow

#define DMERR(f, arg...) printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)

drivers/md/dm.h +3 -0
+#define DMERR_LIMIT(f, arg...) \
+	if (printk_ratelimit())	\
+		printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)

I would put a "do { ... } while (0)" around this, else you end up with nasty surprises if it's used as in "if (..) DMERR_LIMIT(..) else do_something"

Olaf

Signature · 2 lines
Olaf Kirch  |  --- o --- Nous sommes du soleil we love when we play
[email protected] |    / | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax
#3 lore raw

hmmm, yes. that was stupid.

brassow

Quoted 19 lines · Olaf Kirch

drivers/md/dm.h line 24

Quoted 5 lines · Jonathan Brassow

#define DMERR(f, arg...) printk(KERN_ERR DM_NAME ": "
DM_MSG_PREFIX ": " f "\n", ## arg)

drivers/md/dm.h +3 -0
+#define DMERR_LIMIT(f, arg...) \
+	if (printk_ratelimit())	\
+		printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)

I would put a "do { ... } while (0)" around this, else you end up with nasty surprises if it's used as in "if (..) DMERR_LIMIT(..) else do_something"

Olaf

Signature · 7 lines
Olaf Kirch  |  --- o --- Nous sommes du soleil we love when we play
[email protected] |    / | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel