All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm <linux-pm@lists.linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Testing for dirty buffers on a block device
Date: Tue, 23 Feb 2010 23:13:30 +0100	[thread overview]
Message-ID: <20100223221329.GO1025@kernel.dk> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1002231137520.1308-100000@iolanthe.rowland.org>

On Tue, Feb 23 2010, Alan Stern wrote:
> On Tue, 23 Feb 2010, Jens Axboe wrote:
> 
> > > P.S.: Jens, given a pointer to a struct gendisk or to a struct
> > > request_queue, is there a good way to tell whether there any dirty
> > > buffers for that device waiting to be written out?  This is for
> > > purposes of runtime power management -- in the initial implementation,
> > > I want to avoid powering-down a block device if it is open or has any
> > > dirty buffers.  In other words, only completely idle devices should be
> > > powered down (a good example would be a card reader with no memory card 
> > > inserted).
> > 
> > There's no fool proof way. For most file systems I think you could get
> > away with checking the q->bdi dirty lists to see if there's anything
> > pending. But that wont work always, if the fs uses a different backing
> > dev info than then queue itself.
> 
> That's not what I meant.  Dirty buffers on a filesystem make no 
> difference because they always get written out when the filesystem is 
> unmounted.  The device file remains open as long as the filesystem 
> is mounted, which would prevent the device from being powered down.
> 
> I was asking about dirty buffers on a block device that isn't holding a 
> filesystem -- where the raw device is being used directly for I/O.

OK, so just specifically the page cache of the device. Is that really
enough of an issue to warrant special checking? I mean, what normal
setup would even use buffer raw device access?

But if you wanted, I guess the only way would be to lookup
dirty/writeback pages on the bdev inode mapping. For that you'd need the
bdev, not the gendisk or the queue though.

