]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.suse/ocfs2-Add-helper-function-in-uptodate.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.suse / ocfs2-Add-helper-function-in-uptodate.patch
CommitLineData
2cb7cef9
BS
1From: Tao Ma <tao.ma@oracle.com>
2Subject: [PATCH 06/16] ocfs2: Add helper function in uptodate.c for removing xattr clusters
3Patch-mainline: 2.6.28?
4References: FATE302067
5
6The old uptodate only handles the issue of removing one buffer_head from
7ocfs2 inode's buffer cache. With xattr clusters, we may need to remove
8multiple buffer_head's at a time.
9
10Signed-off-by: Tao Ma <tao.ma@oracle.com>
11Signed-off-by: Mark Fasheh <mfasheh@suse.com>
12---
13 fs/ocfs2/uptodate.c | 32 ++++++++++++++++++++++++++------
14 fs/ocfs2/uptodate.h | 3 +++
15 2 files changed, 29 insertions(+), 6 deletions(-)
16
17diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
18index 4da8851..e26459e 100644
19--- a/fs/ocfs2/uptodate.c
20+++ b/fs/ocfs2/uptodate.c
21@@ -511,14 +511,10 @@ static void ocfs2_remove_metadata_tree(struct ocfs2_caching_info *ci,
22 ci->ci_num_cached--;
23 }
24
25-/* Called when we remove a chunk of metadata from an inode. We don't
26- * bother reverting things to an inlined array in the case of a remove
27- * which moves us back under the limit. */
28-void ocfs2_remove_from_cache(struct inode *inode,
29- struct buffer_head *bh)
30+static void ocfs2_remove_block_from_cache(struct inode *inode,
31+ sector_t block)
32 {
33 int index;
34- sector_t block = bh->b_blocknr;
35 struct ocfs2_meta_cache_item *item = NULL;
36 struct ocfs2_inode_info *oi = OCFS2_I(inode);
37 struct ocfs2_caching_info *ci = &oi->ip_metadata_cache;
38@@ -544,6 +540,30 @@ void ocfs2_remove_from_cache(struct inode *inode,
39 kmem_cache_free(ocfs2_uptodate_cachep, item);
40 }
41
42+/*
43+ * Called when we remove a chunk of metadata from an inode. We don't
44+ * bother reverting things to an inlined array in the case of a remove
45+ * which moves us back under the limit.
46+ */
47+void ocfs2_remove_from_cache(struct inode *inode,
48+ struct buffer_head *bh)
49+{
50+ sector_t block = bh->b_blocknr;
51+
52+ ocfs2_remove_block_from_cache(inode, block);
53+}
54+
55+/* Called when we remove xattr clusters from an inode. */
56+void ocfs2_remove_xattr_clusters_from_cache(struct inode *inode,
57+ sector_t block,
58+ u32 c_len)
59+{
60+ u64 i, b_len = ocfs2_clusters_to_blocks(inode->i_sb, 1) * c_len;
61+
62+ for (i = 0; i < b_len; i++, block++)
63+ ocfs2_remove_block_from_cache(inode, block);
64+}
65+
66 int __init init_ocfs2_uptodate_cache(void)
67 {
68 ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate",
69diff --git a/fs/ocfs2/uptodate.h b/fs/ocfs2/uptodate.h
70index 2e73206..531b4b3 100644
71--- a/fs/ocfs2/uptodate.h
72+++ b/fs/ocfs2/uptodate.h
73@@ -40,6 +40,9 @@ void ocfs2_set_new_buffer_uptodate(struct inode *inode,
74 struct buffer_head *bh);
75 void ocfs2_remove_from_cache(struct inode *inode,
76 struct buffer_head *bh);
77+void ocfs2_remove_xattr_clusters_from_cache(struct inode *inode,
78+ sector_t block,
79+ u32 c_len);
80 int ocfs2_buffer_read_ahead(struct inode *inode,
81 struct buffer_head *bh);
82
83--
841.5.4.5
85