public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@turbolabs.com>
To: Alexander Viro <viro@math.psu.edu>
Cc: Stephen Tweedie <sct@redhat.com>,
	ext2-devel@lists.sourceforge.net, m@mo.optusnet.com.au,
	Andrew Morton <akpm@zip.com.au>,
	"Albert D. Cahalan" <acahalan@cs.uml.edu>,
	Mike Fedyk <mfedyk@matchmail.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [Ext2-devel] ext2/ialloc.c cleanup
Date: Wed, 7 Nov 2001 12:34:30 -0700	[thread overview]
Message-ID: <20011107123430.D5922@lynx.no> (raw)
In-Reply-To: <20011106214821.N4137@redhat.com> <Pine.GSO.4.21.0111061808440.29465-100000@weyl.math.psu.edu>
In-Reply-To: <Pine.GSO.4.21.0111061808440.29465-100000@weyl.math.psu.edu>; from viro@math.psu.edu on Tue, Nov 06, 2001 at 06:17:09PM -0500

On Nov 06, 2001  18:17 -0500, Alexander Viro wrote:
> 	Folks, promised cleanup of ialloc.c is on
> ftp.math.psu.edu:pub/viro/ialloc.c,v
> 
> And yes, it's in RCS.  The thing is split into _really_ small
> steps (commented in the log).  Each is a trivial transformation
> and it should be very easy to verify correctness of any of
> them.
> 
> Please, review.  IMO it's cut fine enough to make the gradual merge
> possible for 2.4 - look and you'll see.

Minor nits, from my changes to this same function:
1) please replace use of "i" for best block group in find_cg_*, to
   something better like "group", just for clarity.
2) in find_cg_*, when you fail the quadratic search, the linear search
   should skip groups that were previously checked in the quadratic search,
   with slight changes to both loops:

	start = dir->u.ext2_i.i_block_group;

	/* Use quadratic hash to find group with a free inode */
	for (j = 1; j < count; j <<= 1) {
		group = start + j;
		if (group >= count)
			group -= count;
		cg = ext2_get_group_desc(sb, group, &bh);
		if (cg && le16_to_cpu(cg->bg_free_inodes_count))
			goto found;
	}

	/* That failed: try linear search for a free inode
	 * skipping groups we checked in the previous loop.
	 */
	for (j = 3; j < count; j++) {
		if ((j & (j - 1)) == 0)
			continue;
		group = start + j;
		if (group > count)
			group -= count;
		cg = ext2_get_group_desc(sb, group, &bh);
		if (cg && le16_to_cpu(cg->bg_free_inodes_count))
			goto found;
	}
3) I know that "cylinder groups" were used in old FFS/whatever implementation,
   but all of the ext2 code/documentation refers to these as block groups.
   Can you stick with that for ext2 (e.g. gdp, not cg; bg_foo, not cg_foo)?
