Skip to contentSkip to conversation

Quieten down sg warnings with cdparanoia

PATCH New Andi Kleen 1 participant 1 message Aug 8, 2007

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Quieten down sg warnings with cdparanoia

Quieten down sg warnings

When using cdparanoia on SUSE 10.2 I get thousands of warnings. While I'm sure the warning is something important that I just miss quieten it down a bit to report only once for a program.

drivers/scsi/sg.c +6 -2
Index: linux-2.6.23-rc1-misc/drivers/scsi/sg.c
===================================================================
@@ -605,8 +605,9 @@ sg_write(struct file *filp, const char _
 	 * but is is possible that the app intended SG_DXFER_TO_DEV, because there
 	 * is a non-zero input_size, so emit a warning.
 	 */
-	if (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV)
-		if (printk_ratelimit())
+	if (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV) { 
+		static char comm[sizeof(((struct task_struct *)0)->comm)];
+		if (printk_ratelimit() && strcmp(current->comm, comm)) {
 			printk(KERN_WARNING
 			       "sg_write: data in/out %d/%d bytes for SCSI command 0x%x--"
 			       "guessing data in;\n" KERN_WARNING "   "
@@ -614,6 +615,9 @@ sg_write(struct file *filp, const char _
 			       old_hdr.reply_len - (int)SZ_SG_HEADER,
 			       input_size, (unsigned int) cmnd[0],
 			       current->comm);
+			strcpy(comm, current->comm);
+		}
+	}
 	k = sg_common_write(sfp, srp, cmnd, sfp->timeout, blocking);
 	return (k < 0) ? k : count;
 }