linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Mon, 17 Nov 2008 12:08:01 -0600	[thread overview]
Message-ID: <20081117180801.GC3146@webber.adilger.int> (raw)
In-Reply-To: <1226942458.23804.10.camel@bobble.smo.corp.google.com>

On Nov 17, 2008  09:20 -0800, Frank Mayhar wrote:
> > > +	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.
> 
> So some magic value that gets stuffed into the pointer?  Or just a magic
> pointer value that gets stuffed into 'handle'?

I mean a magic value that is stuffed into the s_nojournal_flag pointer
instead of just using NULL (which is a very common value of pointers to
random memory).  Ideally this value will be chosen in a way that it is
unlikely to be a valid pointer (e.g. 0x01234567 for 32-bit machines,
0x0123456789abcdef for 64-bit machines).

> > 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;
> 
> Hmm.  Okay, I'll have to think about this a bit; I haven't had my coffee
> yet.

This is functionally equivalent to the method you are using (i.e. it stores
the pointer to the start of the struct), except that it allows the reader
to find where this field is used.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


  reply	other threads:[~2008-11-17 18:08 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 [this message]
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=20081117180801.GC3146@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).