]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.31/patches.suse/ocfs2-Move-ocfs2_bread-into-dir.c.patch
Move xen patchset to new version's subdir.
[ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.suse / ocfs2-Move-ocfs2_bread-into-dir.c.patch
CommitLineData
00e5a55c
BS
1From: Joel Becker <joel.becker@oracle.com>
2Subject: ocfs2: Move ocfs2_bread() into dir.c
3Patch-mainline: 2.6.28
4
5dir.c is the only place using ocfs2_bread(), so let's make it static to
6that file.
7
8Signed-off-by: Joel Becker <joel.becker@oracle.com>
9Signed-off-by: Mark Fasheh <mfasheh@suse.com>
10---
11 fs/ocfs2/dir.c | 43 +++++++++++++++++++++++++++++++++++++++++++
12 fs/ocfs2/inode.c | 50 --------------------------------------------------
13 fs/ocfs2/inode.h | 2 --
14 3 files changed, 43 insertions(+), 52 deletions(-)
15
16Index: linux-2.6.27/fs/ocfs2/dir.c
17===================================================================
18--- linux-2.6.27.orig/fs/ocfs2/dir.c
19+++ linux-2.6.27/fs/ocfs2/dir.c
20@@ -82,6 +82,49 @@ static int ocfs2_do_extend_dir(struct su
21 struct ocfs2_alloc_context *meta_ac,
22 struct buffer_head **new_bh);
23
24+static struct buffer_head *ocfs2_bread(struct inode *inode,
25+ int block, int *err, int reada)
26+{
27+ struct buffer_head *bh = NULL;
28+ int tmperr;
29+ u64 p_blkno;
30+ int readflags = OCFS2_BH_CACHED;
31+
32+ if (reada)
33+ readflags |= OCFS2_BH_READAHEAD;
34+
35+ if (((u64)block << inode->i_sb->s_blocksize_bits) >=
36+ i_size_read(inode)) {
37+ BUG_ON(!reada);
38+ return NULL;
39+ }
40+
41+ down_read(&OCFS2_I(inode)->ip_alloc_sem);
42+ tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL,
43+ NULL);
44+ up_read(&OCFS2_I(inode)->ip_alloc_sem);
45+ if (tmperr < 0) {
46+ mlog_errno(tmperr);
47+ goto fail;
48+ }
49+
50+ tmperr = ocfs2_read_blocks(inode, p_blkno, 1, &bh, readflags);
51+ if (tmperr < 0)
52+ goto fail;
53+
54+ tmperr = 0;
55+
56+ *err = 0;
57+ return bh;
58+
59+fail:
60+ brelse(bh);
61+ bh = NULL;
62+
63+ *err = -EIO;
64+ return NULL;
65+}
66+
67 /*
68 * bh passed here can be an inode block or a dir data block, depending
69 * on the inode inline data flag.
70Index: linux-2.6.27/fs/ocfs2/inode.c
71===================================================================
72--- linux-2.6.27.orig/fs/ocfs2/inode.c
73+++ linux-2.6.27/fs/ocfs2/inode.c
74@@ -1133,56 +1133,6 @@ void ocfs2_drop_inode(struct inode *inod
75 }
76
77 /*
78- * TODO: this should probably be merged into ocfs2_get_block
79- *
80- * However, you now need to pay attention to the cont_prepare_write()
81- * stuff in ocfs2_get_block (that is, ocfs2_get_block pretty much
82- * expects never to extend).
83- */
84-struct buffer_head *ocfs2_bread(struct inode *inode,
85- int block, int *err, int reada)
86-{
87- struct buffer_head *bh = NULL;
88- int tmperr;
89- u64 p_blkno;
90- int readflags = OCFS2_BH_CACHED;
91-
92- if (reada)
93- readflags |= OCFS2_BH_READAHEAD;
94-
95- if (((u64)block << inode->i_sb->s_blocksize_bits) >=
96- i_size_read(inode)) {
97- BUG_ON(!reada);
98- return NULL;
99- }
100-
101- down_read(&OCFS2_I(inode)->ip_alloc_sem);
102- tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL,
103- NULL);
104- up_read(&OCFS2_I(inode)->ip_alloc_sem);
105- if (tmperr < 0) {
106- mlog_errno(tmperr);
107- goto fail;
108- }
109-
110- tmperr = ocfs2_read_blocks(inode, p_blkno, 1, &bh, readflags);
111- if (tmperr < 0)
112- goto fail;
113-
114- tmperr = 0;
115-
116- *err = 0;
117- return bh;
118-
119-fail:
120- brelse(bh);
121- bh = NULL;
122-
123- *err = -EIO;
124- return NULL;
125-}
126-
127-/*
128 * This is called from our getattr.
129 */
130 int ocfs2_inode_revalidate(struct dentry *dentry)
131Index: linux-2.6.27/fs/ocfs2/inode.h
132===================================================================
133--- linux-2.6.27.orig/fs/ocfs2/inode.h
134+++ linux-2.6.27/fs/ocfs2/inode.h
135@@ -117,8 +117,6 @@ extern struct kmem_cache *ocfs2_inode_ca
136
137 extern const struct address_space_operations ocfs2_aops;
138
139-struct buffer_head *ocfs2_bread(struct inode *inode, int block,
140- int *err, int reada);
141 void ocfs2_clear_inode(struct inode *inode);
142 void ocfs2_delete_inode(struct inode *inode);
143 void ocfs2_drop_inode(struct inode *inode);