Re: [PATCH V8 4/8] mm/fs: add hooks to support cleancache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

On Fri, Apr 15, 2011 at 6:17 AM, Dan Magenheimer
<dan.magenheimer@xxxxxxxxxx> wrote:
> [PATCH V8 4/8] mm/fs: add hooks to support cleancache
>
> This fourth patch of eight in this cleancache series provides the
> core hooks in VFS for: initializing cleancache per filesystem;
> capturing clean pages reclaimed by page cache; attempting to get
> pages from cleancache before filesystem read; and ensuring coherency
> between pagecache, disk, and cleancache. ÂNote that the placement
> of these hooks was stable from 2.6.18 to 2.6.38; a minor semantic
> change was required due to a patchset in 2.6.39.
>
> All hooks become no-ops if CONFIG_CLEANCACHE is unset, or become
> a check of a boolean global if CONFIG_CLEANCACHE is set but no
> cleancache "backend" has claimed cleancache_ops.
>
> Details and a FAQ can be found in Documentation/vm/cleancache.txt
>
> [v8: minchan.kim@xxxxxxxxx: adapt to new remove_from_page_cache function]
> Signed-off-by: Chris Mason <chris.mason@xxxxxxxxxx>
> Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
> Reviewed-by: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> Cc: Matthew Wilcox <matthew@xxxxxx>
> Cc: Nick Piggin <npiggin@xxxxxxxxx>
> Cc: Mel Gorman <mel@xxxxxxxxx>
> Cc: Rik Van Riel <riel@xxxxxxxxxx>
> Cc: Jan Beulich <JBeulich@xxxxxxxxxx>
> Cc: Andreas Dilger <adilger@xxxxxxx>
> Cc: Ted Ts'o <tytso@xxxxxxx>
> Cc: Mark Fasheh <mfasheh@xxxxxxxx>
> Cc: Joel Becker <joel.becker@xxxxxxxxxx>
> Cc: Nitin Gupta <ngupta@xxxxxxxxxx>
>
> ---
>
> Diffstat:
> Âfs/buffer.c               Â|  Â5 +++++
> Âfs/mpage.c                |  Â7 +++++++
> Âfs/super.c                |  Â3 +++
> Âmm/filemap.c               |  11 +++++++++++
> Âmm/truncate.c              Â|  Â6 ++++++
> Â5 files changed, 32 insertions(+)
>
> --- linux-2.6.39-rc3/fs/super.c 2011-04-11 18:21:51.000000000 -0600
> +++ linux-2.6.39-rc3-cleancache/fs/super.c   Â2011-04-13 17:08:09.175853426 -0600
> @@ -31,6 +31,7 @@
> Â#include <linux/mutex.h>
> Â#include <linux/backing-dev.h>
> Â#include <linux/rculist_bl.h>
> +#include <linux/cleancache.h>
> Â#include "internal.h"
>
>
> @@ -112,6 +113,7 @@ static struct super_block *alloc_super(s
> Â Â Â Â Â Â Â Âs->s_maxbytes = MAX_NON_LFS;
> Â Â Â Â Â Â Â Âs->s_op = &default_op;
> Â Â Â Â Â Â Â Âs->s_time_gran = 1000000000;
> + Â Â Â Â Â Â Â s->cleancache_poolid = -1;
> Â Â Â Â}
> Âout:
> Â Â Â Âreturn s;
> @@ -177,6 +179,7 @@ void deactivate_locked_super(struct supe
> Â{
> Â Â Â Âstruct file_system_type *fs = s->s_type;
> Â Â Â Âif (atomic_dec_and_test(&s->s_active)) {
> + Â Â Â Â Â Â Â cleancache_flush_fs(s);
> Â Â Â Â Â Â Â Âfs->kill_sb(s);
> Â Â Â Â Â Â Â Â/*
> Â Â Â Â Â Â Â Â * We need to call rcu_barrier so all the delayed rcu free
> --- linux-2.6.39-rc3/fs/buffer.c    Â2011-04-11 18:21:51.000000000 -0600
> +++ linux-2.6.39-rc3-cleancache/fs/buffer.c   2011-04-13 17:07:24.700917174 -0600
> @@ -41,6 +41,7 @@
> Â#include <linux/bitops.h>
> Â#include <linux/mpage.h>
> Â#include <linux/bit_spinlock.h>
> +#include <linux/cleancache.h>
>
> Âstatic int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
>
> @@ -269,6 +270,10 @@ void invalidate_bdev(struct block_device
> Â Â Â Âinvalidate_bh_lrus();
> Â Â Â Âlru_add_drain_all(); Â Â/* make sure all lru add caches are flushed */
> Â Â Â Âinvalidate_mapping_pages(mapping, 0, -1);
> + Â Â Â /* 99% of the time, we don't need to flush the cleancache on the bdev.
> + Â Â Â Â* But, for the strange corners, lets be cautious
> + Â Â Â Â*/
> + Â Â Â cleancache_flush_inode(mapping);
> Â}
> ÂEXPORT_SYMBOL(invalidate_bdev);
>
> --- linux-2.6.39-rc3/fs/mpage.c 2011-04-11 18:21:51.000000000 -0600
> +++ linux-2.6.39-rc3-cleancache/fs/mpage.c   Â2011-04-13 17:07:24.706913410 -0600
> @@ -27,6 +27,7 @@
> Â#include <linux/writeback.h>
> Â#include <linux/backing-dev.h>
> Â#include <linux/pagevec.h>
> +#include <linux/cleancache.h>
>
> Â/*
> Â* I/O completion handler for multipage BIOs.
> @@ -271,6 +272,12 @@ do_mpage_readpage(struct bio *bio, struc
> Â Â Â Â Â Â Â ÂSetPageMappedToDisk(page);
> Â Â Â Â}
>
> + Â Â Â if (fully_mapped && blocks_per_page == 1 && !PageUptodate(page) &&
> + Â Â Â Â Â cleancache_get_page(page) == 0) {
> + Â Â Â Â Â Â Â SetPageUptodate(page);
> + Â Â Â Â Â Â Â goto confused;
> + Â Â Â }
> +
> Â Â Â Â/*
> Â Â Â Â * This page will go to BIO. ÂDo we need to send this BIO off first?
> Â Â Â Â */
> --- linux-2.6.39-rc3/mm/filemap.c    2011-04-11 18:21:51.000000000 -0600
> +++ linux-2.6.39-rc3-cleancache/mm/filemap.c  Â2011-04-13 17:09:46.367852002 -0600
> @@ -34,6 +34,7 @@
> Â#include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */
> Â#include <linux/memcontrol.h>
> Â#include <linux/mm_inline.h> /* for page_is_file_cache() */
> +#include <linux/cleancache.h>
> Â#include "internal.h"
>
> Â/*
> @@ -118,6 +119,16 @@ void __delete_from_page_cache(struct pag
> Â{
> Â Â Â Âstruct address_space *mapping = page->mapping;
>
> + Â Â Â /*
> + Â Â Â Â* if we're uptodate, flush out into the cleancache, otherwise
> + Â Â Â Â* invalidate any existing cleancache entries. ÂWe can't leave
> + Â Â Â Â* stale data around in the cleancache once our page is gone
> + Â Â Â Â*/
> + Â Â Â if (PageUptodate(page) && PageMappedToDisk(page))
> + Â Â Â Â Â Â Â cleancache_put_page(page);
> + Â Â Â else
> + Â Â Â Â Â Â Â cleancache_flush_page(mapping, page);
> +

First of all, thanks for resolving conflict with my patch.

Before I suggested a thing about cleancache_flush_page, cleancache_flush_inode.

what's the meaning of flush's semantic?
I thought it means invalidation.
AFAIC, how about change flush with invalidate?


-- 
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux