Re: [RFC PATCH 1/1] Allow ext4 to run without a journal, take 2.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Frank

I somehow managed to apply your patch against v2.6.28-rc3 kernel. With
some small modifications, it worked just as supposed.

now, I have tested the modified patch in three ways, so far so good:
1. mount an ext2 fs image as ext4 and muck about with it. Then mount it
as ext2
2. unmark an ext4 image's has_journal flag and mount it as ext4, and
compile a kernel and delete all files on it.
3. mount a normal ext4 image, and compile a kernel and delete all files
on it.

Frank Mayhar wrote:
>  
> +static inline int ext4_journal_max_transaction_buffers(struct inode *inode)
> +{
> +	/*
> +	 * max transaction buffers
> +	 * calculation based on
> +	 * journal->j_max_transaction_buffers = journal->j_maxlen / 4;
> +	 */
> +	if (EXT4_JOURNAL(inode) != NULL)
> +		return (EXT4_JOURNAL(inode))->j_maxlen / 4;
> +	return 0;
> +}
I didn't see where/how this is used. So I dropped it.
> @@ -195,7 +203,8 @@
>  	handle_t *handle;
>  	int err;
>  
> -	if (ext4_should_order_data(inode))
> +	if (EXT4_JOURNAL(inode) != NULL &&
this is already checked in ext4_should_order_data(inode). So no need to
test it twice.
 > @@ -3493,7 +3503,7 @@
>  		 * the block was cleared. Check for this instead of OOPSing.
>  		 */
>  		if (bh2jh(this_bh))
> -			ext4_journal_dirty_metadata(handle, this_bh);
> +			ext4_handle_dirty_metadata(handle, inode, this_bh);
>  		else
>  			ext4_error(inode->i_sb, __func__,
>  				   "circular indirect block detected, "
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
one more check is needed here so that ext4_free_data doesn't print false
error messages in no-journal mode.
@@ -3515,7 +3515,7 @@ static void ext4_free_data(handle_t *handle,
struct inode *inode,
                 * block pointed to itself, it would have been detached when
                 * the block was cleared. Check for this instead of OOPSing.
                 */
-               if (bh2jh(this_bh))
+               if (!ext4_handle_valid(handle) || bh2jh(this_bh))
                        ext4_handle_dirty_metadata(handle, inode, this_bh);
                else
                        ext4_error(inode->i_sb, __func__,
> --- fs/ext4/mballoc.c#3
> +++ fs/ext4/mballoc.c
I noticed that one more change is needed here also.
@@ -2551,7 +2551,8 @@ int ext4_mb_init(struct super_block *sb, int
needs_recovery)
 	ext4_mb_init_per_dev_proc(sb);
 	ext4_mb_history_init(sb);

-	sbi->s_journal->j_commit_callback = release_blocks_on_commit;
+	if (sbi->s_journal)
+		sbi->s_journal->j_commit_callback = release_blocks_on_commit;

 	printk(KERN_INFO "EXT4-fs: mballoc enabled\n");
 	return 0;
> @@ -2484,6 +2513,8 @@
> {
>        struct ext4_sb_info *sbi = EXT4_SB(sb);
>
> +       BUG_ON(sbi->s_journal == NULL);
This will always trigger because at mount time sbi->s_journal is set
*after* ext4_get_journal when mounting ext4 image with journal.
> +
>       if (sbi->s_commit_interval)
>                journal->j_commit_interval = sbi->s_commit_interval;
>        /* We could also set up an ext4-specific default for the commit

-- 
Cheers,

Bergwolf

Here lieth one whose name was writ on water.



























Attachment: signature.asc
Description: PGP signature

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux