Notice that we are calling standby(), then cleanup(): standby() puts the disk
to sleep, but cleanup flushes the cache.
Here is the code for standby() from ide_disk.c in 2.4.19 vanilla:
1235 static int do_idedisk_standby (ide_drive_t *drive) // put disk to sleep.
1236 {
1237 struct hd_drive_task_hdr taskfile;
1238 struct hd_drive_hob_hdr hobfile;
1239 memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
1240 memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
1241 taskfile.command = WIN_STANDBYNOW1;
1242 return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
1243 }
Now here's the cleanup() function:
1420 static int idedisk_cleanup (ide_drive_t *drive)
1421 {
1422 if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
1423 if (do_idedisk_flushcache(drive))
1424 printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
1425 drive->name);
1426 return ide_unregister_subdriver(drive);
1427 }
--------------------------------------------------------------------------
Looking at this snippet of the the first snippet
4031 if (event != SYS_RESTART)
4032 if (drive->driver != NULL && DRIVER(drive)->standby(drive))
4033 continue;
4034
4035 if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
4036 continue;
I also see another potential bug (actually, the original bug I posted about):
standby() returns 0 on success, and non-zero on failure. By this logic, if
standby() fails then cleanup() won't get called.
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/