HDIO_DRIVE_CMD and hdparm

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

 



	Hi,

`hdparm -t' uses HDIO_DRIVE_CMD(null) to flush the disk's buffer.
When using it on my own block device (the new PS3 disk storage driver), hdparm
gives the following error message:

| HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device

When using it on an ATA or SCSI device, no such error message is printed.

According to the hdparm sources, hdparm expects the HDIO_DRIVE_CMD(null) ioctl
to either succeed, or to fail with errno EINVAL.

Apparently handling of ioctls is different for the different device types:
  - ATA/SATA handle HDIO_DRIVE_CMD(null) (and a few other variants)
    => fine for hdparm
  - SCSI doesn't handle HDIO_DRIVE_CMD(null), and returns EINVAL
    => fine for hdparm
  - If a block device doesn't support the ioctl, blkdev_driver_ioctl() returns
    ENOTTY
    => hdparm error message

Which one is correct?
  - blkdev_ioctl()/blkdev_driver_ioctl() return -ENOTTY
  - scsi_cmd_ioctl() returns -ENOTTY
  - scsi_ioctl() returns -EINVAL
  - cdrom_ioctl() returns -ENOSYS to mean not handled, continue
  - some block layer routines return -ENOIOCTLCMD to mean not handled, continue

This causes constructs with different tests like e.g.:

	sr_block_ioctl()
	{
		...
		ret = cdrom_ioctl(...);
		if (ret != -ENOSYS)
			return ret;
		...
		return scsi_ioctl(...);
	}

	cdrom_ioctl()
	{
		...
		ret = scsi_cmd_ioctl(...);
		if (ret != -ENOTTY)
			return ret;
		...
		return -ENOSYS;
	}

	blkdev_ioctl()
	{
		...
		ret = blkdev_locked_ioctl(...);
		...
		if (ret != -ENOIOCTLCMD)
			return ret;

		return blkdev_driver_ioctl(...);
	}

My questions:
  1. Does any of these have to be fixed?
  2. Shall I add a dummy HDIO_DRIVE_CMD(null) handler to my block device to
     return -EINVAL?
  3. Shall I just ignore the hdparm error message?

Thanks!

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE)
Geert.Uytterhoeven@xxxxxxxxxxx ------- The Corporate Village, Da Vincilaan 7-D1
Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux