Hi. At the moment libata doesn't pass pm_message_t down ata_device_suspend. This causes drives to be powered down when we just want a freeze, causing unnecessary wear and tear. This patch gets pm_message_t passed down so that it can be used to determine whether to power down the drive. Prepared against git at the time of writing. Please apply. Signed-off-by: Nigel Cunningham <[email protected]> drivers/scsi/libata-core.c | 5 +++-- drivers/scsi/libata-scsi.c | 2 +- drivers/scsi/scsi_sysfs.c | 2 +- include/linux/libata.h | 4 ++-- include/scsi/scsi_host.h | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/libata-core.c 9904-libata-freeze.patch-new/drivers/scsi/libata-core.c --- 9904-libata-freeze.patch-old/drivers/scsi/libata-core.c 2006-03-23 21:49:06.000000000 +1000 +++ 9904-libata-freeze.patch-new/drivers/scsi/libata-core.c 2006-03-23 21:16:55.000000000 +1000 @@ -4506,14 +4506,15 @@ int ata_device_resume(struct ata_port *a * Flush the cache on the drive, if appropriate, then issue a * standbynow command. */ -int ata_device_suspend(struct ata_port *ap, struct ata_device *dev) +int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t state) { if (!ata_dev_present(dev)) return 0; if (dev->class == ATA_DEV_ATA) ata_flush_cache(ap, dev); - ata_standby_drive(ap, dev); + if (state.event != PM_EVENT_FREEZE) + ata_standby_drive(ap, dev); ap->flags |= ATA_FLAG_SUSPENDED; return 0; } diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c --- 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c 2006-03-23 21:16:22.000000000 +1000 +++ 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c 2006-03-23 21:24:06.000000000 +1000 @@ -419,7 +419,7 @@ int ata_scsi_device_suspend(struct scsi_ struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; struct ata_device *dev = &ap->device[sdev->id]; - return ata_device_suspend(ap, dev); + return ata_device_suspend(ap, dev, state); } /** diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/scsi_sysfs.c 9904-libata-freeze.patch-new/drivers/scsi/scsi_sysfs.c --- 9904-libata-freeze.patch-old/drivers/scsi/scsi_sysfs.c 2006-03-23 14:49:53.000000000 +1000 +++ 9904-libata-freeze.patch-new/drivers/scsi/scsi_sysfs.c 2006-03-23 21:08:01.000000000 +1000 @@ -286,7 +286,7 @@ static int scsi_bus_suspend(struct devic return err; if (sht->suspend) - err = sht->suspend(sdev); + err = sht->suspend(sdev, state); return err; } diff -ruNp 9904-libata-freeze.patch-old/include/linux/libata.h 9904-libata-freeze.patch-new/include/linux/libata.h --- 9904-libata-freeze.patch-old/include/linux/libata.h 2006-03-23 14:50:10.000000000 +1000 +++ 9904-libata-freeze.patch-new/include/linux/libata.h 2006-03-23 21:23:31.000000000 +1000 @@ -515,9 +515,9 @@ extern void ata_eh_qc_retry(struct ata_q extern int ata_scsi_release(struct Scsi_Host *host); extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); extern int ata_scsi_device_resume(struct scsi_device *); -extern int ata_scsi_device_suspend(struct scsi_device *); +extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); extern int ata_device_resume(struct ata_port *, struct ata_device *); -extern int ata_device_suspend(struct ata_port *, struct ata_device *); +extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state); extern int ata_ratelimit(void); extern unsigned int ata_busy_sleep(struct ata_port *ap, unsigned long timeout_pat, diff -ruNp 9904-libata-freeze.patch-old/include/scsi/scsi_host.h 9904-libata-freeze.patch-new/include/scsi/scsi_host.h --- 9904-libata-freeze.patch-old/include/scsi/scsi_host.h 2006-03-23 14:50:12.000000000 +1000 +++ 9904-libata-freeze.patch-new/include/scsi/scsi_host.h 2006-03-23 21:08:57.000000000 +1000 @@ -286,7 +286,7 @@ struct scsi_host_template { * suspend support */ int (*resume)(struct scsi_device *); - int (*suspend)(struct scsi_device *); + int (*suspend)(struct scsi_device *, pm_message_t state); /* * Name of proc directory
Attachment:
pgpMOmD8F2O46.pgp
Description: PGP signature
- Follow-Ups:
- Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
- From: Jens Axboe <[email protected]>
- Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
- From: Andrew Morton <[email protected]>
- Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
- Prev by Date: Re: mm/hugetlb.c/alloc_fresh_huge_page(): slow division on NUMA
- Next by Date: Re: mm/hugetlb.c/alloc_fresh_huge_page(): slow division on NUMA
- Previous by thread: mm/hugetlb.c/alloc_fresh_huge_page(): slow division on NUMA
- Next by thread: Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
- Index(es):