public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ashley <dash@xdr.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Block device invalidate cached blocks
Date: Wed, 5 Feb 2003 18:35:40 -0800	[thread overview]
Message-ID: <200302060235.h162ZeP04153@xdr.com> (raw)

>I'm working on a block device driver for linux. 
>
>Linux caches the blocks read from my block device, which is fine. I've 
>mounted a read-only filesystem on the block device. But sometimes on 
>the back end the file system will change. Is there a way I can cause the 
>kernel to just flush all its cached blocks? Or even better invalidate 
>just the few blocks that have changed? 
>
>Thanks-- 
>Dave


After some hunting (kernel hackers guide proved fruitless, web searches
were the same, looked in fs/buffer.c and found
void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers);

Found use of it in block_dev.c:

/* Kill _all_ buffers, dirty or not.. */
static void kill_bdev(struct block_device *bdev)
{
	invalidate_bdev(bdev, 1);
	truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
}	

So hopefully I can just invalidate the block device when I need to.

-Dave

             reply	other threads:[~2003-02-06  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-06  2:35 David Ashley [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-02-04  4:57 Block device invalidate cached blocks David Ashley

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=200302060235.h162ZeP04153@xdr.com \
    --to=dash@xdr.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