Commit dab291af8d6307a3075c3d67d0cc8f98e646cb94

Authored by Mingming Cao
Committed by Linus Torvalds
1 parent a920e9416b

[PATCH] jbd2: enable building of jbd2 and have ext4 use it rather than jbd

Reworked from a patch by Mingming Cao and Randy Dunlap

Signed-off-By: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 20 changed files with 141 additions and 108 deletions Side-by-side Diff

... ... @@ -143,24 +143,24 @@
143 143 config EXT4DEV_FS
144 144 tristate "Ext4dev/ext4 extended fs support development (EXPERIMENTAL)"
145 145 depends on EXPERIMENTAL
146   - select JBD
147   - help
  146 + select JBD2
  147 + help
148 148 Ext4dev is a predecessor filesystem of the next generation
149 149 extended fs ext4, based on ext3 filesystem code. It will be
150 150 renamed ext4 fs later, once ext4dev is mature and stabilized.
151 151  
152   - Unlike the change from ext2 filesystem to ext3 filesystem,
153   - the on-disk format of ext4dev is not the same as ext3 any more:
  152 + Unlike the change from ext2 filesystem to ext3 filesystem,
  153 + the on-disk format of ext4dev is not the same as ext3 any more:
154 154 it is based on extent maps and it supports 48-bit physical block
155   - numbers. These combined on-disk format changes will allow
  155 + numbers. These combined on-disk format changes will allow
156 156 ext4dev/ext4 to handle more than 16 TB filesystem volumes --
157 157 a hard limit that ext3 cannot overcome without changing the
158   - on-disk format.
  158 + on-disk format.
159 159  
160 160 Other than extent maps and 48-bit block numbers, ext4dev also is
161   - likely to have other new features such as persistent preallocation,
  161 + likely to have other new features such as persistent preallocation,
162 162 high resolution time stamps, and larger file support etc. These
163   - features will be added to ext4dev gradually.
  163 + features will be added to ext4dev gradually.
164 164  
165 165 To compile this file system support as a module, choose M here. The
166 166 module will be called ext4dev. Be aware, however, that the filesystem
... ... @@ -238,6 +238,38 @@
238 238 1 and 5, the higher the number, the more debugging output is
239 239 generated. To turn debugging off again, do
240 240 "echo 0 > /proc/sys/fs/jbd-debug".
  241 +
  242 +config JBD2
  243 + tristate
  244 + help
  245 + This is a generic journaling layer for block devices that support
  246 + both 32-bit and 64-bit block numbers. It is currently used by
  247 + the ext4dev/ext4 filesystem, but it could also be used to add
  248 + journal support to other file systems or block devices such
  249 + as RAID or LVM.
  250 +
  251 + If you are using ext4dev/ext4, you need to say Y here. If you are not
  252 + using ext4dev/ext4 then you will probably want to say N.
  253 +
  254 + To compile this device as a module, choose M here. The module will be
  255 + called jbd2. If you are compiling ext4dev/ext4 into the kernel,
  256 + you cannot compile this code as a module.
  257 +
  258 +config JBD2_DEBUG
  259 + bool "JBD2 (ext4dev/ext4) debugging support"
  260 + depends on JBD2
  261 + help
  262 + If you are using the ext4dev/ext4 journaled file system (or
  263 + potentially any other filesystem/device using JBD2), this option
  264 + allows you to enable debugging output while the system is running,
  265 + in order to help track down any problems you are having.
  266 + By default, the debugging output will be turned off.
  267 +
  268 + If you select Y here, then you will be able to turn on debugging
  269 + with "echo N > /proc/sys/fs/jbd2-debug", where N is a number between
  270 + 1 and 5. The higher the number, the more debugging output is
  271 + generated. To turn debugging off again, do
  272 + "echo 0 > /proc/sys/fs/jbd2-debug".
241 273  
242 274 config FS_MBCACHE
243 275 # Meta block cache for Extended Attributes (ext2/ext3/ext4)
... ... @@ -64,6 +64,7 @@
64 64 obj-$(CONFIG_EXT3_FS) += ext3/ # Before ext2 so root fs can be ext3
65 65 obj-$(CONFIG_EXT4DEV_FS) += ext4/ # Before ext2 so root fs can be ext4dev
66 66 obj-$(CONFIG_JBD) += jbd/
  67 +obj-$(CONFIG_JBD2) += jbd2/
