[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <04bf3c02-85f4-3fbc-525a-4189aadf9241@0882a8b5-c6c3-11e9-b005-00805fc181fe>
Date: Wed, 17 Jun 2020 20:32:08 +0100
From: Simon Arlott <simon@...iron.net>
To: Bart Van Assche <bvanassche@....org>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Jonathan Corbet <corbet@....net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-scsi@...r.kernel.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH] scsi: sd: stop SSD (non-rotational) disks before reboot
On 17/06/2020 20:19, Bart Van Assche wrote:
> On 2020-06-17 11:49, Simon Arlott wrote:
>> @@ -3576,9 +3582,19 @@ static void sd_shutdown(struct device *dev)
>> sd_sync_cache(sdkp, NULL);
>> }
>>
>> - if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
>> - sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
>> - sd_start_stop_device(sdkp, 0);
>> + if (sdkp->device->manage_start_stop) {
>> + bool stop_disk = (system_state != SYSTEM_RESTART);
>> +
>> + if (stop_before_reboot > 1) { /* stop all disks */
>> + stop_disk = true;
>> + } else if (stop_before_reboot) { /* non-rotational only */
>> + stop_disk |= blk_queue_nonrot(sdkp->disk->queue);
>> + }
>> +
>> + if (stop_disk) {
>> + sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
>> + sd_start_stop_device(sdkp, 0);
>> + }
>> }
>> }
>
> Is introduction of a new kernel module parameter essential?
It is system-dependent whether or not a reboot is going to result in a
loss of power, so it's required to be able to stop the HDDs too.
They're already always stopped on shutdown where power is definitely
going to be lost. I can't do that by default on a reboot because the
usual convention is that the power stays on during a reboot and it would
be expected that the HDDs keep spinning.
> Or in other
> words, has it been considered to apply the new behavior to all SSDs?
The default value is 1, so it does apply to all SSDs. I want to be able
to configure it to apply to HDDs too.
--
Simon Arlott
Powered by blists - more mailing lists