From: Andreas Dilger <adilger@sun.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: Sun, 16 Nov 2008 18:04:45 -0600 [thread overview]
Message-ID: <20081117000445.GA3436@webber.adilger.int> (raw)
In-Reply-To: <1226431111.4444.41.camel@bobble.smo.corp.google.com>
On Nov 11, 2008 11:18 -0800, Frank Mayhar wrote:
> +static inline int ext4_handle_valid(handle_t *handle)
> +{
> + if (!handle)
> + return 0;
My preference is to use "if (handle == NULL)", because handle is not a
boolean.
> + if (handle->h_transaction == NULL)
> + return 0;
Does this ever happen? Ah, is this the case where the handle is pointing
to the ext4_sb_info()? I think I'd prefer to have a magic value here,
so that it isn't possible to accidentally dereference a pointer that
happens to have NULL data in it.
> +static inline int ext4_handle_dirty_metadata(handle_t *handle,
> + struct inode *inode, struct buffer_head *bh)
> +{
> + int err = 0;
> +
> + if (ext4_handle_valid(handle)) {
> + err = __ext4_journal_dirty_metadata(__func__, handle, bh);
> + } else {
> + err = __ext4_write_dirty_metadata(inode, bh);
> + }
You don't need to initialize "err = 0" here.
> struct ext4_sb_info {
> + int *s_nojournal_flag; /* Null to indicate "not a handle" */
I don't really see where and how this is used.
> @@ -97,6 +97,8 @@
> {
Please, in the future use "diff -up" so that it includes the function
names in the patch context. Without the function names it is difficult
to know what is being changed by the patch.
> @@ -4657,7 +4659,7 @@
> - if (metadata) {
> + if (ext4_handle_valid(handle) && metadata) {
It is probably a tiny bit more efficient to check "metadata" first.
> @@ -136,13 +136,16 @@
> + if (journal) {
> + if (is_journal_aborted(journal)) {
> + ext4_abort(sb, __func__,
> + "Detected aborted journal");
> + return ERR_PTR(-EROFS);
> + }
> + return jbd2_journal_start(journal, nblocks);
> }
> + current->journal_info = (handle_t *)EXT4_SB(sb);
> + return current->journal_info;
So, this appears to be the place where ext4_sb_info->s_nojournal_flag is
actually used. To make this more clear, it would be better to do actually
reference this variable here so that it is easier for the reader to follow.
current->journal_info = &EXT4_SB(sb)->s_nojournal_flag;
> @@ -588,7 +599,8 @@
> }
> #endif
> ext4_discard_preallocations(inode);
> + if (EXT4_SB(inode->i_sb)->s_journal)
I think this is the same thing as EXT4_JOURNAL(inode)?
> static void ext4_write_super(struct super_block *sb)
> {
> + if (EXT4_SB(sb)->s_journal) {
> + if (mutex_trylock(&sb->s_lock) != 0)
> + BUG();
> + sb->s_dirt = 0;
> + }
> + else
> + ext4_commit_super(sb, EXT4_SB(sb)->s_es, 1);
This should be "} else { ... }"
> + /*
> + * We don't want to clear needs_recovery flag when we failed
> + * to flush the journal.
> + */
> + if (jbd2_journal_flush(journal) < 0)
> + return;
This comment needs to be wrapped at 80 columns.
I like this patch a lot better than the previous one. It remains very
readable, and isn't too intrusive to the code.
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
next prev parent reply other threads:[~2008-11-17 0:05 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 [this message]
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
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=20081117000445.GA3436@webber.adilger.int \
--to=adilger@sun.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).