67 68 obj-$(CONFIG_EXT2_FS) += ext2/
68 69 obj-$(CONFIG_CRAMFS) += cramfs/
69 70 obj-$(CONFIG_RAMFS) += ramfs/
... ... @@ -9,7 +9,7 @@
9 9 #include <linux/slab.h>
10 10 #include <linux/capability.h>
11 11 #include <linux/fs.h>
12   -#include <linux/ext4_jbd.h>
  12 +#include <linux/ext4_jbd2.h>
13 13 #include <linux/ext4_fs.h>
14 14 #include "xattr.h"
15 15 #include "acl.h"
... ... @@ -14,9 +14,9 @@
14 14 #include <linux/time.h>
15 15 #include <linux/capability.h>
16 16 #include <linux/fs.h>
17   -#include <linux/jbd.h>
  17 +#include <linux/jbd2.h>
18 18 #include <linux/ext4_fs.h>
19   -#include <linux/ext4_jbd.h>
  19 +#include <linux/ext4_jbd2.h>
20 20 #include <linux/quotaops.h>
21 21 #include <linux/buffer_head.h>
22 22  
23 23  
... ... @@ -526,12 +526,12 @@
526 526 * transaction.
527 527 *
528 528 * Ideally we would want to allow that to happen, but to
529   - * do so requires making journal_forget() capable of
  529 + * do so requires making jbd2_journal_forget() capable of
530 530 * revoking the queued write of a data block, which
531 531 * implies blocking on the journal lock. *forget()
532 532 * cannot block due to truncate races.
533 533 *
534   - * Eventually we can fix this by making journal_forget()
  534 + * Eventually we can fix this by making jbd2_journal_forget()
535 535 * return a status indicating whether or not it was able
536 536 * to revoke the buffer. On successful revoke, it is
537 537 * safe not to set the allocation bit in the committed
... ... @@ -1382,7 +1382,7 @@
1382 1382  
1383 1383 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
1384 1384  
1385   - return journal_force_commit_nested(EXT4_SB(sb)->s_journal);
  1385 + return jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal);
1386 1386 }
1387 1387  
1388 1388 /**
... ... @@ -8,7 +8,7 @@
8 8 */
9 9  
10 10 #include <linux/buffer_head.h>
11   -#include <linux/jbd.h>
  11 +#include <linux/jbd2.h>
12 12 #include <linux/ext4_fs.h>
13 13  
14 14 #ifdef EXT4FS_DEBUG
... ... @@ -22,7 +22,7 @@
22 22 */
23 23  
24 24 #include <linux/fs.h>
25   -#include <linux/jbd.h>
  25 +#include <linux/jbd2.h>
26 26 #include <linux/ext4_fs.h>
27 27 #include <linux/buffer_head.h>
28 28 #include <linux/smp_lock.h>
... ... @@ -20,9 +20,9 @@
20 20  
21 21 #include <linux/time.h>
22 22 #include <linux/fs.h>
23   -#include <linux/jbd.h>
  23 +#include <linux/jbd2.h>
24 24 #include <linux/ext4_fs.h>
25   -#include <linux/ext4_jbd.h>
  25 +#include <linux/ext4_jbd2.h>
26 26 #include "xattr.h"
27 27 #include "acl.h"
28 28  
... ... @@ -26,9 +26,9 @@
26 26 #include <linux/fs.h>
27 27 #include <linux/sched.h>
28 28 #include <linux/writeback.h>
29   -#include <linux/jbd.h>
  29 +#include <linux/jbd2.h>
30 30 #include <linux/ext4_fs.h>
31   -#include <linux/ext4_jbd.h>
  31 +#include <linux/ext4_jbd2.h>
32 32  
33 33 /*
34 34 * akpm: A new design for ext4_sync_file().
... ... @@ -10,7 +10,7 @@
10 10 */
11 11  
12 12 #include <linux/fs.h>
13   -#include <linux/jbd.h>
  13 +#include <linux/jbd2.h>
14 14 #include <linux/sched.h>
15 15 #include <linux/ext4_fs.h>
16 16 #include <linux/cryptohash.h>
... ... @@ -14,9 +14,9 @@
14 14  
15 15 #include <linux/time.h>
16 16 #include <linux/fs.h>
17   -#include <linux/jbd.h>
  17 +#include <linux/jbd2.h>
18 18 #include <linux/ext4_fs.h>
19   -#include <linux/ext4_jbd.h>
  19 +#include <linux/ext4_jbd2.h>
20 20 #include <linux/stat.h>
21 21 #include <linux/string.h>
22 22 #include <linux/quotaops.h>
... ... @@ -497,7 +497,7 @@
497 497 goto got;
498 498 }
499 499 /* we lost it */
500   - journal_release_buffer(handle, bitmap_bh);
  500 + jbd2_journal_release_buffer(handle, bitmap_bh);
