mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Arjan van de Ven <arjanv@redhat.com>
Cc: linux-kernel@vger.kernel.org, B.Zolnierkiewicz@elka.pw.edu.pl,
	akpm@osdl.org
Subject: Re: Force IDE cache flush on shutdown
Date: Thu, 6 May 2004 11:52:20 +0100	[thread overview]
Message-ID: <20040506115220.A14669@infradead.org> (raw)
In-Reply-To: <20040506104638.GA9929@devserv.devel.redhat.com>; from arjanv@redhat.com on Thu, May 06, 2004 at 12:46:38PM +0200

On Thu, May 06, 2004 at 12:46:38PM +0200, Arjan van de Ven wrote:
> Ok the following does the trick for me. Better?
> 
> diff -purN linux-2.6.5/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
> --- linux-2.6.5/drivers/ide/ide-disk.c	2004-05-06 10:56:55.672139712 +0200
> +++ linux/drivers/ide/ide-disk.c	2004-05-06 11:09:19.470065240 +0200
> @@ -1820,6 +1820,23 @@ static int idedisk_revalidate_disk(struc
>  	return 0;
>  }
>  
> +static int ide_drive_shutdown(struct device * dev)
> +{
> +	ide_drive_t * drive = container_of(dev,ide_drive_t,gendev);
> +	
> +	/* safety checks */
> +	if (!drive->present)
> +		return 0;
> +	if (drive->media != ide_disk)
> +		return 0;
> +	printk("Flushing cache: %s \n", drive->name);
> +	ide_cacheflush_p(drive);
> +	/* give the hardware time to finish; it may return prematurely to cheat */
> +	mdelay(300);
> +	return 0;
> +}

Looks good to mz limited understanding of the ide code :)

>  static struct block_device_operations idedisk_ops = {
>  	.owner		= THIS_MODULE,
>  	.open		= idedisk_open,
> @@ -1881,6 +1898,7 @@ static void __exit idedisk_exit (void)
>  
>  static int idedisk_init (void)
>  {
> +	idedisk_driver.gen_driver.shutdown = ide_drive_shutdown;

isn't idedisk_driver initialized statically somewhere?  You should probably
add

	.gen_driver = {
		.shutdown	= ide_drive_shutdown,
	},

to that initializer instead.


  reply	other threads:[~2004-05-06 10:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-06  7:04 Arjan van de Ven
2004-05-06  7:49 ` Christoph Hellwig
2004-05-06  7:50   ` Arjan van de Ven
2004-05-06  7:55     ` Christoph Hellwig
2004-05-06 10:46       ` Arjan van de Ven
2004-05-06 10:52         ` Christoph Hellwig [this message]
2004-05-06 11:33           ` Arjan van de Ven
2004-05-06 11:45             ` Nigel Cunningham
2004-05-06 11:45             ` Arjan van de Ven
2004-05-06 12:36             ` Bartlomiej Zolnierkiewicz
2004-05-07  1:08               ` Benjamin Herrenschmidt
2004-05-06 11:38   ` Bartlomiej Zolnierkiewicz
2004-05-07  1:09     ` Benjamin Herrenschmidt
2004-05-09  2:00   ` Pavel Machek
2004-05-06  7:58 ` Jens Axboe
2004-05-06  8:04   ` Arjan van de Ven
2004-05-06  8:05     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040506115220.A14669@infradead.org \
    --to=hch@infradead.org \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=akpm@osdl.org \
    --cc=arjanv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®