On 2018-10-19 3:45 a.m., Johannes Thumshirn wrote:
On 19/10/18 08:24, Douglas Gilbert wrote:
[..]
+/*
+ * Kernel needs to be built with CONFIG_SCSI_LOGGING to see log messages.
+ * 'depth' is a number between 1 (most severe) and 7 (most noisy, most
+ * information). All messages are logged as informational (KERN_INFO). In
+ * the unexpected situation where sdp is NULL the macro reverts to a pr_info
+ * and ignores CONFIG_SCSI_LOGGING and always prints to the log.
+ */
+#define SG_LOG(depth, sdp, fmt, a...)                          \
+       do {                                                            \
+               if (IS_ERR_OR_NULL(sdp)) {                              \
+                       pr_info("sg: sdp=NULL_or_ERR, " fmt, ##a);    \
+               } else {                                                \
+                       SCSI_LOG_TIMEOUT(depth, sdev_prefix_printk(     \
+                                        KERN_INFO, (sdp)->device,   \
+                                        (sdp)->disk->disk_name, fmt,     \
+                                        ##a));                         \
+               }                                                       \
+       } while (0)

Hi Doug,
have you considered using the kernel's dynamic debug infrastructure instead?

Hi,
I'll follow what the scsi mid-level and the other ULDs do. IOW, no
change. The debug messages they produce are quite helpful (to me, I
use them a lot, and Tony B. has asked for more precision) and well-tuned
to the SCSI subsystem (e.g. telling us what sdp represents in useful
terms).

And they can be compiled out (but not my pr_info above, probably
should be a pr_warn).

Doug Gilbert


Reply via email to