501 501  
502 502 if (++ino < EXT4_INODES_PER_GROUP(sb))
503 503 goto repeat_in_this_group;
... ... @@ -25,8 +25,8 @@
25 25 #include <linux/module.h>
26 26 #include <linux/fs.h>
27 27 #include <linux/time.h>
28   -#include <linux/ext4_jbd.h>
29   -#include <linux/jbd.h>
  28 +#include <linux/ext4_jbd2.h>
  29 +#include <linux/jbd2.h>
30 30 #include <linux/smp_lock.h>
31 31 #include <linux/highuid.h>
32 32 #include <linux/pagemap.h>
... ... @@ -84,7 +84,7 @@
84 84 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
85 85 (!is_metadata && !ext4_should_journal_data(inode))) {
86 86 if (bh) {
87   - BUFFER_TRACE(bh, "call journal_forget");
  87 + BUFFER_TRACE(bh, "call jbd2_journal_forget");
88 88 return ext4_journal_forget(handle, bh);
89 89 }
90 90 return 0;
... ... @@ -657,7 +657,7 @@
657 657 failed:
658 658 /* Allocation failed, free what we already allocated */
659 659 for (i = 1; i <= n ; i++) {
660   - BUFFER_TRACE(branch[i].bh, "call journal_forget");
  660 + BUFFER_TRACE(branch[i].bh, "call jbd2_journal_forget");
661 661 ext4_journal_forget(handle, branch[i].bh);
662 662 }
663 663 for (i = 0; i <indirect_blks; i++)
... ... @@ -758,7 +758,7 @@
758 758  
759 759 err_out:
760 760 for (i = 1; i <= num; i++) {
761   - BUFFER_TRACE(where[i].bh, "call journal_forget");
  761 + BUFFER_TRACE(where[i].bh, "call jbd2_journal_forget");
762 762 ext4_journal_forget(handle, where[i].bh);
763 763 ext4_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1);
764 764 }
... ... @@ -1119,7 +1119,7 @@
1119 1119 * To preserve ordering, it is essential that the hole instantiation and
1120 1120 * the data write be encapsulated in a single transaction. We cannot
1121 1121 * close off a transaction and start a new one between the ext4_get_block()
1122   - * and the commit_write(). So doing the journal_start at the start of
  1122 + * and the commit_write(). So doing the jbd2_journal_start at the start of
1123 1123 * prepare_write() is the right place.
1124 1124 *
1125 1125 * Also, this function can nest inside ext4_writepage() ->
... ... @@ -1135,7 +1135,7 @@
1135 1135 * transaction open and was blocking on the quota lock - a ranking
1136 1136 * violation.
1137 1137 *
1138   - * So what we do is to rely on the fact that journal_stop/journal_start
  1138 + * So what we do is to rely on the fact that jbd2_journal_stop/journal_start
1139 1139 * will _not_ run commit under these circumstances because handle->h_ref
1140 1140 * is elevated. We'll still have enough credits for the tiny quotafile
1141 1141 * write.
... ... @@ -1184,7 +1184,7 @@
1184 1184  
1185 1185 int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1186 1186 {
1187   - int err = journal_dirty_data(handle, bh);
  1187 + int err = jbd2_journal_dirty_data(handle, bh);
1188 1188 if (err)
1189 1189 ext4_journal_abort_handle(__FUNCTION__, __FUNCTION__,
1190 1190 bh, handle,err);
... ... @@ -1333,9 +1333,9 @@
1333 1333  
1334 1334 EXT4_I(inode)->i_state &= ~EXT4_STATE_JDATA;
1335 1335 journal = EXT4_JOURNAL(inode);
1336   - journal_lock_updates(journal);
1337   - err = journal_flush(journal);
1338   - journal_unlock_updates(journal);
  1336 + jbd2_journal_lock_updates(journal);
  1337 + err = jbd2_journal_flush(journal);
  1338 + jbd2_journal_unlock_updates(journal);
1339 1339  
1340 1340 if (err)
1341 1341 return 0;
... ... @@ -1356,7 +1356,7 @@
1356 1356 return 0;
1357 1357 }
1358 1358  
1359   -static int journal_dirty_data_fn(handle_t *handle, struct buffer_head *bh)
  1359 +static int jbd2_journal_dirty_data_fn(handle_t *handle, struct buffer_head *bh)
