Skip to contentSkip to conversation

ocfs2_jbd2.patch for linux-2.6.26

Ocfs2-devel Sabuj Pattanayek 2 participants 2 messages Jul 17, 2008 OCFS2

lore
Share & tools
lore
#0 lore raw

Hi all,

Here's a patch to make OCFS2 work with JBD2, i.e. so we can create volumes greater than 16T. Patch and compile against the 2.6.26 mainline kernel sources:

fs/ocfs2/ocfs2.h renamed from fs/ocfs2/ocfs2.h.old +1 -1
@@ -34,7 +34,7 @@
 #include <linux/workqueue.h>
 #include <linux/kref.h>
 #include <linux/mutex.h>
-#include <linux/jbd.h>
+#include <linux/jbd2.h>
 
 /* For union ocfs2_dlm_lksb */
 #include "stackglue.h"
fs/ocfs2/aops.c renamed from fs/ocfs2/aops.c.old +2 -2
@@ -662,7 +662,7 @@
 {
 	journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;
 
-	journal_invalidatepage(journal, page, offset);
+	jbd2_journal_invalidatepage(journal, page, offset);
 }
 
 static int ocfs2_releasepage(struct page *page, gfp_t wait)
@@ -671,7 +671,7 @@
 
 	if (!page_has_buffers(page))
 		return 0;
-	return journal_try_to_free_buffers(journal, page, wait);
+	return jbd2_journal_try_to_free_buffers(journal, page, wait);
 }
 
 static ssize_t ocfs2_direct_IO(int rw,
fs/ocfs2/journal.c renamed from fs/ocfs2/journal.c.old +31 -31

196 lines not on this page · raw message

fs/ocfs2/journal.h renamed from fs/ocfs2/journal.h.old +1 -1
@@ -27,7 +27,7 @@
 #define OCFS2_JOURNAL_H
 
 #include <linux/fs.h>
-#include <linux/jbd.h>
+#include <linux/jbd2.h>
 
 enum ocfs2_journal_state {
 	OCFS2_JOURNAL_FREE = 0,
fs/ocfs2/super.c renamed from fs/ocfs2/super.c.old +5 -5
@@ -205,9 +205,9 @@
 		ocfs2_schedule_truncate_log_flush(osb, 0);
 	}
 
-	if (journal_start_commit(OCFS2_SB(sb)->journal->j_journal, &target)) {
+	if (jbd2_journal_start_commit(OCFS2_SB(sb)->journal->j_journal, &target)) {
 		if (wait)
-			log_wait_commit(OCFS2_SB(sb)->journal->j_journal,
+			jbd2_log_wait_commit(OCFS2_SB(sb)->journal->j_journal,
 					target);
 	}
 	return 0;
@@ -873,7 +873,7 @@
 			if (option < 0)
 				return 0;
 			if (option == 0)
-				option = JBD_DEFAULT_MAX_COMMIT_AGE;
+				option = JBD2_DEFAULT_MAX_COMMIT_AGE;
 			mopt->commit_interval = HZ * option;
 			break;
 		case Opt_localalloc:
@@ -1536,9 +1536,9 @@
 	}
 
 	if (ocfs2_clusters_to_blocks(osb->sb, le32_to_cpu(di->i_clusters) - 1)
-	    > (u32)~0UL) {
+	    > (u64)~0UL) {
 		mlog(ML_ERROR, "Volume might try to write to blocks beyond "
-		     "what jbd can address in 32 bits.\n");
+		     "what jbd2 can address in 64 bits.\n");
 		status = -EINVAL;
 		goto bail;
 	}
fs/ocfs2/file.c renamed from fs/ocfs2/file.c.old +2 -2
@@ -184,7 +184,7 @@
 		goto bail;
 
 	journal = osb->journal->j_journal;
-	err = journal_force_commit(journal);
+	err = jbd2_journal_force_commit(journal);
 
 bail:
 	mlog_exit(err);
@@ -2040,7 +2040,7 @@
 		 */
 		if (old_size != i_size_read(inode) ||
 		    old_clusters != OCFS2_I(inode)->ip_clusters) {
-			ret = journal_force_commit(osb->journal->j_journal);
+			ret = jbd2_journal_force_commit(osb->journal->j_journal);
 			if (ret < 0)
 				written = ret;
 		}
fs/ocfs2/uptodate.c renamed from fs/ocfs2/uptodate.c.old +1 -1
@@ -53,7 +53,7 @@
 #include <linux/highmem.h>
 #include <linux/buffer_head.h>
 #include <linux/rbtree.h>
-#include <linux/jbd.h>
+#include <linux/jbd2.h>
 
 #define MLOG_MASK_PREFIX ML_UPTODATE
 

More patches and testing dumps will be posted in the ocfs2-tools-devel list for mkfs.ocfs2 and tunefs.ocfs2 .

Cheers,
Sabuj Pattanayek (t35t0r/irc.freenode.net/#linux-cluster) Center For Structural Biology, Senior SysAdmin
http://structbio.vanderbilt.edu

#1 lore raw

Hi Sabuj!

Quoted 5 lines · Sabuj Pattanayek

Hi all,

Here's a patch to make OCFS2 work with JBD2, i.e. so we can create volumes greater than 16T. Patch and compile against the 2.6.26 mainline kernel sources:

Thanks for this patch - it's been on the Ocfs2 todo list for some time now. We all appreciate you sending this along.

A couple of thoughts:

- We can't drop JBD completely as your patch does - some users might not want to upgrade to JBD2 for various reasons, one of which is that it isn't as tested as JBD.

- We need to avoid creating new inodes above the 32 bit boundary, unless explicitly told that it's ok via a mount option. This is so that we don't return duplicate inode numbers on systems which only have a 32 bit st_ino value (see stat(2)).

- An incompat bit for file systems with JBD2 journals might be a good idea.

So, to fix things up so that we can use either JBD or JBD2 (only one, chosen at compile time), I think we should just add a file 'jbd_compat.h' to fs/ocfs2 which contains a set of wrapper functions. The set of wrappers chosen of course, depends on whether JBD2 support is picked at config time.

Regarding the 32 bit inode issue, we can use the "inode64" mount option as implemented by XFS. From "man mount":

inode64
Indicates that XFS is allowed to create inodes at any location in the filesystem, including those which will result in inode numbers occupying more than 32 bits of significance. This is provided for backwards compatibility, but causes problems for backup applications that cannot handle large inode numbers.

Handling this properly just means we don't create new inode groups above the 32 bit boundary. The easiest way to do this would be to add a single value to struct ocfs2_alloc_context, 'ac_alloc_32bit'. ocfs2_reserve_new_inode() could set it if the 'inode64' mount option wasn't specified.

Internally, ocfs2_reserve_local_alloc_bits() would return -ENOSPC if the it sees the bit and the local alloc starts past the boundary. Similarly, ocfs2_cluster_group_search() could be updated to return -ENOSPC if the cluster group ends beyond that same boundary.

So, making JBD2 optional and the inode64 mount option are the two things I'd like to see before accepting such a patch upstream. If you have the time and inclination to follow this through, I and the other Ocfs2 developers will gladly assist you at every step in the process.

Thanks,

	--Mark

--
Mark Fasheh