1 From: Joel Becker <joel.becker@oracle.com>
2 Subject: ocfs2: Switch over to JBD2.
3 Patch-mainline: 2.6.28?
6 ocfs2 wants JBD2 for many reasons, not the least of which is that JBD is
7 limiting our maximum filesystem size.
9 It's a pretty trivial change. Most functions are just renamed. The
10 only functional change is moving to Jan's inode-based ordered data mode.
13 Because JBD2 reads and writes JBD journals, this is compatible with any
14 existing filesystem. It can even interact with JBD-based ocfs2 as long
15 as the journal is formated for JBD.
17 We provide a compatibility option so that paranoid people can still use
18 JBD for the time being. This will go away shortly.
20 [ Moved call of ocfs2_begin_ordered_truncate() from ocfs2_delete_inode() to
21 ocfs2_truncate_for_delete(). --Mark ]
23 Signed-off-by: Joel Becker <joel.becker@oracle.com>
24 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
26 fs/Kconfig | 40 +++++++++++++--------
27 fs/ocfs2/alloc.c | 28 +++++----------
28 fs/ocfs2/aops.c | 21 ++++++++---
29 fs/ocfs2/file.c | 14 +++++--
30 fs/ocfs2/inode.c | 5 ++
32 fs/ocfs2/journal.c | 72 ++++++++++++++++++++------------------
33 fs/ocfs2/journal.h | 25 +++++++++++--
34 fs/ocfs2/ocfs2.h | 7 +++
35 fs/ocfs2/ocfs2_jbd_compat.h | 82 ++++++++++++++++++++++++++++++++++++++++++++
36 fs/ocfs2/super.c | 10 +++--
37 fs/ocfs2/uptodate.c | 6 ++-
38 12 files changed, 227 insertions(+), 84 deletions(-)
39 create mode 100644 fs/ocfs2/ocfs2_jbd_compat.h
43 @@ -206,17 +206,16 @@ config JBD
46 This is a generic journalling layer for block devices. It is
47 - currently used by the ext3 and OCFS2 file systems, but it could
48 - also be used to add journal support to other file systems or block
49 + currently used by the ext3 file system, but it could also be
50 + used to add journal support to other file systems or block
51 devices such as RAID or LVM.
53 - If you are using the ext3 or OCFS2 file systems, you need to
54 - say Y here. If you are not using ext3 OCFS2 then you will probably
56 + If you are using the ext3 file system, you need to say Y here.
57 + If you are not using ext3 then you will probably want to say N.
59 To compile this device as a module, choose M here: the module will be
60 - called jbd. If you are compiling ext3 or OCFS2 into the kernel,
61 - you cannot compile this code as a module.
62 + called jbd. If you are compiling ext3 into the kernel, you
63 + cannot compile this code as a module.
66 bool "JBD (ext3) debugging support"
67 @@ -240,16 +239,17 @@ config JBD2
69 This is a generic journaling layer for block devices that support
70 both 32-bit and 64-bit block numbers. It is currently used by
71 - the ext4dev/ext4 filesystem, but it could also be used to add
72 - journal support to other file systems or block devices such
74 + the ext4dev/ext4 and OCFS2 filesystems, but it could also be
75 + used to add journal support to other file systems or block
76 + devices such as RAID or LVM.
78 - If you are using ext4dev/ext4, you need to say Y here. If you are not
79 - using ext4dev/ext4 then you will probably want to say N.
80 + If you are using ext4dev/ext4 or OCFS2, you need to say Y here.
81 + If you are not using ext4dev/ext4 or OCFS2 then you will
82 + probably want to say N.
84 To compile this device as a module, choose M here. The module will be
85 - called jbd2. If you are compiling ext4dev/ext4 into the kernel,
86 - you cannot compile this code as a module.
87 + called jbd2. If you are compiling ext4dev/ext4 or OCFS2 into the
88 + kernel, you cannot compile this code as a module.
91 bool "JBD2 (ext4dev/ext4) debugging support"
92 @@ -426,7 +426,7 @@ config OCFS2_FS
93 tristate "OCFS2 file system support"
94 depends on NET && SYSFS
100 OCFS2 is a general purpose extent based shared disk cluster file
101 @@ -497,6 +497,16 @@ config OCFS2_DEBUG_FS
102 this option for debugging only as it is likely to decrease
103 performance of the filesystem.
105 +config OCFS2_COMPAT_JBD
106 + bool "Use JBD for compatibility"
107 + depends on OCFS2_FS
111 + The ocfs2 filesystem now uses JBD2 for its journalling. JBD2
112 + is backwards compatible with JBD. It is safe to say N here.
113 + However, if you really want to use the original JBD, say Y here.
118 --- a/fs/ocfs2/alloc.c
119 +++ b/fs/ocfs2/alloc.c
120 @@ -6430,20 +6430,13 @@ bail:
124 -static int ocfs2_writeback_zero_func(handle_t *handle, struct buffer_head *bh)
125 +static int ocfs2_zero_func(handle_t *handle, struct buffer_head *bh)
127 set_buffer_uptodate(bh);
128 mark_buffer_dirty(bh);
132 -static int ocfs2_ordered_zero_func(handle_t *handle, struct buffer_head *bh)
134 - set_buffer_uptodate(bh);
135 - mark_buffer_dirty(bh);
136 - return ocfs2_journal_dirty_data(handle, bh);
139 static void ocfs2_map_and_dirty_page(struct inode *inode, handle_t *handle,
140 unsigned int from, unsigned int to,
141 struct page *page, int zero, u64 *phys)
142 @@ -6462,17 +6455,18 @@ static void ocfs2_map_and_dirty_page(str
143 * here if they aren't - ocfs2_map_page_blocks()
144 * might've skipped some
146 - if (ocfs2_should_order_data(inode)) {
147 - ret = walk_page_buffers(handle,
148 - page_buffers(page),
149 - from, to, &partial,
150 - ocfs2_ordered_zero_func);
154 + ret = walk_page_buffers(handle, page_buffers(page),
155 + from, to, &partial,
159 + else if (ocfs2_should_order_data(inode)) {
160 + ret = ocfs2_jbd2_file_inode(handle, inode);
161 +#ifdef CONFIG_OCFS2_COMPAT_JBD
162 ret = walk_page_buffers(handle, page_buffers(page),
164 - ocfs2_writeback_zero_func);
165 + ocfs2_journal_dirty_data);
170 --- a/fs/ocfs2/aops.c
171 +++ b/fs/ocfs2/aops.c
172 @@ -485,11 +485,14 @@ handle_t *ocfs2_start_walk_page_trans(st
175 if (ocfs2_should_order_data(inode)) {
176 + ret = ocfs2_jbd2_file_inode(handle, inode);
177 +#ifdef CONFIG_OCFS2_COMPAT_JBD
178 ret = walk_page_buffers(handle,
181 ocfs2_journal_dirty_data);
188 @@ -669,7 +672,7 @@ static void ocfs2_invalidatepage(struct
190 journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;
192 - journal_invalidatepage(journal, page, offset);
193 + jbd2_journal_invalidatepage(journal, page, offset);
196 static int ocfs2_releasepage(struct page *page, gfp_t wait)
197 @@ -678,7 +681,7 @@ static int ocfs2_releasepage(struct page
199 if (!page_has_buffers(page))
201 - return journal_try_to_free_buffers(journal, page, wait);
202 + return jbd2_journal_try_to_free_buffers(journal, page, wait);
205 static ssize_t ocfs2_direct_IO(int rw,
206 @@ -1074,11 +1077,15 @@ static void ocfs2_write_failure(struct i
207 tmppage = wc->w_pages[i];
209 if (page_has_buffers(tmppage)) {
210 - if (ocfs2_should_order_data(inode))
211 + if (ocfs2_should_order_data(inode)) {
212 + ocfs2_jbd2_file_inode(wc->w_handle, inode);
213 +#ifdef CONFIG_OCFS2_COMPAT_JBD
214 walk_page_buffers(wc->w_handle,
215 page_buffers(tmppage),
217 ocfs2_journal_dirty_data);
221 block_commit_write(tmppage, from, to);
223 @@ -1917,11 +1924,15 @@ int ocfs2_write_end_nolock(struct addres
226 if (page_has_buffers(tmppage)) {
227 - if (ocfs2_should_order_data(inode))
228 + if (ocfs2_should_order_data(inode)) {
229 + ocfs2_jbd2_file_inode(wc->w_handle, inode);
230 +#ifdef CONFIG_OCFS2_COMPAT_JBD
231 walk_page_buffers(wc->w_handle,
232 page_buffers(tmppage),
234 ocfs2_journal_dirty_data);
237 block_commit_write(tmppage, from, to);
240 --- a/fs/ocfs2/file.c
241 +++ b/fs/ocfs2/file.c
242 @@ -185,7 +185,7 @@ static int ocfs2_sync_file(struct file *
245 journal = osb->journal->j_journal;
246 - err = journal_force_commit(journal);
247 + err = jbd2_journal_force_commit(journal);
251 @@ -941,9 +941,15 @@ int ocfs2_setattr(struct dentry *dentry,
255 - if (i_size_read(inode) > attr->ia_size)
256 + if (i_size_read(inode) > attr->ia_size) {
257 + if (ocfs2_should_order_data(inode)) {
258 + status = ocfs2_begin_ordered_truncate(inode,
263 status = ocfs2_truncate_file(inode, bh, attr->ia_size);
266 status = ocfs2_extend_file(inode, bh, attr->ia_size);
268 if (status != -ENOSPC)
269 @@ -1888,7 +1894,7 @@ out_dio:
271 if (old_size != i_size_read(inode) ||
272 old_clusters != OCFS2_I(inode)->ip_clusters) {
273 - ret = journal_force_commit(osb->journal->j_journal);
274 + ret = jbd2_journal_force_commit(osb->journal->j_journal);
278 --- a/fs/ocfs2/inode.c
279 +++ b/fs/ocfs2/inode.c
280 @@ -523,6 +523,9 @@ static int ocfs2_truncate_for_delete(str
281 * data and fast symlinks.
283 if (fe->i_clusters) {
284 + if (ocfs2_should_order_data(inode))
285 + ocfs2_begin_ordered_truncate(inode, 0);
287 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
288 if (IS_ERR(handle)) {
289 status = PTR_ERR(handle);
290 @@ -1089,6 +1092,8 @@ void ocfs2_clear_inode(struct inode *ino
291 oi->ip_last_trans = 0;
292 oi->ip_dir_start_lookup = 0;
294 + jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal,
299 --- a/fs/ocfs2/inode.h
300 +++ b/fs/ocfs2/inode.h
301 @@ -71,6 +71,7 @@ struct ocfs2_inode_info
302 struct ocfs2_extent_map ip_extent_map;
304 struct inode vfs_inode;
305 + struct jbd2_inode ip_jinode;
309 --- a/fs/ocfs2/journal.c
310 +++ b/fs/ocfs2/journal.c
311 @@ -215,9 +215,9 @@ static int ocfs2_commit_cache(struct ocf
315 - journal_lock_updates(journal->j_journal);
316 - status = journal_flush(journal->j_journal);
317 - journal_unlock_updates(journal->j_journal);
318 + jbd2_journal_lock_updates(journal->j_journal);
319 + status = jbd2_journal_flush(journal->j_journal);
320 + jbd2_journal_unlock_updates(journal->j_journal);
322 up_write(&journal->j_trans_barrier);
324 @@ -264,7 +264,7 @@ handle_t *ocfs2_start_trans(struct ocfs2
326 down_read(&osb->journal->j_trans_barrier);
328 - handle = journal_start(journal, max_buffs);
329 + handle = jbd2_journal_start(journal, max_buffs);
330 if (IS_ERR(handle)) {
331 up_read(&osb->journal->j_trans_barrier);
333 @@ -290,7 +290,7 @@ int ocfs2_commit_trans(struct ocfs2_supe
337 - ret = journal_stop(handle);
338 + ret = jbd2_journal_stop(handle);
342 @@ -304,7 +304,7 @@ int ocfs2_commit_trans(struct ocfs2_supe
343 * transaction. extend_trans will either extend the current handle by
344 * nblocks, or commit it and start a new one with nblocks credits.
346 - * This might call journal_restart() which will commit dirty buffers
347 + * This might call jbd2_journal_restart() which will commit dirty buffers
348 * and then restart the transaction. Before calling
349 * ocfs2_extend_trans(), any changed blocks should have been
350 * dirtied. After calling it, all blocks which need to be changed must
351 @@ -332,7 +332,7 @@ int ocfs2_extend_trans(handle_t *handle,
352 #ifdef CONFIG_OCFS2_DEBUG_FS
355 - status = journal_extend(handle, nblocks);
356 + status = jbd2_journal_extend(handle, nblocks);
360 @@ -340,8 +340,10 @@ int ocfs2_extend_trans(handle_t *handle,
364 - mlog(0, "journal_extend failed, trying journal_restart\n");
365 - status = journal_restart(handle, nblocks);
367 + "jbd2_journal_extend failed, trying "
368 + "jbd2_journal_restart\n");
369 + status = jbd2_journal_restart(handle, nblocks);
373 @@ -393,11 +395,11 @@ int ocfs2_journal_access(handle_t *handl
375 case OCFS2_JOURNAL_ACCESS_CREATE:
376 case OCFS2_JOURNAL_ACCESS_WRITE:
377 - status = journal_get_write_access(handle, bh);
378 + status = jbd2_journal_get_write_access(handle, bh);
381 case OCFS2_JOURNAL_ACCESS_UNDO:
382 - status = journal_get_undo_access(handle, bh);
383 + status = jbd2_journal_get_undo_access(handle, bh);
387 @@ -422,7 +424,7 @@ int ocfs2_journal_dirty(handle_t *handle
388 mlog_entry("(bh->b_blocknr=%llu)\n",
389 (unsigned long long)bh->b_blocknr);
391 - status = journal_dirty_metadata(handle, bh);
392 + status = jbd2_journal_dirty_metadata(handle, bh);
394 mlog(ML_ERROR, "Could not dirty metadata buffer. "
395 "(bh->b_blocknr=%llu)\n",
396 @@ -432,6 +434,7 @@ int ocfs2_journal_dirty(handle_t *handle
400 +#ifdef CONFIG_OCFS2_COMPAT_JBD
401 int ocfs2_journal_dirty_data(handle_t *handle,
402 struct buffer_head *bh)
404 @@ -443,8 +446,9 @@ int ocfs2_journal_dirty_data(handle_t *h
410 -#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD_DEFAULT_MAX_COMMIT_AGE)
411 +#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE)
413 void ocfs2_set_journal_params(struct ocfs2_super *osb)
415 @@ -457,9 +461,9 @@ void ocfs2_set_journal_params(struct ocf
416 spin_lock(&journal->j_state_lock);
417 journal->j_commit_interval = commit_interval;
418 if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER)
419 - journal->j_flags |= JFS_BARRIER;
420 + journal->j_flags |= JBD2_BARRIER;
422 - journal->j_flags &= ~JFS_BARRIER;
423 + journal->j_flags &= ~JBD2_BARRIER;
424 spin_unlock(&journal->j_state_lock);
427 @@ -524,14 +528,14 @@ int ocfs2_journal_init(struct ocfs2_jour
428 mlog(0, "inode->ip_clusters = %u\n", OCFS2_I(inode)->ip_clusters);
430 /* call the kernels journal init function now */
431 - j_journal = journal_init_inode(inode);
432 + j_journal = jbd2_journal_init_inode(inode);
433 if (j_journal == NULL) {
434 mlog(ML_ERROR, "Linux journal layer error\n");
439 - mlog(0, "Returned from journal_init_inode\n");
440 + mlog(0, "Returned from jbd2_journal_init_inode\n");
441 mlog(0, "j_journal->j_maxlen = %u\n", j_journal->j_maxlen);
443 *dirty = (le32_to_cpu(di->id1.journal1.ij_flags) &
444 @@ -639,7 +643,7 @@ void ocfs2_journal_shutdown(struct ocfs2
445 if (journal->j_state != OCFS2_JOURNAL_LOADED)
448 - /* need to inc inode use count as journal_destroy will iput. */
449 + /* need to inc inode use count - jbd2_journal_destroy will iput. */
453 @@ -668,9 +672,9 @@ void ocfs2_journal_shutdown(struct ocfs2
454 BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0);
456 if (ocfs2_mount_local(osb)) {
457 - journal_lock_updates(journal->j_journal);
458 - status = journal_flush(journal->j_journal);
459 - journal_unlock_updates(journal->j_journal);
460 + jbd2_journal_lock_updates(journal->j_journal);
461 + status = jbd2_journal_flush(journal->j_journal);
462 + jbd2_journal_unlock_updates(journal->j_journal);
466 @@ -686,7 +690,7 @@ void ocfs2_journal_shutdown(struct ocfs2
469 /* Shutdown the kernel journal system */
470 - journal_destroy(journal->j_journal);
471 + jbd2_journal_destroy(journal->j_journal);
473 OCFS2_I(inode)->ip_open_count--;
475 @@ -711,15 +715,15 @@ static void ocfs2_clear_journal_error(st
479 - olderr = journal_errno(journal);
480 + olderr = jbd2_journal_errno(journal);
482 mlog(ML_ERROR, "File system error %d recorded in "
483 "journal %u.\n", olderr, slot);
484 mlog(ML_ERROR, "File system on device %s needs checking.\n",
487 - journal_ack_err(journal);
488 - journal_clear_err(journal);
489 + jbd2_journal_ack_err(journal);
490 + jbd2_journal_clear_err(journal);
494 @@ -734,7 +738,7 @@ int ocfs2_journal_load(struct ocfs2_jour
496 osb = journal->j_osb;
498 - status = journal_load(journal->j_journal);
499 + status = jbd2_journal_load(journal->j_journal);
501 mlog(ML_ERROR, "Failed to load journal!\n");
503 @@ -778,7 +782,7 @@ int ocfs2_journal_wipe(struct ocfs2_jour
507 - status = journal_wipe(journal->j_journal, full);
508 + status = jbd2_journal_wipe(journal->j_journal, full);
512 @@ -1229,19 +1233,19 @@ static int ocfs2_replay_journal(struct o
515 mlog(0, "calling journal_init_inode\n");
516 - journal = journal_init_inode(inode);
517 + journal = jbd2_journal_init_inode(inode);
518 if (journal == NULL) {
519 mlog(ML_ERROR, "Linux journal layer error\n");
524 - status = journal_load(journal);
525 + status = jbd2_journal_load(journal);
530 - journal_destroy(journal);
531 + jbd2_journal_destroy(journal);
535 @@ -1249,9 +1253,9 @@ static int ocfs2_replay_journal(struct o
537 /* wipe the journal */
538 mlog(0, "flushing the journal.\n");
539 - journal_lock_updates(journal);
540 - status = journal_flush(journal);
541 - journal_unlock_updates(journal);
542 + jbd2_journal_lock_updates(journal);
543 + status = jbd2_journal_flush(journal);
544 + jbd2_journal_unlock_updates(journal);
548 @@ -1272,7 +1276,7 @@ static int ocfs2_replay_journal(struct o
552 - journal_destroy(journal);
553 + jbd2_journal_destroy(journal);
556 /* drop the lock on this nodes journal */
557 --- a/fs/ocfs2/journal.h
558 +++ b/fs/ocfs2/journal.h
560 #define OCFS2_JOURNAL_H
562 #include <linux/fs.h>
563 -#include <linux/jbd.h>
564 +#ifndef CONFIG_OCFS2_COMPAT_JBD
565 +# include <linux/jbd2.h>
567 +# include <linux/jbd.h>
568 +# include "ocfs2_jbd_compat.h"
571 enum ocfs2_journal_state {
572 OCFS2_JOURNAL_FREE = 0,
573 @@ -215,8 +220,8 @@ static inline void ocfs2_checkpoint_inod
574 * buffer. Will have to call ocfs2_journal_dirty once
575 * we've actually dirtied it. Type is one of . or .
576 * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data.
577 - * ocfs2_journal_dirty_data - Indicate that a data buffer should go out before
578 - * the current handle commits.
579 + * ocfs2_jbd2_file_inode - Mark an inode so that its data goes out before
580 + * the current handle commits.
583 /* You must always start_trans with a number of buffs > 0, but it's
584 @@ -268,8 +273,10 @@ int ocfs2_journal_acces
586 int ocfs2_journal_dirty(handle_t *handle,
587 struct buffer_head *bh);
588 +#ifdef CONFIG_OCFS2_COMPAT_JBD
589 int ocfs2_journal_dirty_data(handle_t *handle,
590 struct buffer_head *bh);
595 @@ -430,4 +437,16 @@ static inline int ocfs2_calc_tree_trunc_
599 +static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode)
601 + return jbd2_journal_file_inode(handle, &OCFS2_I(inode)->ip_jinode);
604 +static inline int ocfs2_begin_ordered_truncate(struct inode *inode,
607 + return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode,
611 #endif /* OCFS2_JOURNAL_H */
612 --- a/fs/ocfs2/ocfs2.h
613 +++ b/fs/ocfs2/ocfs2.h
615 #include <linux/workqueue.h>
616 #include <linux/kref.h>
617 #include <linux/mutex.h>
618 -#include <linux/jbd.h>
619 +#ifndef CONFIG_OCFS2_COMPAT_JBD
620 +# include <linux/jbd2.h>
622 +# include <linux/jbd.h>
623 +# include "ocfs2_jbd_compat.h"
626 /* For union ocfs2_dlm_lksb */
627 #include "stackglue.h"
629 +++ b/fs/ocfs2/ocfs2_jbd_compat.h
631 +/* -*- mode: c; c-basic-offset: 8; -*-
632 + * vim: noexpandtab sw=8 ts=8 sts=0:
634 + * ocfs2_jbd_compat.h
636 + * Compatibility defines for JBD.
638 + * Copyright (C) 2008 Oracle. All rights reserved.
640 + * This program is free software; you can redistribute it and/or
641 + * modify it under the terms of the GNU General Public
642 + * License version 2 as published by the Free Software Foundation.
644 + * This program is distributed in the hope that it will be useful,
645 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
646 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
647 + * General Public License for more details.
650 +#ifndef OCFS2_JBD_COMPAT_H
651 +#define OCFS2_JBD_COMPAT_H
653 +#ifndef CONFIG_OCFS2_COMPAT_JBD
654 +# error Should not have been included
658 + unsigned int dummy;
661 +#define JBD2_BARRIER JFS_BARRIER
662 +#define JBD2_DEFAULT_MAX_COMMIT_AGE JBD_DEFAULT_MAX_COMMIT_AGE
664 +#define jbd2_journal_ack_err journal_ack_err
665 +#define jbd2_journal_clear_err journal_clear_err
666 +#define jbd2_journal_destroy journal_destroy
667 +#define jbd2_journal_dirty_metadata journal_dirty_metadata
668 +#define jbd2_journal_errno journal_errno
669 +#define jbd2_journal_extend journal_extend
670 +#define jbd2_journal_flush journal_flush
671 +#define jbd2_journal_force_commit journal_force_commit
672 +#define jbd2_journal_get_write_access journal_get_write_access
673 +#define jbd2_journal_get_undo_access journal_get_undo_access
674 +#define jbd2_journal_init_inode journal_init_inode
675 +#define jbd2_journal_invalidatepage journal_invalidatepage
676 +#define jbd2_journal_load journal_load
677 +#define jbd2_journal_lock_updates journal_lock_updates
678 +#define jbd2_journal_restart journal_restart
679 +#define jbd2_journal_start journal_start
680 +#define jbd2_journal_start_commit journal_start_commit
681 +#define jbd2_journal_stop journal_stop
682 +#define jbd2_journal_try_to_free_buffers journal_try_to_free_buffers
683 +#define jbd2_journal_unlock_updates journal_unlock_updates
684 +#define jbd2_journal_wipe journal_wipe
685 +#define jbd2_log_wait_commit log_wait_commit
687 +static inline int jbd2_journal_file_inode(handle_t *handle,
688 + struct jbd2_inode *inode)
693 +static inline int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode,
699 +static inline void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode,
700 + struct inode *inode)
705 +static inline void jbd2_journal_release_jbd_inode(journal_t *journal,
706 + struct jbd2_inode *jinode)
712 +#endif /* OCFS2_JBD_COMPAT_H */
713 --- a/fs/ocfs2/super.c
714 +++ b/fs/ocfs2/super.c
715 @@ -212,10 +212,11 @@ static int ocfs2_sync_fs(struct super_bl
716 ocfs2_schedule_truncate_log_flush(osb, 0);
719 - if (journal_start_commit(OCFS2_SB(sb)->journal->j_journal, &target)) {
720 + if (jbd2_journal_start_commit(OCFS2_SB(sb)->journal->j_journal,
723 - log_wait_commit(OCFS2_SB(sb)->journal->j_journal,
725 + jbd2_log_wait_commit(OCFS2_SB(sb)->journal->j_journal,
730 @@ -332,6 +333,7 @@ static struct inode *ocfs2_alloc_inode(s
734 + jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
735 return &oi->vfs_inode;
738 @@ -895,7 +897,7 @@ static int ocfs2_parse_options(struct su
742 - option = JBD_DEFAULT_MAX_COMMIT_AGE;
743 + option = JBD2_DEFAULT_MAX_COMMIT_AGE;
744 mopt->commit_interval = HZ * option;
747 --- a/fs/ocfs2/uptodate.c
748 +++ b/fs/ocfs2/uptodate.c
750 #include <linux/highmem.h>
751 #include <linux/buffer_head.h>
752 #include <linux/rbtree.h>
753 -#include <linux/jbd.h>
754 +#ifndef CONFIG_OCFS2_COMPAT_JBD
755 +# include <linux/jbd2.h>
757 +# include <linux/jbd.h>
760 #define MLOG_MASK_PREFIX ML_UPTODATE