1360 1360 {
1361 1361 if (buffer_mapped(bh))
1362 1362 return ext4_journal_dirty_data(handle, bh);
... ... @@ -1464,7 +1464,7 @@
1464 1464 */
1465 1465 if (ret == 0) {
1466 1466 err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE,
1467   - NULL, journal_dirty_data_fn);
  1467 + NULL, jbd2_journal_dirty_data_fn);
1468 1468 if (!ret)
1469 1469 ret = err;
1470 1470 }
... ... @@ -1595,7 +1595,7 @@
1595 1595 if (offset == 0)
1596 1596 ClearPageChecked(page);
1597 1597  
1598   - journal_invalidatepage(journal, page, offset);
  1598 + jbd2_journal_invalidatepage(journal, page, offset);
1599 1599 }
1600 1600  
1601 1601 static int ext4_releasepage(struct page *page, gfp_t wait)
... ... @@ -1605,7 +1605,7 @@
1605 1605 WARN_ON(PageChecked(page));
1606 1606 if (!page_has_buffers(page))
1607 1607 return 0;
1608   - return journal_try_to_free_buffers(journal, page, wait);
  1608 + return jbd2_journal_try_to_free_buffers(journal, page, wait);
1609 1609 }
1610 1610  
1611 1611 /*
1612 1612  
1613 1613  
... ... @@ -1982,11 +1982,11 @@
1982 1982  
1983 1983 /*
1984 1984 * Any buffers which are on the journal will be in memory. We find
1985   - * them on the hash table so journal_revoke() will run journal_forget()
  1985 + * them on the hash table so jbd2_journal_revoke() will run jbd2_journal_forget()
1986 1986 * on them. We've already detached each block from the file, so
1987   - * bforget() in journal_forget() should be safe.
  1987 + * bforget() in jbd2_journal_forget() should be safe.
1988 1988 *
1989   - * AKPM: turn on bforget in journal_forget()!!!
  1989 + * AKPM: turn on bforget in jbd2_journal_forget()!!!
1990 1990 */
1991 1991 for (p = first; p < last; p++) {
1992 1992 u32 nr = le32_to_cpu(*p);
1993 1993  
... ... @@ -2132,11 +2132,11 @@
2132 2132 * We've probably journalled the indirect block several
2133 2133 * times during the truncate. But it's no longer
2134 2134 * needed and we now drop it from the transaction via
2135   - * journal_revoke().
  2135 + * jbd2_journal_revoke().
2136 2136 *
2137 2137 * That's easy if it's exclusively part of this
2138 2138 * transaction. But if it's part of the committing
2139   - * transaction then journal_forget() will simply
  2139 + * transaction then jbd2_journal_forget() will simply
2140 2140 * brelse() it. That means that if the underlying
2141 2141 * block is reallocated in ext4_get_block(),
2142 2142 * unmap_underlying_metadata() will find this block
... ... @@ -2251,7 +2251,7 @@
2251 2251  
2252 2252 /*
2253 2253 * We have to lock the EOF page here, because lock_page() nests
2254   - * outside journal_start().
  2254 + * outside jbd2_journal_start().
2255 2255 */
2256 2256 if ((inode->i_size & (blocksize - 1)) == 0) {
2257 2257 /* Block boundary? Nothing to do */
... ... @@ -3035,7 +3035,7 @@
3035 3035 /* the do_update_inode consumes one bh->b_count */
3036 3036 get_bh(iloc->bh);
3037 3037  
3038   - /* ext4_do_update_inode() does journal_dirty_metadata */
  3038 + /* ext4_do_update_inode() does jbd2_journal_dirty_metadata */
3039 3039 err = ext4_do_update_inode(handle, inode, iloc);
3040 3040 put_bh(iloc->bh);
3041 3041 return err;
... ... @@ -3153,7 +3153,7 @@
3153 3153 err = ext4_get_inode_loc(inode, &iloc);
3154 3154 if (!err) {
3155 3155 BUFFER_TRACE(iloc.bh, "get_write_access");
3156   - err = journal_get_write_access(handle, iloc.bh);
  3156 + err = jbd2_journal_get_write_access(handle, iloc.bh);
3157 3157 if (!err)
3158 3158 err = ext4_journal_dirty_metadata(handle,
3159 3159 iloc.bh);
... ... @@ -3185,8 +3185,8 @@
3185 3185 if (is_journal_aborted(journal) || IS_RDONLY(inode))
3186 3186 return -EROFS;
3187 3187  
3188   - journal_lock_updates(journal);
3189   - journal_flush(journal);
  3188 + jbd2_journal_lock_updates(journal);
  3189 + jbd2_journal_flush(journal);
3190 3190  
3191 3191 /*
3192 3192 * OK, there are no updates running now, and all cached data is
... ... @@ -3202,7 +3202,7 @@
3202 3202 EXT4_I(inode)->i_flags &= ~EXT4_JOURNAL_DATA_FL;
3203 3203 ext4_set_aops(inode);
3204 3204  
3205   - journal_unlock_updates(journal);
  3205 + jbd2_journal_unlock_updates(journal);
3206 3206  
3207 3207 /* Finally we can mark the inode as dirty. */
3208 3208  
... ... @@ -8,10 +8,10 @@
8 8 */
9 9  
10 10 #include <linux/fs.h>
11   -#include <linux/jbd.h>
  11 +#include <linux/jbd2.h>
12 12 #include <linux/capability.h>
13 13 #include <linux/ext4_fs.h>
14   -#include <linux/ext4_jbd.h>
  14 +#include <linux/ext4_jbd2.h>
15 15 #include <linux/time.h>
16 16 #include <linux/compat.h>
17 17 #include <linux/smp_lock.h>
... ... @@ -219,9 +219,9 @@
219 219 return -EFAULT;
220 220  
221 221 err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count);
222   - journal_lock_updates(EXT4_SB(sb)->s_journal);
223   - journal_flush(EXT4_SB(sb)->s_journal);
224   - journal_unlock_updates(EXT4_SB(sb)->s_journal);
  222 + jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
  223 + jbd2_journal_flush(EXT4_SB(sb)->s_journal);
  224 + jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
225 225  
226 226 return err;
227 227 }
... ... @@ -241,9 +241,9 @@
241 241 return -EFAULT;
242 242  
243 243 err = ext4_group_add(sb, &input);
244   - journal_lock_updates(EXT4_SB(sb)->s_journal);
245   - journal_flush(EXT4_SB(sb)->s_journal);
246   - journal_unlock_updates(EXT4_SB(sb)->s_journal);
  244 + jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
  245 + jbd2_journal_flush(EXT4_SB(sb)->s_journal);
  246 + jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
247 247  
248 248 return err;
249 249 }
... ... @@ -26,10 +26,10 @@
26 26  
27 27 #include <linux/fs.h>
28 28 #include <linux/pagemap.h>
29   -#include <linux/jbd.h>
  29 +#include <linux/jbd2.h>
