linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Steven Scholz <steven.scholz@imc-berlin.de>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-ide@vger.kernel.org
Subject: Re: when are buffers/caches flushed?
Date: Thu, 18 Aug 2005 21:19:01 +0900	[thread overview]
Message-ID: <43047CB5.4080803@gmail.com> (raw)
In-Reply-To: <43047B1D.9010601@imc-berlin.de>

Steven Scholz wrote:
> Tejun,
> 
>>>>> How about recent kernels? Does sync() block until buffers are flushed?
>>>>> How can I find out if the disk caches are actually flushed?
>>>>>
>>>>> I want to make sure that all data is flushed to my disk drive 
>>>>> before powering down the system.
>>>>
>>>>
>>>>  All disk caches are flushed before shutdown via the following path.
>>>>
>>>> kernel/sys.c::sys_reboot()
>>>> kernel/drivers/base/power/shutdown.c::device_shutdown()
>>>>  driver specific ->shutdown callback, for ide disks, the path is
>>>> drivers/ide/ide-disk.c::ide_device_shutdown()
>>>> drivers/ide/ide-disk.c::ide_cacheflush_p()
>>>> drivers/ide/ide-disk.c::do_idedisk_flushcache()
>>>>
>>>>  And, AFAIK, sync() doesn't flush disk caches.
>>>
>>>
>>> How about umount?
>>>
>>
>> [CC'ing Bartlomiej (Hi!)]
>>
>>  Hmmm, umount doesn't.  I think maybe adding cache flushing to sync 
>> and umount can be helpful.
> 
> 
> Ehm. So you're saying umount does _not_ flush the disk caches? BUT it 
> will flush the the fs buffers, right?

  Yeap, but it seems that currently ide-disk seems to flush only on 
reboot not on halt.  As soon as Bartlomiej confirms it, I'll submit a 
patch or he'll fix it.

> 
>>  And one more thing, ide-disk doesn't flush cache when shutting down. 
>> It flushes only when rebooting.
> 
> 
> How about ide-cs then? When I unregister a drive?
> 

  ide-cs is low-level driver, it just registers ide device with upper 
ide midlayer and ide-disk handles all the rest, so it's all the same there.

-- 
tejun

  reply	other threads:[~2005-08-18 12:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-18 10:51 when are buffers/caches flushed? Steven Scholz
2005-08-18 11:24 ` Tejun Heo
2005-08-18 11:34   ` Steven Scholz
2005-08-18 11:59     ` Tejun Heo
2005-08-18 12:12       ` Steven Scholz
2005-08-18 12:19         ` Tejun Heo [this message]
2005-08-18 12:24       ` Bartlomiej Zolnierkiewicz
2005-08-18 12:44         ` Tejun Heo
2005-08-18 13:03           ` Bartlomiej Zolnierkiewicz

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=43047CB5.4080803@gmail.com \
    --to=htejun@gmail.com \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=steven.scholz@imc-berlin.de \
    /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;
as well as URLs for NNTP newsgroup(s).