linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: "Jose R. Santos" <jrs@us.ibm.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [RFC PATCH 8/9][e2fsprogs] Add 64-bit closefs interface.
Date: Mon, 12 May 2008 15:29:35 -0400	[thread overview]
Message-ID: <20080512192935.GJ7029@mit.edu> (raw)
In-Reply-To: <20080512122443.7ef72b19@gara>

On Mon, May 12, 2008 at 12:24:43PM -0500, Jose R. Santos wrote:
> 
> I thought that we concluded that ext2fs_super_and_bgd_loc() would not
> do the right thing which is the reason that ext2fs_super_and_bgd_loc2()
> returns just the number of groups used by super block and group
> descriptors.  Right now, ext2fs_super_and_bgd_loc() works the same as
> it has before, and the new ext2fs_super_and_bgd_loc2() would do the
> right thing here by not assuming inode tables and bitmaps are located
> in the block group.
> 

I dealt with the situation by having ext2fs_initialize back out the
inode table accounting, which worked around the problem, and indeed
that's the only place where the numblocks value is even used.  So my
point is that if you make the change in ext2fs_super_and_bgd_loc2(),
it will have ripple effects to at least ext2fs_initialize() --- it
would not be safe to just change ext2fs_super_and_bgd_loc to
ext2fs_super_and_bgd_loc2, since you're making semantic change to what
the function actually returns.  

So by not including the change in ext2fs_initialize(), and because
ext2fs_initialize() doesn't call ext2fs_super_and_bgd_loc2() directly,
but indirectly through ext2fs_reserve_super_and_bgd(), we're setting
ourselves up to forget to make this change, and thus introduce a bug.
This is *especially* true since ext2fs_reserve_super_and_bgd() would
apparently not need to be changed since it doesn't return a blk_t ---
so it would be a case where the function wouldn't change, but its
behaviour (via its return code) would be changing, which is dangerous.

Practicing defensive programming is a good thing here, which is why I
suggested making it return numblocks via a pointer, and then very
carefully *documenting* what the new parameter contains, and then
documenting the change in ext2fs_reserve_super_and_bgd2(), and then in
turn to ext2fs_initialize(), is just a much safer way to go.  

     			     	       	    - Ted

  reply	other threads:[~2008-05-12 19:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09 16:39 [RFC PATCH 0/9][e2fsprogs] Initial blk64_t capable API calls Jose R. Santos
2008-05-09 16:39 ` [RFC PATCH 1/9][e2fsprogs] Add ext2_off64_t type Jose R. Santos
2008-05-09 16:39 ` [RFC PATCH 2/9][e2fsprogs] Use blk64_t for blocks in struct ext2_file Jose R. Santos
2008-05-09 16:39 ` [RFC PATCH 3/9][e2fsprogs] Add 64-bit dirblock interface Jose R. Santos
2008-05-09 16:39 ` [RFC PATCH 4/9][e2fsprogs] Add 64-bit alloc_stats interface Jose R. Santos
2008-05-12 14:43   ` Theodore Tso
2008-05-12 17:25     ` Jose R. Santos
2008-05-09 16:39 ` [RFC PATCH 5/9][e2fsprogs] Add 64-bit alloc interface Jose R. Santos
2008-05-09 16:40 ` [RFC PATCH 6/9][e2fsprogs] Add 64-bit ext_attr interface Jose R. Santos
2008-05-12 14:47   ` Theodore Tso
2008-05-09 16:40 ` [RFC PATCH 7/9][e2fsprogs] Add new blk64_t handling inline functions Jose R. Santos
2008-05-12 14:49   ` Theodore Tso
2008-05-12 17:25     ` Jose R. Santos
2008-05-12 19:22       ` Theodore Tso
2008-05-09 16:40 ` [RFC PATCH 8/9][e2fsprogs] Add 64-bit closefs interface Jose R. Santos
2008-05-12 15:05   ` Theodore Tso
2008-05-12 17:24     ` Jose R. Santos
2008-05-12 19:29       ` Theodore Tso [this message]
2008-05-09 16:40 ` [RFC PATCH 9/9][e2fsprogs] Add 64-bit openfs interface Jose R. Santos

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=20080512192935.GJ7029@mit.edu \
    --to=tytso@mit.edu \
    --cc=jrs@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    /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).