30 30 #include <linux/time.h>
31 31 #include <linux/ext4_fs.h>
32   -#include <linux/ext4_jbd.h>
  32 +#include <linux/ext4_jbd2.h>
33 33 #include <linux/fcntl.h>
34 34 #include <linux/stat.h>
35 35 #include <linux/string.h>
... ... @@ -13,7 +13,7 @@
13 13  
14 14 #include <linux/sched.h>
15 15 #include <linux/smp_lock.h>
16   -#include <linux/ext4_jbd.h>
  16 +#include <linux/ext4_jbd2.h>
17 17  
18 18 #include <linux/errno.h>
19 19 #include <linux/slab.h>
... ... @@ -20,9 +20,9 @@
20 20 #include <linux/string.h>
21 21 #include <linux/fs.h>
22 22 #include <linux/time.h>
23   -#include <linux/jbd.h>
  23 +#include <linux/jbd2.h>
24 24 #include <linux/ext4_fs.h>
25   -#include <linux/ext4_jbd.h>
  25 +#include <linux/ext4_jbd2.h>
26 26 #include <linux/slab.h>
27 27 #include <linux/init.h>
28 28 #include <linux/blkdev.h>
... ... @@ -63,7 +63,7 @@
63 63 static void ext4_write_super_lockfs(struct super_block *sb);
64 64  
65 65 /*
66   - * Wrappers for journal_start/end.
  66 + * Wrappers for jbd2_journal_start/end.
67 67 *
68 68 * The only special thing we need to do here is to make sure that all
69 69 * journal_end calls result in the superblock being marked dirty, so
70 70  
... ... @@ -87,12 +87,12 @@
87 87 return ERR_PTR(-EROFS);
88 88 }
89 89  
90   - return journal_start(journal, nblocks);
  90 + return jbd2_journal_start(journal, nblocks);
91 91 }
92 92  
93 93 /*
94 94 * The only special thing we need to do here is to make sure that all
95   - * journal_stop calls result in the superblock being marked dirty, so
  95 + * jbd2_journal_stop calls result in the superblock being marked dirty, so
96 96 * that sync() will call the filesystem's write_super callback if
97 97 * appropriate.
98 98 */
... ... @@ -104,7 +104,7 @@
104 104  
105 105 sb = handle->h_transaction->t_journal->j_private;
106 106 err = handle->h_err;
107   - rc = journal_stop(handle);
  107 + rc = jbd2_journal_stop(handle);
108 108  
109 109 if (!err)
110 110 err = rc;
... ... @@ -131,7 +131,7 @@
131 131 printk(KERN_ERR "%s: aborting transaction: %s in %s\n",
132 132 caller, errstr, err_fn);
133 133  
134   - journal_abort_handle(handle);
  134 + jbd2_journal_abort_handle(handle);
135 135 }
136 136  
137 137 /* Deal with the reporting of failure conditions on a filesystem such as
... ... @@ -144,7 +144,7 @@
144 144 * be aborted, we can't rely on the current, or future, transactions to
145 145 * write out the superblock safely.
146 146 *
147   - * We'll just use the journal_abort() error code to record an error in
  147 + * We'll just use the jbd2_journal_abort() error code to record an error in
148 148 * the journal instead. On recovery, the journal will compain about
149 149 * that error until we've noted it down and cleared it.
150 150 */
... ... @@ -164,7 +164,7 @@
164 164  
165 165 EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT;
166 166 if (journal)
167   - journal_abort(journal, -EIO);
  167 + jbd2_journal_abort(journal, -EIO);
168 168 }
169 169 if (test_opt (sb, ERRORS_RO)) {
170 170 printk (KERN_CRIT "Remounting filesystem read-only\n");
... ... @@ -203,7 +203,7 @@
203 203 errstr = "Out of memory";
204 204 break;
205 205 case -EROFS:
206   - if (!sb || EXT4_SB(sb)->s_journal->j_flags & JFS_ABORT)
  206 + if (!sb || EXT4_SB(sb)->s_journal->j_flags & JBD2_ABORT)
207 207 errstr = "Journal has aborted";
208 208 else
209 209 errstr = "Readonly filesystem";
... ... @@ -279,7 +279,7 @@
279 279 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
280 280 sb->s_flags |= MS_RDONLY;
281 281 EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT;
282   - journal_abort(EXT4_SB(sb)->s_journal, -EIO);
  282 + jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
283 283 }
284 284  
285 285 void ext4_warning (struct super_block * sb, const char * function,
... ... @@ -391,7 +391,7 @@
391 391 int i;
392 392  
393 393 ext4_xattr_put_super(sb);
394   - journal_destroy(sbi->s_journal);
  394 + jbd2_journal_destroy(sbi->s_journal);
395 395 if (!(sb->s_flags & MS_RDONLY)) {
396 396 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
397 397 es->s_state = cpu_to_le16(sbi->s_mount_state);
... ... @@ -1722,8 +1722,8 @@
1722 1722 /* No mode set, assume a default based on the journal
1723 1723 capabilities: ORDERED_DATA if the journal can
1724 1724 cope, else JOURNAL_DATA */
1725   - if (journal_check_available_features
1726   - (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE))
  1725 + if (jbd2_journal_check_available_features
  1726 + (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE))
1727 1727 set_opt(sbi->s_mount_opt, ORDERED_DATA);
1728 1728 else
1729 1729 set_opt(sbi->s_mount_opt, JOURNAL_DATA);
... ... @@ -1731,8 +1731,8 @@
1731 1731  
1732 1732 case EXT4_MOUNT_ORDERED_DATA:
1733 1733 case EXT4_MOUNT_WRITEBACK_DATA:
1734   - if (!journal_check_available_features
1735   - (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) {
  1734 + if (!jbd2_journal_check_available_features
  1735 + (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) {
1736 1736 printk(KERN_ERR "EXT4-fs: Journal does not support "
1737 1737 "requested data journaling mode\n");
1738 1738 goto failed_mount4;
... ... @@ -1749,7 +1749,7 @@
1749 1749 }
1750 1750 }
1751 1751 /*
1752   - * The journal_load will have done any necessary log recovery,
  1752 + * The jbd2_journal_load will have done any necessary log recovery,
1753 1753 * so we can safely mount the rest of the filesystem now.
1754 1754 */
1755 1755  
... ... @@ -1797,7 +1797,7 @@
1797 1797 goto failed_mount;
1798 1798  
1799 1799 failed_mount4:
1800   - journal_destroy(sbi->s_journal);
  1800 + jbd2_journal_destroy(sbi->s_journal);
1801 1801 failed_mount3:
1802 1802 percpu_counter_destroy(&sbi->s_freeblocks_counter);
1803 1803 percpu_counter_destroy(&sbi->s_freeinodes_counter);
1804 1804  
... ... @@ -1837,9 +1837,9 @@
1837 1837  
1838 1838 spin_lock(&journal->j_state_lock);
1839 1839 if (test_opt(sb, BARRIER))
1840   - journal->j_flags |= JFS_BARRIER;
  1840 + journal->j_flags |= JBD2_BARRIER;
1841 1841 else
1842   - journal->j_flags &= ~JFS_BARRIER;
  1842 + journal->j_flags &= ~JBD2_BARRIER;
1843 1843 spin_unlock(&journal->j_state_lock);
1844 1844 }
1845 1845  
... ... @@ -1873,7 +1873,7 @@
1873 1873 return NULL;
1874 1874 }
1875 1875  
1876   - journal = journal_init_inode(journal_inode);
  1876 + journal = jbd2_journal_init_inode(journal_inode);
1877 1877 if (!journal) {
1878 1878 printk(KERN_ERR "EXT4-fs: Could not load journal inode\n");
1879 1879 iput(journal_inode);
... ... @@ -1945,7 +1945,7 @@
1945 1945 start = sb_block + 1;
1946 1946 brelse(bh); /* we're done with the superblock */
1947 1947  
1948   - journal = journal_init_dev(bdev, sb->s_bdev,
  1948 + journal = jbd2_journal_init_dev(bdev, sb->s_bdev,
1949 1949 start, len, blocksize);
1950 1950 if (!journal) {
1951 1951 printk(KERN_ERR "EXT4-fs: failed to create device journal\n");
... ... @@ -1968,7 +1968,7 @@
1968 1968 ext4_init_journal_params(sb, journal);
1969 1969 return journal;
1970 1970 out_journal:
1971   - journal_destroy(journal);
  1971 + jbd2_journal_destroy(journal);
1972 1972 out_bdev:
1973 1973 ext4_blkdev_put(bdev);
1974 1974 return NULL;
1975 1975  
1976 1976  
1977 1977  
1978 1978  
... ... @@ -2029,22 +2029,22 @@
2029 2029 }
2030 2030  
2031 2031 if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) {
2032   - err = journal_update_format(journal);
  2032 + err = jbd2_journal_update_format(journal);
2033 2033 if (err) {
2034 2034 printk(KERN_ERR "EXT4-fs: error updating journal.\n");
2035   - journal_destroy(journal);
  2035 + jbd2_journal_destroy(journal);
2036 2036 return err;
2037 2037 }
2038 2038 }
2039 2039  
2040 2040 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER))
2041   - err = journal_wipe(journal, !really_read_only);
  2041 + err = jbd2_journal_wipe(journal, !really_read_only);
2042 2042 if (!err)
2043   - err = journal_load(journal);
  2043 + err = jbd2_journal_load(journal);
2044 2044  
2045 2045 if (err) {
2046 2046 printk(KERN_ERR "EXT4-fs: error loading journal.\n");
2047   - journal_destroy(journal);
  2047 + jbd2_journal_destroy(journal);
2048 2048 return err;
2049 2049 }
2050 2050  
2051 2051  
... ... @@ -2081,9 +2081,9 @@
2081 2081 printk(KERN_INFO "EXT4-fs: creating new journal on inode %u\n",
2082 2082 journal_inum);
2083 2083  
2084   - if (journal_create(journal)) {
  2084 + if (jbd2_journal_create(journal)) {
2085 2085 printk(KERN_ERR "EXT4-fs: error creating journal.\n");
2086   - journal_destroy(journal);
  2086 + jbd2_journal_destroy(journal);
2087 2087 return -EIO;
2088 2088 }
2089 2089  
2090 2090  
... ... @@ -2130,15 +2130,15 @@
2130 2130 {
2131 2131 journal_t *journal = EXT4_SB(sb)->s_journal;
2132 2132  
2133   - journal_lock_updates(journal);
2134   - journal_flush(journal);
  2133 + jbd2_journal_lock_updates(journal);
  2134 + jbd2_journal_flush(journal);
2135 2135 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER) &&
2136 2136 sb->s_flags & MS_RDONLY) {
2137 2137 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
2138 2138 sb->s_dirt = 0;
2139 2139 ext4_commit_super(sb, es, 1);
2140 2140 }
2141   - journal_unlock_updates(journal);
  2141 + jbd2_journal_unlock_updates(journal);
2142 2142 }
2143 2143  
2144 2144 /*
... ... @@ -2160,7 +2160,7 @@
2160 2160 * journal by a prior ext4_error() or ext4_abort()
2161 2161 */
2162 2162  
2163   - j_errno = journal_errno(journal);
  2163 + j_errno = jbd2_journal_errno(journal);