4) sbi can be gotten by "EXT2_SB(sb)".

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/


  reply	other threads:[~2001-11-07 19:38 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-05  2:13 disk throughput Andrew Morton
2001-11-05  3:20 ` Mohammad A. Haque
2001-11-05  3:31   ` Andrew Morton
2001-11-05  3:32 ` [Ext2-devel] " Mike Fedyk
2001-11-05  3:45   ` Andrew Morton
2001-11-05  4:39     ` Mike Fedyk
2001-11-05  7:06     ` Jens Axboe
2001-11-05  7:14       ` Andrew Morton
2001-11-05  7:26         ` Jens Axboe
2001-11-05  7:14       ` Mike Fedyk
2001-11-05  7:18         ` Jens Axboe
2001-11-05  7:18       ` Jens Axboe
2001-11-05  9:14         ` Mike Fedyk
2001-11-05  9:20           ` Jens Axboe
2001-11-05  5:54   ` Albert D. Cahalan
2001-11-05  8:04     ` Andrew Morton
2001-11-05 12:28       ` Matthias Andree
2001-11-05 14:23       ` Alexander Viro
2001-11-05 22:22         ` Andrew Morton
2001-11-05 22:41           ` Andreas Dilger
2001-11-05 22:53             ` Andrew Morton
2001-11-08 15:28               ` Constantin Loizides
2001-11-05 23:14             ` Dan Hollis
2001-11-06 10:52           ` Daniel Phillips
2001-11-06 16:17             ` Jeremy Fitzhardinge
2001-11-08 15:24               ` Constantin Loizides
2001-11-08 16:46                 ` Jeremy Fitzhardinge
2001-11-09  6:08                   ` Andrew Morton
2001-11-09  8:49                     ` Jeremy Fitzhardinge
2001-11-06 21:45           ` Stephen Tweedie
2001-11-05 20:16       ` Andreas Dilger
2001-11-05 20:28         ` m
2001-11-05 21:39           ` Andrew Morton
2001-11-05 22:59             ` Linus Torvalds
2001-11-05 23:36               ` Alexander Viro
2001-11-05 23:50                 ` Linus Torvalds
2001-11-06  0:03                   ` Linus Torvalds
2001-11-06  1:33                     ` Alexander Viro
2001-11-06  2:10                       ` Linus Torvalds
2001-11-06  3:02                         ` Alexander Viro
2001-11-06  8:39                           ` Alan Cox
2001-11-06  8:37                             ` Alexander Viro
2001-11-06  8:48                               ` Andrew Morton
2001-11-06  3:49                         ` Alexander Viro
2001-11-06  4:01                           ` Linus Torvalds
2001-11-06  4:21                             ` Alexander Viro
2001-11-06  5:01                               ` Linus Torvalds
2001-11-06  5:31                                 ` Andrew Morton
2001-11-06  5:48                                   ` Linus Torvalds
2001-11-06  7:34                                     ` Mike Castle
2001-11-06  7:10                                   ` Kai Henningsen
2001-11-09 22:35                       ` Riley Williams
2001-11-06  1:28                   ` Alexander Viro
2001-11-06  9:16                     ` Wojtek Pilorz
2001-11-06  9:58                       ` Alexander Viro
2001-11-08 12:51                   ` Pavel Machek
2001-11-06 21:48           ` Stephen Tweedie
2001-11-06 23:17             ` ext2/ialloc.c cleanup Alexander Viro
2001-11-07 19:34               ` Andreas Dilger [this message]
2001-11-07 20:02                 ` [Ext2-devel] " Alexander Viro
2001-11-08  2:06                   ` Andrew Morton
2001-11-08 20:45                     ` Andrew Morton
2001-11-08 22:16                       ` Alexander Viro
2001-11-08 22:43                         ` Andreas Dilger
2001-11-08 23:08                           ` Alexander Viro
2001-11-09  6:15                             ` Andrew Morton
2001-11-09  6:56                               ` Andreas Dilger
2001-11-09  7:09                                 ` Andrew Morton
2001-11-09  7:12                                 ` Alexander Viro
2001-11-09  7:18                                   ` Andrew Morton
2001-11-05  9:45     ` [Ext2-devel] disk throughput Alex Bligh - linux-kernel
2001-11-05  9:58       ` Alex Bligh - linux-kernel
2001-11-05  8:47 ` Jan Kara
2001-11-05  8:50   ` [Ext2-devel] " Mike Fedyk
2001-11-05  9:01     ` Jan Kara
2001-11-05 12:23 ` Matthias Andree
2001-11-05 22:39   ` Andrew Morton
2001-11-05 23:41     ` Matthias Andree

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=20011107123430.D5922@lynx.no \
    --to=adilger@turbolabs.com \
    --cc=acahalan@cs.uml.edu \
    --cc=akpm@zip.com.au \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m@mo.optusnet.com.au \
    --cc=mfedyk@matchmail.com \
    --cc=sct@redhat.com \
    --cc=viro@math.psu.edu \
    /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