linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peng Tao <bergwolf@gmail.com>
To: Frank Mayhar <fmayhar@google.com>
Cc: linux-ext4@vger.kernel.org, Michael Rubin <mrubin@google.com>
Subject: Re: [RFC PATCH 1/1] Allow ext4 to run without a journal, take 2.
Date: Thu, 27 Nov 2008 15:57:46 +0800	[thread overview]
Message-ID: <492E52FA.7070705@gmail.com> (raw)
In-Reply-To: <1226431111.4444.41.camel@bobble.smo.corp.google.com>


[-- Attachment #1.1: Type: text/plain, Size: 3228 bytes --]

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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  parent reply	other threads:[~2008-11-27  7:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30 20:08 [RFC PATCH 1/1] Allow ext4 to run without a journal Frank Mayhar
2008-10-30 23:40 ` Andreas Dilger
2008-10-31  0:06   ` Michael Rubin
2008-10-31  4:20   ` Frank Mayhar
2008-10-31 21:55   ` Frank Mayhar
2008-11-04 21:21   ` Frank Mayhar
2008-11-04 23:38     ` Andreas Dilger
2008-11-11 19:18 ` [RFC PATCH 1/1] Allow ext4 to run without a journal, take 2 Frank Mayhar
2008-11-17  0:04   ` Andreas Dilger
2008-11-17 17:20     ` Frank Mayhar
2008-11-17 18:08       ` Andreas Dilger
2008-11-17 18:11         ` Frank Mayhar
2008-11-27  7:57   ` Peng Tao [this message]
2008-12-01 17:33     ` Frank Mayhar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=492E52FA.7070705@gmail.com \
    --to=bergwolf@gmail.com \
    --cc=fmayhar@google.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mrubin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).