2164 2164 if (j_errno) {
2165 2165 char nbuf[16];
2166 2166  
... ... @@ -2174,7 +2174,7 @@
2174 2174 es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
2175 2175 ext4_commit_super (sb, es, 1);
2176 2176  
2177   - journal_clear_err(journal);
  2177 + jbd2_journal_clear_err(journal);
2178 2178 }
2179 2179 }
2180 2180  
2181 2181  
... ... @@ -2217,9 +2217,9 @@
2217 2217 tid_t target;
2218 2218  
2219 2219 sb->s_dirt = 0;
2220   - if (journal_start_commit(EXT4_SB(sb)->s_journal, &target)) {
  2220 + if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, &target)) {
2221 2221 if (wait)
2222   - log_wait_commit(EXT4_SB(sb)->s_journal, target);
  2222 + jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, target);
2223 2223 }
2224 2224 return 0;
2225 2225 }
... ... @@ -2236,8 +2236,8 @@
2236 2236 journal_t *journal = EXT4_SB(sb)->s_journal;
2237 2237  
2238 2238 /* Now we set up the journal barrier. */
2239   - journal_lock_updates(journal);
2240   - journal_flush(journal);
  2239 + jbd2_journal_lock_updates(journal);
  2240 + jbd2_journal_flush(journal);
2241 2241  
2242 2242 /* Journal blocked and flushed, clear needs_recovery flag. */
2243 2243 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
... ... @@ -2257,7 +2257,7 @@
2257 2257 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
2258 2258 ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1);
2259 2259 unlock_super(sb);
2260   - journal_unlock_updates(EXT4_SB(sb)->s_journal);
  2260 + jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
2261 2261 }
2262 2262 }
2263 2263  
2264 2264  
... ... @@ -2438,9 +2438,9 @@
2438 2438 * is locked for write. Otherwise the are possible deadlocks:
2439 2439 * Process 1 Process 2
2440 2440 * ext4_create() quota_sync()
2441   - * journal_start() write_dquot()
  2441 + * jbd2_journal_start() write_dquot()
2442 2442 * DQUOT_INIT() down(dqio_mutex)
2443   - * down(dqio_mutex) journal_start()
  2443 + * down(dqio_mutex) jbd2_journal_start()
2444 2444 *
2445 2445 */
2446 2446  
... ... @@ -18,7 +18,7 @@
18 18 */
19 19  
20 20 #include <linux/fs.h>
21   -#include <linux/jbd.h>
  21 +#include <linux/jbd2.h>
22 22 #include <linux/ext4_fs.h>
23 23 #include <linux/namei.h>
24 24 #include "xattr.h"
... ... @@ -53,7 +53,7 @@
53 53 #include <linux/init.h>
54 54 #include <linux/fs.h>
55 55 #include <linux/slab.h>
56   -#include <linux/ext4_jbd.h>
  56 +#include <linux/ext4_jbd2.h>
57 57 #include <linux/ext4_fs.h>
58 58 #include <linux/mbcache.h>
59 59 #include <linux/quotaops.h>
fs/ext4/xattr_security.c
... ... @@ -7,7 +7,7 @@
7 7 #include <linux/string.h>
8 8 #include <linux/fs.h>
9 9 #include <linux/smp_lock.h>
10   -#include <linux/ext4_jbd.h>
  10 +#include <linux/ext4_jbd2.h>
11 11 #include <linux/ext4_fs.h>
12 12 #include <linux/security.h>
13 13 #include "xattr.h"
fs/ext4/xattr_trusted.c
... ... @@ -10,7 +10,7 @@
10 10 #include <linux/capability.h>
11 11 #include <linux/fs.h>
12 12 #include <linux/smp_lock.h>
13   -#include <linux/ext4_jbd.h>
  13 +#include <linux/ext4_jbd2.h>
14 14 #include <linux/ext4_fs.h>
15 15 #include "xattr.h"
16 16  
fs/ext4/xattr_user.c
... ... @@ -9,7 +9,7 @@
9 9 #include <linux/string.h>
10 10 #include <linux/fs.h>
11 11 #include <linux/smp_lock.h>
12   -#include <linux/ext4_jbd.h>
  12 +#include <linux/ext4_jbd2.h>
13 13 #include <linux/ext4_fs.h>
14 14 #include "xattr.h"
15 15