All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@MIT.EDU>
To: Celine Bourde <celine.bourde@bull.net>
Cc: linux-ext4@vger.kernel.org, "Jose R. Santos" <jrs@us.ibm.com>,
	cmm@us.ibm.com, "Frédéric Bohé" <frederic.bohe@bull.net>,
	"SOLOFO RAMANGALAHY" <Solofo.Ramangalahy@bull.net>,
	"Jean-Pierre Dion" <jean-pierre.dion@bull.net>
Subject: Re: [PATCH][e2fsprogs][mke2fs] fix FLEX_BG offset
Date: Mon, 7 Jul 2008 12:46:07 -0400	[thread overview]
Message-ID: <20080707164607.GO31490@mit.edu> (raw)
In-Reply-To: <486C8BEE.5030200@bull.net>

On Thu, Jul 03, 2008 at 10:21:02AM +0200, Celine Bourde wrote:
> This patch resolves the offset problem of the flex_bg
> option when you use mke2fs tool.

Actually, I think the problem is a bigger one.  Ext2fs_get_free_blocks()
returns a error code on failure.  So the code before the conditional
you modified is totally bogus:

	/* Find the first available block */
	if (ext2fs_get_free_blocks(fs, start_blk, last_blk, 1, bmap,
				   &first_free))
		return first_free;

	if (ext2fs_get_free_blocks(fs, first_free + offset, last_blk, size,
				   bmap, &first_free))
		return first_free;

	return first_free;

I think this should be instead:

	/* Find the first available block */
	if (ext2fs_get_free_blocks(fs, start_blk, last_blk, 1, bmap,
				   &first_free) == 0)
		return first_free;

	if (ext2fs_get_free_blocks(fs, first_free + offset, last_blk, size,
				   bmap, &first_free) == 0)
		return first_free;

	/* 
	 * Oops, we weren't able to find enough space.  We return 
	 * first_free as a best try.
	 */

	return first_free;

							- Ted

      parent reply	other threads:[~2008-07-07 16:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-03  8:21 [PATCH][e2fsprogs][mke2fs] fix FLEX_BG offset Celine Bourde
2008-07-03 11:55 ` Jose R. Santos
2008-07-07 19:42   ` Jose R. Santos
2008-07-07 22:30     ` Theodore Tso
2008-07-07 16:46 ` Theodore Tso [this message]

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=20080707164607.GO31490@mit.edu \
    --to=tytso@mit.edu \
    --cc=Solofo.Ramangalahy@bull.net \
    --cc=celine.bourde@bull.net \
    --cc=cmm@us.ibm.com \
    --cc=frederic.bohe@bull.net \
    --cc=jean-pierre.dion@bull.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.