[PATCH] ide-cd: Improve "weird block size" error message

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

 



On Monday 22 June 2009, Bartlomiej Zolnierkiewicz wrote:
> On Monday 22 June 2009 21:01:37 Frans Pop wrote:
> > There is one thing I should mention here. I have been seeing the
> > following error with this CD drive:
> > ide-cd: hdd: weird block size 2352
> > ide-cd: hdd: default to 2kb block size
>
> This is just a harmless warning coming from enabling of the workaround
> for weird ATAPI devices (the one you have in this sparc machine seems
> to score really high on the weirdness scale ;) introduced by commit
> e8e7b9e.

In that case I'd like to propose the following patch. Currently the error
can get printed much to frequently when there's a disc in the drive.
Example:

Jun 13 18:06:28 gimli kernel: ide-cd: hdd: weird block size 2352
Jun 13 18:06:28 gimli kernel: ide-cd: hdd: default to 2kb block size
Jun 13 18:06:32 gimli kernel: ide-cd: hdd: weird block size 2352
Jun 13 18:06:42 gimli kernel: ide-cd: hdd: default to 2kb block size
Jun 13 18:07:02 gimli kernel: ide-cd: hdd: weird block size 2352
Jun 13 18:07:02 gimli kernel: ide-cd: hdd: default to 2kb block size
Jun 13 18:07:05 gimli kernel: ide-cd: hdd: weird block size 2352
Jun 13 18:07:05 gimli kernel: ide-cd: hdd: default to 2kb block size
Jun 13 18:07:09 gimli kernel: ide-cd: hdd: weird block size 2352
Jun 13 18:07:09 gimli kernel: ide-cd: hdd: default to 2kb block size
Jun 13 18:07:14 gimli kernel: ide-cd: hdd: weird block size 2352
Jun 13 18:07:14 gimli kernel: ide-cd: hdd: default to 2kb block size
Jun 13 18:07:35 gimli kernel: ide-cd: hdd: weird block size 2352
Jun 13 18:07:35 gimli kernel: ide-cd: hdd: default to 2kb block size
Jun 13 18:07:51 gimli kernel: ide-cd: hdd: weird block size 2352
Jun 13 18:07:51 gimli kernel: ide-cd: hdd: default to 2kb block size

I was not using the CD at all here. I suspect HAL's stupid polling to be
the culprit as I first saw it after upgrading X.Org packages to a version
which depends on HAL. I since disabled polling for the device, but I
still feel that warning once should be sufficient as IIUC the value is
device dependent and not medium dependent.

With the patch it only gets printed once, when the driver is initialized.

Cheers,
FJP

---
From: Frans Pop <elendil@xxxxxxxxx>
Subject: ide-cd: Improve "weird block size" error message

Currently the error gets repeated too frequently, for example
each time HAL polls the device when a disc is present. Avoid that
by using printk_once instead of printk.
Also join the error and corrective action messages into a single line.

Signed-off-by: Frans Pop <elendil@xxxxxxxxx>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 4a19686..7ec6996 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -886,10 +886,9 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
 	case 4096:
 		break;
 	default:
-		printk(KERN_ERR PFX "%s: weird block size %u\n",
+		printk_once(KERN_ERR PFX "%s: weird block size %u; "
+				"setting default block size to 2048\n",
 				drive->name, blocklen);
-		printk(KERN_ERR PFX "%s: default to 2kb block size\n",
-				drive->name);
 		blocklen = 2048;
 		break;
 	}
--
To unsubscribe from this list: 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