Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jan 2015 20:26:27 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277340 - head/sys/fs/ext2fs
Message-ID:  <201501182026.t0IKQR9Z032903@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sun Jan 18 20:26:27 2015
New Revision: 277340
URL: https://svnweb.freebsd.org/changeset/base/277340

Log:
  Remove dead code.
  
  After the ext2 variant of the "orlov allocator" was implemented,
  the case for a negative or zero dirsize disappeared.
  
  Drop the dead code and unsign dirsize given that it can't be
  negative anyways.
  
  CID:		1008669
  MFC after:	1 week

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c	Sun Jan 18 20:25:41 2015	(r277339)
+++ head/sys/fs/ext2fs/ext2_alloc.c	Sun Jan 18 20:26:27 2015	(r277340)
@@ -443,11 +443,11 @@ static u_long
 ext2_dirpref(struct inode *pip)
 {
 	struct m_ext2fs *fs;
-	int cg, prefcg, dirsize, cgsize;
+	int cg, prefcg, cgsize;
 	u_int avgifree, avgbfree, avgndir, curdirsize;
 	u_int minifree, minbfree, maxndir;
 	u_int mincg, minndir;
-	u_int maxcontigdirs;
+	u_int dirsize, maxcontigdirs;
 
 	mtx_assert(EXT2_MTX(pip->i_ump), MA_OWNED);
 	fs = pip->i_e2fs;
@@ -498,10 +498,7 @@ ext2_dirpref(struct inode *pip)
 	curdirsize = avgndir ? (cgsize - avgbfree * fs->e2fs_bsize) / avgndir : 0;
 	if (dirsize < curdirsize)
 		dirsize = curdirsize;
-	if (dirsize <= 0)
-		maxcontigdirs = 0;		/* dirsize overflowed */
-	else
-		maxcontigdirs = min((avgbfree * fs->e2fs_bsize) / dirsize, 255);
+	maxcontigdirs = min((avgbfree * fs->e2fs_bsize) / dirsize, 255);
 	maxcontigdirs = min(maxcontigdirs, fs->e2fs_ipg / AFPDIR);
 	if (maxcontigdirs == 0)
 		maxcontigdirs = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501182026.t0IKQR9Z032903>