aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDan Magenheimer <dan.magenheimer@oracle.com>2011-05-26 12:01:56 -0400
committerDan Magenheimer <dan.magenheimer@oracle.com>2011-05-26 12:01:56 -0400
commit90a887c9a2e25bcb1fc658fad59dfbc6fb792734 (patch)
tree4f6ac7e5a92d503a573b5fcf1893623818f6794d /fs
parentd71bc6db5e48066bde78a480bb9e3057b3db1a3c (diff)
btrfs: add cleancache support
This sixth patch of eight in this cleancache series "opts-in" cleancache for btrfs. Filesystems must explicitly enable cleancache by calling cleancache_init_fs anytime an instance of the filesystem is mounted. Btrfs uses its own readpage which must be hooked, but all other cleancache hooks are in the VFS layer including the matching cleancache_flush_fs hook which must be called on unmount. Details and a FAQ can be found in Documentation/vm/cleancache.txt [v6-v8: no changes] [v5: jeremy@goop.org: simplify init hook and any future fs init changes] Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com> Reviewed-by: Jeremy Fitzhardinge <jeremy@goop.org> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Matthew Wilcox <matthew@wil.cx> Cc: Nick Piggin <npiggin@kernel.dk> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Rik Van Riel <riel@redhat.com> Cc: Jan Beulich <JBeulich@novell.com> Cc: Andreas Dilger <adilger@sun.com> Cc: Ted Ts'o <tytso@mit.edu> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <joel.becker@oracle.com> Cc: Nitin Gupta <ngupta@vflare.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent_io.c9
-rw-r--r--fs/btrfs/super.c2
2 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index ba41da59e31b..0cee46e01081 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -10,6 +10,7 @@
10#include <linux/swap.h> 10#include <linux/swap.h>
11#include <linux/writeback.h> 11#include <linux/writeback.h>
12#include <linux/pagevec.h> 12#include <linux/pagevec.h>
13#include <linux/cleancache.h>
13#include "extent_io.h" 14#include "extent_io.h"
14#include "extent_map.h" 15#include "extent_map.h"
15#include "compat.h" 16#include "compat.h"
@@ -2015,6 +2016,13 @@ static int __extent_read_full_page(struct extent_io_tree *tree,
2015 2016
2016 set_page_extent_mapped(page); 2017 set_page_extent_mapped(page);
2017 2018
2019 if (!PageUptodate(page)) {
2020 if (cleancache_get_page(page) == 0) {
2021 BUG_ON(blocksize != PAGE_SIZE);
2022 goto out;
2023 }
2024 }
2025
2018 end = page_end; 2026 end = page_end;
2019 while (1) { 2027 while (1) {
2020 lock_extent(tree, start, end, GFP_NOFS); 2028 lock_extent(tree, start, end, GFP_NOFS);
@@ -2148,6 +2156,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree,
2148 cur = cur + iosize; 2156 cur = cur + iosize;
2149 page_offset += iosize; 2157 page_offset += iosize;
2150 } 2158 }
2159out:
2151 if (!nr) { 2160 if (!nr) {
2152 if (!PageError(page)) 2161 if (!PageError(page))
2153 SetPageUptodate(page); 2162 SetPageUptodate(page);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0ac712efcdf2..be4ffa12f3ef 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -39,6 +39,7 @@
39#include <linux/miscdevice.h> 39#include <linux/miscdevice.h>
40#include <linux/magic.h> 40#include <linux/magic.h>
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <linux/cleancache.h>
42#include "compat.h" 43#include "compat.h"
43#include "ctree.h" 44#include "ctree.h"
44#include "disk-io.h" 45#include "disk-io.h"
@@ -624,6 +625,7 @@ static int btrfs_fill_super(struct super_block *sb,
624 sb->s_root = root_dentry; 625 sb->s_root = root_dentry;
625 626
626 save_mount_options(sb, data); 627 save_mount_options(sb, data);
628 cleancache_init_fs(sb);
627 return 0; 629 return 0;
628 630
629fail_close: 631fail_close: