From: mannu on
Hello,
Is there an ioctl that tells whether write caching is enabled
on disk?
I believe there are many kinds of disks like scsi, ide, sata, pata
etc,.
And I need to know if whether write caching is enabled for all kinds
of disks possible?

On reading scsi document, I found mode sense page code 8 gives whether
write cache is enabled or not. If so we can use USCSICMD ioctl. Is my
assumption correct?

For IDE, sata, pata and other possible non scsi disks, how we can get
whether write caching is enabled or not?


Thanks and Regards,
Mannu.
From: bill on
On 03/23/10 06:57 AM, mannu wrote:
> Hello,
> Is there an ioctl that tells whether write caching is enabled
> on disk?
> I believe there are many kinds of disks like scsi, ide, sata, pata
> etc,.
> And I need to know if whether write caching is enabled for all kinds
> of disks possible?
>
> On reading scsi document, I found mode sense page code 8 gives whether
> write cache is enabled or not. If so we can use USCSICMD ioctl. Is my
> assumption correct?
>
> For IDE, sata, pata and other possible non scsi disks, how we can get
> whether write caching is enabled or not?
>
>
> Thanks and Regards,
> Mannu.


format -e
select disk
cache
write_cache
display


Bill
From: mannu on
On Mar 23, 4:39 pm, bill <billg...(a)nyc.rr.com> wrote:
> On 03/23/10 06:57 AM, mannu wrote:
>
>
>
> > Hello,
> >           Is there an ioctl that tells whether write caching is enabled
> > on disk?
> > I believe there are many kinds of disks like scsi, ide, sata, pata
> > etc,.
> > And I need to know if whether write caching is enabled for all kinds
> > of disks possible?
>
> > On reading scsi document, I found mode sense page code 8 gives whether
> > write cache is enabled or not. If so we can use USCSICMD ioctl. Is my
> > assumption correct?
>
> > For IDE, sata, pata and other possible non scsi disks, how we can get
> > whether write caching is enabled or not?
>
> > Thanks and Regards,
> > Mannu.
>
> format -e
>    select disk
>      cache
>        write_cache
>          display
>
> Bill

Hello Bill,
Thank you for reply. The "format -e" way is only
working for scsi disks.

For IDE, sata, pata and other possible non scsi disks, how we can get
whether write caching is enabled or not?

Also I needed to do this from C program using ioctls ?
From: Tim Bradshaw on
On 2010-03-23 11:45:41 +0000, mannu said:

> For IDE, sata, pata and other possible non scsi disks, how we can get
> whether write caching is enabled or not?

I imagine this is essentially impossible in general way, especally in
the presence of disk systems which will probably lie to you.

From: mannu on
On Mar 23, 11:58 pm, Tim Bradshaw <t...(a)tfeb.org> wrote:
> On 2010-03-23 11:45:41 +0000, mannu said:
>
> > For IDE, sata, pata and other possible non scsi disks, how we can get
> > whether write caching is enabled or not?
>
> I imagine this is essentially impossible in  general way, especally in
> the presence of disk systems which will probably lie to you.

Hello Tim,
Thankyou for help.
For scsi disks, scsi standard mentions mode sense page 0x8 gives
whether caching enabled or not.

For IDE, sata, pata and other possible non scsi disks, while googling
around,
I found ioctl "DIOCTL_GETWCE" mentioned in "/usr/include/sys/dktp/
dadkio.h".
I need to know whether this IOCTL is public? I am not able to find any
manual page
for this.

Also what is :"dad" driver?

Thanks and Regards,
Mannu.