diff options
-rw-r--r-- | fs/ext4/Makefile | 3 | ||||
-rw-r--r-- | fs/ext4/ext4_jbd2.c | 59 | ||||
-rw-r--r-- | include/linux/ext4_jbd2.h | 76 |
3 files changed, 78 insertions, 60 deletions
diff --git a/fs/ext4/Makefile b/fs/ext4/Makefile index a6acb96ebeb9..ae6e7e502ac9 100644 --- a/fs/ext4/Makefile +++ b/fs/ext4/Makefile | |||
@@ -5,7 +5,8 @@ | |||
5 | obj-$(CONFIG_EXT4DEV_FS) += ext4dev.o | 5 | obj-$(CONFIG_EXT4DEV_FS) += ext4dev.o |
6 | 6 | ||
7 | ext4dev-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ | 7 | ext4dev-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 extents.o | 8 | ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o \ |
9 | ext4_jbd2.o | ||
9 | 10 | ||
10 | ext4dev-$(CONFIG_EXT4DEV_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o | 11 | ext4dev-$(CONFIG_EXT4DEV_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o |
11 | ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL) += acl.o | 12 | ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL) += acl.o |
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c new file mode 100644 index 000000000000..d6afe4e27340 --- /dev/null +++ b/fs/ext4/ext4_jbd2.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * Interface between ext4 and JBD | ||
3 | */ | ||
4 | |||
5 | #include <linux/ext4_jbd2.h> | ||
6 | |||
7 | int __ext4_journal_get_undo_access(const char *where, handle_t *handle, | ||
8 | struct buffer_head *bh) | ||
9 | { | ||
10 | int err = jbd2_journal_get_undo_access(handle, bh); | ||
11 | if (err) | ||
12 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
13 | return err; | ||
14 | } | ||
15 | |||
16 | int __ext4_journal_get_write_access(const char *where, handle_t *handle, | ||
17 | struct buffer_head *bh) | ||
18 | { | ||
19 | int err = jbd2_journal_get_write_access(handle, bh); | ||
20 | if (err) | ||
21 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
22 | return err; | ||
23 | } | ||
24 | |||
25 | int __ext4_journal_forget(const char *where, handle_t *handle, | ||
26 | struct buffer_head *bh) | ||
27 | { | ||
28 | int err = jbd2_journal_forget(handle, bh); | ||
29 | if (err) | ||
30 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
31 | return err; | ||
32 | } | ||
33 | |||
34 | int __ext4_journal_revoke(const char *where, handle_t *handle, | ||
35 | ext4_fsblk_t blocknr, struct buffer_head *bh) | ||
36 | { | ||
37 | int err = jbd2_journal_revoke(handle, blocknr, bh); | ||
38 | if (err) | ||
39 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
40 | return err; | ||
41 | } | ||
42 | |||
43 | int __ext4_journal_get_create_access(const char *where, | ||
44 | handle_t *handle, struct buffer_head *bh) | ||
45 | { | ||
46 | int err = jbd2_journal_get_create_access(handle, bh); | ||
47 | if (err) | ||
48 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
49 | return err; | ||
50 | } | ||
51 | |||
52 | int __ext4_journal_dirty_metadata(const char *where, | ||
53 | handle_t *handle, struct buffer_head *bh) | ||
54 | { | ||
55 | int err = jbd2_journal_dirty_metadata(handle, bh); | ||
56 | if (err) | ||
57 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
58 | return err; | ||
59 | } | ||
diff --git a/include/linux/ext4_jbd2.h b/include/linux/ext4_jbd2.h index 72dd631912e4..d716e6392cf6 100644 --- a/include/linux/ext4_jbd2.h +++ b/include/linux/ext4_jbd2.h | |||
@@ -114,74 +114,32 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode); | |||
114 | * been done yet. | 114 | * been done yet. |
115 | */ | 115 | */ |
116 | 116 | ||
117 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, | 117 | static inline void ext4_journal_release_buffer(handle_t *handle, |
118 | struct buffer_head *bh, handle_t *handle, int err); | 118 | struct buffer_head *bh) |
119 | |||
120 | static inline int | ||
121 | __ext4_journal_get_undo_access(const char *where, handle_t *handle, | ||
122 | struct buffer_head *bh) | ||
123 | { | 119 | { |
124 | int err = jbd2_journal_get_undo_access(handle, bh); | 120 | jbd2_journal_release_buffer(handle, bh); |
125 | if (err) | ||
126 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
127 | return err; | ||
128 | } | 121 | } |
129 | 122 | ||
130 | static inline int | 123 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, |
131 | __ext4_journal_get_write_access(const char *where, handle_t *handle, | 124 | struct buffer_head *bh, handle_t *handle, int err); |
132 | struct buffer_head *bh) | ||
133 | { | ||
134 | int err = jbd2_journal_get_write_access(handle, bh); | ||
135 | if (err) | ||
136 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
137 | return err; | ||
138 | } | ||
139 | 125 | ||
140 | static inline void | 126 | int __ext4_journal_get_undo_access(const char *where, handle_t *handle, |
141 | ext4_journal_release_buffer(handle_t *handle, struct buffer_head *bh) | 127 | struct buffer_head *bh); |
142 | { | ||
143 | jbd2_journal_release_buffer(handle, bh); | ||
144 | } | ||
145 | 128 | ||
146 | static inline int | 129 | int __ext4_journal_get_write_access(const char *where, handle_t *handle, |
147 | __ext4_journal_forget(const char *where, handle_t *handle, struct buffer_head *bh) | 130 | struct buffer_head *bh); |
148 | { | ||
149 | int err = jbd2_journal_forget(handle, bh); | ||
150 | if (err) | ||
151 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
152 | return err; | ||
153 | } | ||
154 | 131 | ||
155 | static inline int | 132 | int __ext4_journal_forget(const char *where, handle_t *handle, |
156 | __ext4_journal_revoke(const char *where, handle_t *handle, | 133 | struct buffer_head *bh); |
157 | ext4_fsblk_t blocknr, struct buffer_head *bh) | ||
158 | { | ||
159 | int err = jbd2_journal_revoke(handle, blocknr, bh); | ||
160 | if (err) | ||
161 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
162 | return err; | ||
163 | } | ||
164 | 134 | ||
165 | static inline int | 135 | int __ext4_journal_revoke(const char *where, handle_t *handle, |
166 | __ext4_journal_get_create_access(const char *where, | 136 | ext4_fsblk_t blocknr, struct buffer_head *bh); |
167 | handle_t *handle, struct buffer_head *bh) | ||
168 | { | ||
169 | int err = jbd2_journal_get_create_access(handle, bh); | ||
170 | if (err) | ||
171 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
172 | return err; | ||
173 | } | ||
174 | 137 | ||
175 | static inline int | 138 | int __ext4_journal_get_create_access(const char *where, |
176 | __ext4_journal_dirty_metadata(const char *where, | 139 | handle_t *handle, struct buffer_head *bh); |
177 | handle_t *handle, struct buffer_head *bh) | ||
178 | { | ||
179 | int err = jbd2_journal_dirty_metadata(handle, bh); | ||
180 | if (err) | ||
181 | ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | ||
182 | return err; | ||
183 | } | ||
184 | 140 | ||
141 | int __ext4_journal_dirty_metadata(const char *where, | ||
142 | handle_t *handle, struct buffer_head *bh); | ||
185 | 143 | ||
186 | #define ext4_journal_get_undo_access(handle, bh) \ | 144 | #define ext4_journal_get_undo_access(handle, bh) \ |
187 | __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh)) | 145 | __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh)) |