From: Christoph Hellwig <hch@infradead.org>
To: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Linux Kernel Development <linux-kernel@vger.kernel.org>,
linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: HDIO_DRIVE_CMD and hdparm
Date: Thu, 10 May 2007 13:41:45 +0100 [thread overview]
Message-ID: <20070510124145.GA19856@infradead.org> (raw)
In-Reply-To: <Pine.LNX.4.62.0705101327170.759@pademelon.sonytel.be>
On Thu, May 10, 2007 at 02:12:59PM +0200, Geert Uytterhoeven wrote:
> 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
ENOTTY is the traditional unix errno value for this ioctl is not implemented.
ENOIOCTLCMD is a new fashioned code meaning about the same. In the block
layer the latter should be used as generic code should handlde this.
>
> 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?
I suspect you can just ignore this. Even better send a patch to the hdparm
maintainer to deal with ENOTTY aswell.
next prev parent reply other threads:[~2007-05-10 12:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-10 12:12 HDIO_DRIVE_CMD and hdparm Geert Uytterhoeven
2007-05-10 12:41 ` Christoph Hellwig [this message]
2007-05-10 12:51 ` Alan Cox
2007-05-10 13:13 ` Mark Lord
2007-05-10 13:20 ` Mark Lord
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070510124145.GA19856@infradead.org \
--to=hch@infradead.org \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.