* Block device invalidate cached blocks
@ 2003-02-04 4:57 David Ashley
0 siblings, 0 replies; 2+ messages in thread
From: David Ashley @ 2003-02-04 4:57 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Block device invalidate cached blocks
@ 2003-02-06 2:35 David Ashley
0 siblings, 0 replies; 2+ messages in thread
From: David Ashley @ 2003-02-06 2:35 UTC (permalink / raw)
To: linux-kernel
>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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-02-06 2:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-06 2:35 Block device invalidate cached blocks David Ashley
-- strict thread matches above, loose matches on Subject: below --
2003-02-04 4:57 David Ashley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox