Re: [PATCH 1/9] libata: change debugging macros/adjust dbg levels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Borislav Petkov wrote:
On Fri, Jun 30, 2006 at 01:27:30AM +0900, Tejun Heo wrote:
<snip>
@@ -805,11 +807,16 @@ extern void ata_do_eh(struct ata_port *a
/*
 * printk helpers
 */
-#define ata_port_printk(ap, lv, fmt, args...) \
-	printk(lv"ata%u: "fmt, (ap)->id , ##args)
+#define ata_port_printk(ap, lv, fmt, args...) do { \
+	if (unlikely((ap)->msg_enable & (0xFF & (lv)))) \
                                         ^^^^why?
Because the decimal value of ATA_MSG_TRACE, for example, is 128 (hex 0x80) and
when i shift a 1 128 time to the left, the datatype, in our case an int, i
think (dunno what gcc does exactly here) is too small for the shift. Besides,
ap->msg_enable is an u32 so that if would never be true for something bigger
than 0x20.

Please make

+	ATA_MSG_ERR	= 0,
+	ATA_MSG_WARN	= 1,
+	ATA_MSG_DRV	= 2,
+	ATA_MSG_INFO	= 3, /* revalidation messages, EH progress */
+	ATA_MSG_VDEBUG	= 4, /* verbose hot path */
+	ATA_MSG_CMD	= 5, /* issue / completion */
+	ATA_MSG_SG	= 6, /* SG map/unmap handling */
+	ATA_MSG_TRACE	= 7, /* function tracing, e.g. enter/exit */

And test for msg_enable & (1 << (lv)). Otherwise the array will be unnecessarily large.

--
tejun
-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux