dm-core-add-ratelimit-printing.patch
PATCH 1/1 dm-core-add-ratelimit-printing.patch
This patch adds macros for ratelimiting messages.
brassow
drivers/md/dm.h +9 -0
@@ -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
-----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-----
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
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_ERRDM_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(..)elsedo_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