-- 
Jens Axboe


  parent reply	other threads:[~2010-02-23 22:13 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13 13:29 Is it supposed to be ok to call del_gendisk while userspace is frozen? Maxim Levitsky
2010-02-13 13:29 ` Maxim Levitsky
2010-02-15 16:00 ` Maxim Levitsky
2010-02-15 16:00 ` Maxim Levitsky
2010-02-15 21:04   ` Rafael J. Wysocki
2010-02-16 16:27     ` [linux-pm] " Alan Stern
2010-02-20 22:22       ` Maxim Levitsky
2010-02-20 22:22         ` [linux-pm] " Maxim Levitsky
2010-02-23 12:33       ` Jens Axboe
2010-02-23 15:29         ` Alan Stern
2010-02-23 15:58           ` Jens Axboe
2010-02-23 15:58           ` [linux-pm] " Jens Axboe
2010-02-23 16:33             ` Alan Stern
2010-02-23 22:16               ` Jens Axboe
2010-02-23 22:16               ` [linux-pm] " Jens Axboe
2010-02-24 15:59                 ` Alan Stern
2010-02-24 19:12                   ` Jens Axboe
2010-02-24 20:19                     ` Alan Stern
2010-02-24 20:19                     ` [linux-pm] " Alan Stern
2010-02-24 19:12                   ` Jens Axboe
2010-02-24 15:59                 ` Alan Stern
2010-02-23 16:33             ` Alan Stern
2010-02-23 16:42             ` Testing for dirty buffers on a block device Alan Stern
2010-02-23 22:13               ` Jens Axboe
2010-02-23 22:13               ` Jens Axboe [this message]
2010-02-24 15:51                 ` Alan Stern
2010-02-24 19:09                   ` Jens Axboe
2010-02-24 19:09                   ` Jens Axboe
2010-02-24 20:09                     ` Alan Stern
2010-02-25  8:20                       ` Jens Axboe
2010-02-25 22:19                         ` Dave Chinner
2010-02-25 22:19                         ` Dave Chinner
2010-02-25  8:20                       ` Jens Axboe
2010-02-24 20:09                     ` Alan Stern
2010-02-24 15:51                 ` Alan Stern
2010-02-23 16:42             ` Alan Stern
2010-03-01  6:35           ` Is it supposed to be ok to call del_gendisk while userspace is frozen? Pavel Machek
2010-03-01  6:35           ` [linux-pm] " Pavel Machek
2010-03-01 15:23             ` Alan Stern
2010-03-01 15:23             ` [linux-pm] " Alan Stern
2010-03-03 21:50               ` Pavel Machek
2010-03-03 21:50               ` [linux-pm] " Pavel Machek
2010-03-03 22:23                 ` Alan Stern
2010-03-04  0:23                   ` Rafael J. Wysocki
2010-03-04  0:23                   ` [linux-pm] " Rafael J. Wysocki
2010-03-04  2:48                     ` Alan Stern
2010-03-04 19:26                       ` Rafael J. Wysocki
2010-03-04 19:26                       ` [linux-pm] " Rafael J. Wysocki
2010-03-04 19:36                         ` Alan Stern
2010-03-04 19:36                           ` [linux-pm] " Alan Stern
2010-03-04 20:04                           ` Rafael J. Wysocki
2010-03-04 20:04                           ` Rafael J. Wysocki
2010-03-04 20:15                         ` Pavel Machek
2010-03-04 20:15                           ` [linux-pm] " Pavel Machek
2010-04-22 23:40                           ` Matt Reimer
2010-04-23  5:17                             ` Rafael J. Wysocki
2010-05-11 23:55                               ` Matt Reimer
2010-05-12 14:50                                 ` Alan Stern
2010-05-13 21:44                                   ` Matt Reimer
2010-05-13 21:44                                   ` [linux-pm] " Matt Reimer
2010-05-13 21:54                                     ` Alan Stern
2010-05-13 22:20                                       ` Matt Reimer
2010-05-13 22:47                                         ` Nigel Cunningham
2010-05-15  2:37                                           ` Alan Stern
2010-05-15  2:37                                           ` [linux-pm] " Alan Stern
2010-05-15  2:53                                             ` Nigel Cunningham
2010-05-15  2:53                                             ` [linux-pm] " Nigel Cunningham
2010-05-16 19:35                                               ` Rafael J. Wysocki
2010-05-16 19:35                                               ` [linux-pm] " Rafael J. Wysocki
2010-05-13 22:47                                         ` Nigel Cunningham
2010-05-15  2:32                                         ` [linux-pm] " Alan Stern
2010-05-15 20:30                                           ` Rafael J. Wysocki
2010-05-15 20:30                                           ` [linux-pm] " Rafael J. Wysocki
2010-05-16  7:49                                             ` Nigel Cunningham
2010-05-16  7:49                                             ` [linux-pm] " Nigel Cunningham
2010-05-16 19:38                                               ` Rafael J. Wysocki
2010-05-16 19:38                                               ` [linux-pm] " Rafael J. Wysocki
2010-05-16 21:32                                                 ` Nigel Cunningham
2010-05-17  2:22                                                   ` Alan Stern
2010-05-17  7:45                                                     ` Nigel Cunningham
2010-05-17 20:35                                                       ` Rafael J. Wysocki
2010-05-17 20:35                                                       ` [linux-pm] " Rafael J. Wysocki
2010-05-17 22:51                                                         ` Nigel Cunningham
2010-05-17 22:51                                                         ` [linux-pm] " Nigel Cunningham
2010-05-18 19:43                                                           ` Rafael J. Wysocki
2010-05-18 20:06                                                             ` Alan Stern
2010-05-18 20:06                                                             ` Alan Stern
2010-05-18 19:43                                                           ` Rafael J. Wysocki
2010-05-24 19:02                                                           ` [linux-pm] " Pavel Machek
2010-05-24 21:21                                                             ` Nigel Cunningham
2010-05-24 21:21                                                             ` Nigel Cunningham
2010-05-24 19:02                                                           ` Pavel Machek
2010-05-17  7:45                                                     ` Nigel Cunningham
2010-05-17  2:22                                                   ` Alan Stern
2010-05-16 21:32                                                 ` Nigel Cunningham
2010-05-15  2:32                                         ` Alan Stern
2010-05-13 22:20                                       ` Matt Reimer
2010-05-13 21:54                                     ` Alan Stern
2010-05-12 14:50                                 ` Alan Stern
2010-05-11 23:55                               ` Matt Reimer
2010-04-23  5:17                             ` Rafael J. Wysocki
2010-04-22 23:40                           ` Matt Reimer
2010-03-04  2:48                     ` Alan Stern
2010-03-04 13:53                   ` [linux-pm] " Pavel Machek
2010-06-04 11:20                     ` Maxim Levitsky
2010-06-04 14:59                       ` Alan Stern
2010-06-04 14:59                       ` [linux-pm] " Alan Stern
2010-06-04 15:19                         ` Maxim Levitsky
2010-06-04 17:52                           ` Alan Stern
2010-06-04 17:52                           ` [linux-pm] " Alan Stern
2010-06-04 15:19                         ` Maxim Levitsky
2010-06-04 11:20                     ` Maxim Levitsky
2010-03-04 13:53                   ` Pavel Machek
2010-03-03 22:23                 ` Alan Stern
2010-02-23 15:29         ` Alan Stern
2010-02-23 12:33       ` Jens Axboe
2010-02-16 16:27     ` Alan Stern
2010-02-15 21:04   ` Rafael J. Wysocki

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=20100223221329.GO1025@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.