aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ext4_jbd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ext4_jbd.h')
-rw-r--r--include/linux/ext4_jbd.h160
1 files changed, 80 insertions, 80 deletions
diff --git a/include/linux/ext4_jbd.h b/include/linux/ext4_jbd.h
index ce0e6109aff..3dbf6c77903 100644
--- a/include/linux/ext4_jbd.h
+++ b/include/linux/ext4_jbd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/linux/ext3_jbd.h 2 * linux/include/linux/ext4_jbd.h
3 * 3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999
5 * 5 *
@@ -9,17 +9,17 @@
9 * the terms of the GNU General Public License, version 2, or at your 9 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference. 10 * option, any later version, incorporated herein by reference.
11 * 11 *
12 * Ext3-specific journaling extensions. 12 * Ext4-specific journaling extensions.
13 */ 13 */
14 14
15#ifndef _LINUX_EXT3_JBD_H 15#ifndef _LINUX_EXT4_JBD_H
16#define _LINUX_EXT3_JBD_H 16#define _LINUX_EXT4_JBD_H
17 17
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/jbd.h> 19#include <linux/jbd.h>
20#include <linux/ext3_fs.h> 20#include <linux/ext4_fs.h>
21 21
22#define EXT3_JOURNAL(inode) (EXT3_SB((inode)->i_sb)->s_journal) 22#define EXT4_JOURNAL(inode) (EXT4_SB((inode)->i_sb)->s_journal)
23 23
24/* Define the number of blocks we need to account to a transaction to 24/* Define the number of blocks we need to account to a transaction to
25 * modify one block of data. 25 * modify one block of data.
@@ -28,13 +28,13 @@
28 * indirection blocks, the group and superblock summaries, and the data 28 * indirection blocks, the group and superblock summaries, and the data
29 * block to complete the transaction. */ 29 * block to complete the transaction. */
30 30
31#define EXT3_SINGLEDATA_TRANS_BLOCKS 8U 31#define EXT4_SINGLEDATA_TRANS_BLOCKS 8U
32 32
33/* Extended attribute operations touch at most two data buffers, 33/* Extended attribute operations touch at most two data buffers,
34 * two bitmap buffers, and two group summaries, in addition to the inode 34 * two bitmap buffers, and two group summaries, in addition to the inode
35 * and the superblock, which are already accounted for. */ 35 * and the superblock, which are already accounted for. */
36 36
37#define EXT3_XATTR_TRANS_BLOCKS 6U 37#define EXT4_XATTR_TRANS_BLOCKS 6U
38 38
39/* Define the minimum size for a transaction which modifies data. This 39/* Define the minimum size for a transaction which modifies data. This
40 * needs to take into account the fact that we may end up modifying two 40 * needs to take into account the fact that we may end up modifying two
@@ -42,15 +42,15 @@
42 * superblock only gets updated once, of course, so don't bother 42 * superblock only gets updated once, of course, so don't bother
43 * counting that again for the quota updates. */ 43 * counting that again for the quota updates. */
44 44
45#define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ 45#define EXT4_DATA_TRANS_BLOCKS(sb) (EXT4_SINGLEDATA_TRANS_BLOCKS + \
46 EXT3_XATTR_TRANS_BLOCKS - 2 + \ 46 EXT4_XATTR_TRANS_BLOCKS - 2 + \
47 2*EXT3_QUOTA_TRANS_BLOCKS(sb)) 47 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
48 48
49/* Delete operations potentially hit one directory's namespace plus an 49/* Delete operations potentially hit one directory's namespace plus an
50 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be 50 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
51 * generous. We can grow the delete transaction later if necessary. */ 51 * generous. We can grow the delete transaction later if necessary. */
52 52
53#define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64) 53#define EXT4_DELETE_TRANS_BLOCKS(sb) (2 * EXT4_DATA_TRANS_BLOCKS(sb) + 64)
54 54
55/* Define an arbitrary limit for the amount of data we will anticipate 55/* Define an arbitrary limit for the amount of data we will anticipate
56 * writing to any given transaction. For unbounded transactions such as 56 * writing to any given transaction. For unbounded transactions such as
@@ -58,7 +58,7 @@
58 * start off at the maximum transaction size and grow the transaction 58 * start off at the maximum transaction size and grow the transaction
59 * optimistically as we go. */ 59 * optimistically as we go. */
60 60
61#define EXT3_MAX_TRANS_DATA 64U 61#define EXT4_MAX_TRANS_DATA 64U
62 62
63/* We break up a large truncate or write transaction once the handle's 63/* We break up a large truncate or write transaction once the handle's
64 * buffer credits gets this low, we need either to extend the 64 * buffer credits gets this low, we need either to extend the
@@ -67,202 +67,202 @@
67 * one block, plus two quota updates. Quota allocations are not 67 * one block, plus two quota updates. Quota allocations are not
68 * needed. */ 68 * needed. */
69 69
70#define EXT3_RESERVE_TRANS_BLOCKS 12U 70#define EXT4_RESERVE_TRANS_BLOCKS 12U
71 71
72#define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8 72#define EXT4_INDEX_EXTRA_TRANS_BLOCKS 8
73 73
74#ifdef CONFIG_QUOTA 74#ifdef CONFIG_QUOTA
75/* Amount of blocks needed for quota update - we know that the structure was 75/* Amount of blocks needed for quota update - we know that the structure was
76 * allocated so we need to update only inode+data */ 76 * allocated so we need to update only inode+data */
77#define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) 77#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0)
78/* Amount of blocks needed for quota insert/delete - we do some block writes 78/* Amount of blocks needed for quota insert/delete - we do some block writes
79 * but inode, sb and group updates are done only once */ 79 * but inode, sb and group updates are done only once */
80#define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ 80#define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
81 (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0) 81 (EXT4_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0)
82#define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\ 82#define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
83 (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0) 83 (EXT4_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0)
84#else 84#else
85#define EXT3_QUOTA_TRANS_BLOCKS(sb) 0 85#define EXT4_QUOTA_TRANS_BLOCKS(sb) 0
86#define EXT3_QUOTA_INIT_BLOCKS(sb) 0 86#define EXT4_QUOTA_INIT_BLOCKS(sb) 0
87#define EXT3_QUOTA_DEL_BLOCKS(sb) 0 87#define EXT4_QUOTA_DEL_BLOCKS(sb) 0
88#endif 88#endif
89 89
90int 90int
91ext3_mark_iloc_dirty(handle_t *handle, 91ext4_mark_iloc_dirty(handle_t *handle,
92 struct inode *inode, 92 struct inode *inode,
93 struct ext3_iloc *iloc); 93 struct ext4_iloc *iloc);
94 94
95/* 95/*
96 * On success, We end up with an outstanding reference count against 96 * On success, We end up with an outstanding reference count against
97 * iloc->bh. This _must_ be cleaned up later. 97 * iloc->bh. This _must_ be cleaned up later.
98 */ 98 */
99 99
100int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, 100int ext4_reserve_inode_write(handle_t *handle, struct inode *inode,
101 struct ext3_iloc *iloc); 101 struct ext4_iloc *iloc);
102 102
103int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); 103int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode);
104 104
105/* 105/*
106 * Wrapper functions with which ext3 calls into JBD. The intent here is 106 * Wrapper functions with which ext4 calls into JBD. The intent here is
107 * to allow these to be turned into appropriate stubs so ext3 can control 107 * to allow these to be turned into appropriate stubs so ext4 can control
108 * ext2 filesystems, so ext2+ext3 systems only nee one fs. This work hasn't 108 * ext2 filesystems, so ext2+ext4 systems only nee one fs. This work hasn't
109 * been done yet. 109 * been done yet.
110 */ 110 */
111 111
112void ext3_journal_abort_handle(const char *caller, const char *err_fn, 112void ext4_journal_abort_handle(const char *caller, const char *err_fn,
113 struct buffer_head *bh, handle_t *handle, int err); 113 struct buffer_head *bh, handle_t *handle, int err);
114 114
115static inline int 115static inline int
116__ext3_journal_get_undo_access(const char *where, handle_t *handle, 116__ext4_journal_get_undo_access(const char *where, handle_t *handle,
117 struct buffer_head *bh) 117 struct buffer_head *bh)
118{ 118{
119 int err = journal_get_undo_access(handle, bh); 119 int err = journal_get_undo_access(handle, bh);
120 if (err) 120 if (err)
121 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 121 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
122 return err; 122 return err;
123} 123}
124 124
125static inline int 125static inline int
126__ext3_journal_get_write_access(const char *where, handle_t *handle, 126__ext4_journal_get_write_access(const char *where, handle_t *handle,
127 struct buffer_head *bh) 127 struct buffer_head *bh)
128{ 128{
129 int err = journal_get_write_access(handle, bh); 129 int err = journal_get_write_access(handle, bh);
130 if (err) 130 if (err)
131 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 131 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
132 return err; 132 return err;
133} 133}
134 134
135static inline void 135static inline void
136ext3_journal_release_buffer(handle_t *handle, struct buffer_head *bh) 136ext4_journal_release_buffer(handle_t *handle, struct buffer_head *bh)
137{ 137{
138 journal_release_buffer(handle, bh); 138 journal_release_buffer(handle, bh);
139} 139}
140 140
141static inline int 141static inline int
142__ext3_journal_forget(const char *where, handle_t *handle, struct buffer_head *bh) 142__ext4_journal_forget(const char *where, handle_t *handle, struct buffer_head *bh)
143{ 143{
144 int err = journal_forget(handle, bh); 144 int err = journal_forget(handle, bh);
145 if (err) 145 if (err)
146 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 146 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
147 return err; 147 return err;
148} 148}
149 149
150static inline int 150static inline int
151__ext3_journal_revoke(const char *where, handle_t *handle, 151__ext4_journal_revoke(const char *where, handle_t *handle,
152 unsigned long blocknr, struct buffer_head *bh) 152 unsigned long blocknr, struct buffer_head *bh)
153{ 153{
154 int err = journal_revoke(handle, blocknr, bh); 154 int err = journal_revoke(handle, blocknr, bh);
155 if (err) 155 if (err)
156 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 156 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
157 return err; 157 return err;
158} 158}
159 159
160static inline int 160static inline int
161__ext3_journal_get_create_access(const char *where, 161__ext4_journal_get_create_access(const char *where,
162 handle_t *handle, struct buffer_head *bh) 162 handle_t *handle, struct buffer_head *bh)
163{ 163{
164 int err = journal_get_create_access(handle, bh); 164 int err = journal_get_create_access(handle, bh);
165 if (err) 165 if (err)
166 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 166 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
167 return err; 167 return err;
168} 168}
169 169
170static inline int 170static inline int
171__ext3_journal_dirty_metadata(const char *where, 171__ext4_journal_dirty_metadata(const char *where,
172 handle_t *handle, struct buffer_head *bh) 172 handle_t *handle, struct buffer_head *bh)
173{ 173{
174 int err = journal_dirty_metadata(handle, bh); 174 int err = journal_dirty_metadata(handle, bh);
175 if (err) 175 if (err)
176 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 176 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
177 return err; 177 return err;
178} 178}
179 179
180 180
181#define ext3_journal_get_undo_access(handle, bh) \ 181#define ext4_journal_get_undo_access(handle, bh) \
182 __ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh)) 182 __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh))
183#define ext3_journal_get_write_access(handle, bh) \ 183#define ext4_journal_get_write_access(handle, bh) \
184 __ext3_journal_get_write_access(__FUNCTION__, (handle), (bh)) 184 __ext4_journal_get_write_access(__FUNCTION__, (handle), (bh))
185#define ext3_journal_revoke(handle, blocknr, bh) \ 185#define ext4_journal_revoke(handle, blocknr, bh) \
186 __ext3_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh)) 186 __ext4_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh))
187#define ext3_journal_get_create_access(handle, bh) \ 187#define ext4_journal_get_create_access(handle, bh) \
188 __ext3_journal_get_create_access(__FUNCTION__, (handle), (bh)) 188 __ext4_journal_get_create_access(__FUNCTION__, (handle), (bh))
189#define ext3_journal_dirty_metadata(handle, bh) \ 189#define ext4_journal_dirty_metadata(handle, bh) \
190 __ext3_journal_dirty_metadata(__FUNCTION__, (handle), (bh)) 190 __ext4_journal_dirty_metadata(__FUNCTION__, (handle), (bh))
191#define ext3_journal_forget(handle, bh) \ 191#define ext4_journal_forget(handle, bh) \
192 __ext3_journal_forget(__FUNCTION__, (handle), (bh)) 192 __ext4_journal_forget(__FUNCTION__, (handle), (bh))
193 193
194int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); 194int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh);
195 195
196handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks); 196handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
197int __ext3_journal_stop(const char *where, handle_t *handle); 197int __ext4_journal_stop(const char *where, handle_t *handle);
198 198
199static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks) 199static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks)
200{ 200{
201 return ext3_journal_start_sb(inode->i_sb, nblocks); 201 return ext4_journal_start_sb(inode->i_sb, nblocks);
202} 202}
203 203
204#define ext3_journal_stop(handle) \ 204#define ext4_journal_stop(handle) \
205 __ext3_journal_stop(__FUNCTION__, (handle)) 205 __ext4_journal_stop(__FUNCTION__, (handle))
206 206
207static inline handle_t *ext3_journal_current_handle(void) 207static inline handle_t *ext4_journal_current_handle(void)
208{ 208{
209 return journal_current_handle(); 209 return journal_current_handle();
210} 210}
211 211
212static inline int ext3_journal_extend(handle_t *handle, int nblocks) 212static inline int ext4_journal_extend(handle_t *handle, int nblocks)
213{ 213{
214 return journal_extend(handle, nblocks); 214 return journal_extend(handle, nblocks);
215} 215}
216 216
217static inline int ext3_journal_restart(handle_t *handle, int nblocks) 217static inline int ext4_journal_restart(handle_t *handle, int nblocks)
218{ 218{
219 return journal_restart(handle, nblocks); 219 return journal_restart(handle, nblocks);
220} 220}
221 221
222static inline int ext3_journal_blocks_per_page(struct inode *inode) 222static inline int ext4_journal_blocks_per_page(struct inode *inode)
223{ 223{
224 return journal_blocks_per_page(inode); 224 return journal_blocks_per_page(inode);
225} 225}
226 226
227static inline int ext3_journal_force_commit(journal_t *journal) 227static inline int ext4_journal_force_commit(journal_t *journal)
228{ 228{
229 return journal_force_commit(journal); 229 return journal_force_commit(journal);
230} 230}
231 231
232/* super.c */ 232/* super.c */
233int ext3_force_commit(struct super_block *sb); 233int ext4_force_commit(struct super_block *sb);
234 234
235static inline int ext3_should_journal_data(struct inode *inode) 235static inline int ext4_should_journal_data(struct inode *inode)
236{ 236{
237 if (!S_ISREG(inode->i_mode)) 237 if (!S_ISREG(inode->i_mode))
238 return 1; 238 return 1;
239 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) 239 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
240 return 1; 240 return 1;
241 if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) 241 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
242 return 1; 242 return 1;
243 return 0; 243 return 0;
244} 244}
245 245
246static inline int ext3_should_order_data(struct inode *inode) 246static inline int ext4_should_order_data(struct inode *inode)
247{ 247{
248 if (!S_ISREG(inode->i_mode)) 248 if (!S_ISREG(inode->i_mode))
249 return 0; 249 return 0;
250 if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) 250 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
251 return 0; 251 return 0;
252 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) 252 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
253 return 1; 253 return 1;
254 return 0; 254 return 0;
255} 255}
256 256
257static inline int ext3_should_writeback_data(struct inode *inode) 257static inline int ext4_should_writeback_data(struct inode *inode)
258{ 258{
259 if (!S_ISREG(inode->i_mode)) 259 if (!S_ISREG(inode->i_mode))
260 return 0; 260 return 0;
261 if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) 261 if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
262 return 0; 262 return 0;
263 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) 263 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
264 return 1; 264 return 1;
265 return 0; 265 return 0;
266} 266}
267 267
268#endif /* _LINUX_EXT3_JBD_H */ 268#endif /* _LINUX_EXT4_JBD_H */