aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext3/Makefile2
-rw-r--r--fs/ext3/ext3_jbd.c59
-rw-r--r--include/linux/ext3_jbd.h76
3 files changed, 77 insertions, 60 deletions
diff --git a/fs/ext3/Makefile b/fs/ext3/Makefile
index 704cd44a40c2..e77766a8b3f0 100644
--- a/fs/ext3/Makefile
+++ b/fs/ext3/Makefile
@@ -5,7 +5,7 @@
5obj-$(CONFIG_EXT3_FS) += ext3.o 5obj-$(CONFIG_EXT3_FS) += ext3.o
6 6
7ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ 7ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
8 ioctl.o namei.o super.o symlink.o hash.o resize.o 8 ioctl.o namei.o super.o symlink.o hash.o resize.o ext3_jbd.o
9 9
10ext3-$(CONFIG_EXT3_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o 10ext3-$(CONFIG_EXT3_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
11ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o 11ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
diff --git a/fs/ext3/ext3_jbd.c b/fs/ext3/ext3_jbd.c
new file mode 100644
index 000000000000..e1f91fd26a93
--- /dev/null
+++ b/fs/ext3/ext3_jbd.c
@@ -0,0 +1,59 @@
1/*
2 * Interface between ext3 and JBD
3 */
4
5#include <linux/ext3_jbd.h>
6
7int __ext3_journal_get_undo_access(const char *where, handle_t *handle,
8 struct buffer_head *bh)
9{
10 int err = journal_get_undo_access(handle, bh);
11 if (err)
12 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
13 return err;
14}
15
16int __ext3_journal_get_write_access(const char *where, handle_t *handle,
17 struct buffer_head *bh)
18{
19 int err = journal_get_write_access(handle, bh);
20 if (err)
21 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
22 return err;
23}
24
25int __ext3_journal_forget(const char *where, handle_t *handle,
26 struct buffer_head *bh)
27{
28 int err = journal_forget(handle, bh);
29 if (err)
30 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
31 return err;
32}
33
34int __ext3_journal_revoke(const char *where, handle_t *handle,
35 unsigned long blocknr, struct buffer_head *bh)
36{
37 int err = journal_revoke(handle, blocknr, bh);
38 if (err)
39 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
40 return err;
41}
42
43int __ext3_journal_get_create_access(const char *where,
44 handle_t *handle, struct buffer_head *bh)
45{
46 int err = journal_get_create_access(handle, bh);
47 if (err)
48 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
49 return err;
50}
51
52int __ext3_journal_dirty_metadata(const char *where,
53 handle_t *handle, struct buffer_head *bh)
54{
55 int err = journal_dirty_metadata(handle, bh);
56 if (err)
57 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
58 return err;
59}
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index ce0e6109aff0..8c43b13a02fe 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -109,74 +109,32 @@ int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode);
109 * been done yet. 109 * been done yet.
110 */ 110 */
111 111
112void ext3_journal_abort_handle(const char *caller, const char *err_fn, 112static inline void ext3_journal_release_buffer(handle_t *handle,
113 struct buffer_head *bh, handle_t *handle, int err); 113 struct buffer_head *bh)
114
115static inline int
116__ext3_journal_get_undo_access(const char *where, handle_t *handle,
117 struct buffer_head *bh)
118{ 114{
119 int err = journal_get_undo_access(handle, bh); 115 journal_release_buffer(handle, bh);
120 if (err)
121 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
122 return err;
123} 116}
124 117
125static inline int 118void ext3_journal_abort_handle(const char *caller, const char *err_fn,
126__ext3_journal_get_write_access(const char *where, handle_t *handle, 119 struct buffer_head *bh, handle_t *handle, int err);
127 struct buffer_head *bh)
128{
129 int err = journal_get_write_access(handle, bh);
130 if (err)
131 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
132 return err;
133}
134 120
135static inline void 121int __ext3_journal_get_undo_access(const char *where, handle_t *handle,
136ext3_journal_release_buffer(handle_t *handle, struct buffer_head *bh) 122 struct buffer_head *bh);
137{
138 journal_release_buffer(handle, bh);
139}
140 123
141static inline int 124int __ext3_journal_get_write_access(const char *where, handle_t *handle,
142__ext3_journal_forget(const char *where, handle_t *handle, struct buffer_head *bh) 125 struct buffer_head *bh);
143{
144 int err = journal_forget(handle, bh);
145 if (err)
146 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
147 return err;
148}
149 126
150static inline int 127int __ext3_journal_forget(const char *where, handle_t *handle,
151__ext3_journal_revoke(const char *where, handle_t *handle, 128 struct buffer_head *bh);
152 unsigned long blocknr, struct buffer_head *bh)
153{
154 int err = journal_revoke(handle, blocknr, bh);
155 if (err)
156 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
157 return err;
158}
159 129
160static inline int 130int __ext3_journal_revoke(const char *where, handle_t *handle,
161__ext3_journal_get_create_access(const char *where, 131 unsigned long blocknr, struct buffer_head *bh);
162 handle_t *handle, struct buffer_head *bh)
163{
164 int err = journal_get_create_access(handle, bh);
165 if (err)
166 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
167 return err;
168}
169 132
170static inline int 133int __ext3_journal_get_create_access(const char *where,
171__ext3_journal_dirty_metadata(const char *where, 134 handle_t *handle, struct buffer_head *bh);
172 handle_t *handle, struct buffer_head *bh)
173{
174 int err = journal_dirty_metadata(handle, bh);
175 if (err)
176 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
177 return err;
178}
179 135
136int __ext3_journal_dirty_metadata(const char *where,
137 handle_t *handle, struct buffer_head *bh);
180 138
181#define ext3_journal_get_undo_access(handle, bh) \ 139#define ext3_journal_get_undo_access(handle, bh) \
182 __ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh)) 140 __ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh))