On Fri, 06 Apr 2018 12:12:31 +0530, Rupesh Kumar said: > My question is : Can STANDBY IMMEDIATE command be issued directly to > SSD device ? How can I achieve it in most efficient way ? In the source tree, see tools/laptop/freefall/freefall.c for how to do the daemon. The sample code does a read() on a device that blocks until the accellerometer indicates a freefall condition, after which it does a write to /sys/block/%s/device/unload_heads to park the heads. You'll need to change that to wait until a powerfail is indicated. >From there, you want to chase into ata/libata-scsi.c to see what the write() triggers - a call to ata_scsu_park_store(). Assuming your SSD acts like an ata-scsi device, you can probably steal most of that code. You almost certainly want to do it in two separate parts (detect powerfail and alert userspace, and userspace drives an ATA UNLOAD command), because trying to launch an ATA I/O from inside the powerfail interrupt leads to madness and heavy drinking...
Attachment:
pgpI665yXGQTp.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies