* sd_spinup_disk() now is a little noisy
@ 2021-09-10 22:59 Heiner Kallweit
2021-09-11 2:37 ` Bart Van Assche
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2021-09-10 22:59 UTC (permalink / raw)
To: Martin K. Petersen, Christian Loehle; +Cc: SCSI development list
For my personal taste sd_spinup_disk() is a little bit noisy now.
[ 1.942179] scsi 0:0:0:0: Direct-Access Multiple Card Reader 1.00 PQ: 0 ANSI: 0
[ 1.943651] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 1.943667] sd 0:0:0:0: [sda] Media removed, stopped polling
[ 1.949970] sd 0:0:0:0: [sda] Media removed, stopped polling
[ 1.950001] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 1.959266] sd 0:0:0:0: [sda] Media removed, stopped polling
There's not really a benefit in printing the same message multiple
times. The following helped for me, not sure however whether
that's the right way to deal with it.
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index cbd9999f9..af7e7b0da 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2124,6 +2124,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
retries = 0;
do {
+ u8 media_was_present = sdkp->media_present;
+
cmd[0] = TEST_UNIT_READY;
memset((void *) &cmd[1], 0, 9);
@@ -2138,7 +2140,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
* with any more polling.
*/
if (media_not_present(sdkp, &sshdr)) {
- sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n");
+ if (media_was_present)
+ sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n");
return;
}
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: sd_spinup_disk() now is a little noisy
2021-09-10 22:59 sd_spinup_disk() now is a little noisy Heiner Kallweit
@ 2021-09-11 2:37 ` Bart Van Assche
0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2021-09-11 2:37 UTC (permalink / raw)
To: Heiner Kallweit, Martin K. Petersen, Christian Loehle
Cc: SCSI development list
On 9/10/21 15:59, Heiner Kallweit wrote:
> do {
> + u8 media_was_present = sdkp->media_present;
How about using 'bool' instead of 'u8'?
> cmd[0] = TEST_UNIT_READY;
> memset((void *) &cmd[1], 0, 9);
>
> @@ -2138,7 +2140,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
> * with any more polling.
> */
> if (media_not_present(sdkp, &sshdr)) {
> - sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n");
> + if (media_was_present)
> + sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n");
> return;
> }
Thanks,
Bart.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-11 2:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-10 22:59 sd_spinup_disk() now is a little noisy Heiner Kallweit
2021-09-11 2:37 ` Bart Van Assche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox