svn commit: r246563 - head/sys/fs/ext2fs

Pedro F. Giffuni pfg at FreeBSD.org
Fri Feb 8 20:58:01 UTC 2013


Author: pfg
Date: Fri Feb  8 20:58:00 2013
New Revision: 246563
URL: http://svnweb.freebsd.org/changeset/base/246563

Log:
  ext2fs: make e2fs_maxcontig local and remove tautological check.
  
  e2fs_maxcontig was modelled after UFS when bringing the
  "Orlov allocator" to ext2. On UFS fs_maxcontig is kept in the
  superblock and is used by userland tools (fsck and growfs),
  
  In ext2 this information is volatile so it is not available
  for userland tools, so in this case it doesn't have sense
  to carry it in the in-memory superblock.
  
  Also remove a pointless check for MAX(1, x) > 0.
  
  Submitted by:	Christoph Mallon
  MFC after:	2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_vfsops.c
  head/sys/fs/ext2fs/ext2fs.h

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vfsops.c	Fri Feb  8 20:30:19 2013	(r246562)
+++ head/sys/fs/ext2fs/ext2_vfsops.c	Fri Feb  8 20:58:00 2013	(r246563)
@@ -527,6 +527,7 @@ ext2_mountfs(struct vnode *devvp, struct
 	int ronly;
 	int i, size;
 	int32_t *lp;
+	int32_t e2fs_maxcontig;
 
 	ronly = vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0);
 	/* XXX: use VOP_ACESS to check FS perms */
@@ -601,12 +602,8 @@ ext2_mountfs(struct vnode *devvp, struct
 	 * in ext2fs doesn't have these variables, so we can calculate 
 	 * them here.
 	 */
-	ump->um_e2fs->e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize);
-	if (ump->um_e2fs->e2fs_maxcontig > 0)
-		ump->um_e2fs->e2fs_contigsumsize =
-		    MIN(ump->um_e2fs->e2fs_maxcontig, EXT2_MAXCONTIG);
-	else
-		ump->um_e2fs->e2fs_contigsumsize = 0;
+	e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize);
+	ump->um_e2fs->e2fs_contigsumsize = MIN(e2fs_maxcontig, EXT2_MAXCONTIG);
 	if (ump->um_e2fs->e2fs_contigsumsize > 0) {
 		size = ump->um_e2fs->e2fs_gcount * sizeof(int32_t);
 		ump->um_e2fs->e2fs_maxcluster = malloc(size, M_EXT2MNT, M_WAITOK);

Modified: head/sys/fs/ext2fs/ext2fs.h
==============================================================================
--- head/sys/fs/ext2fs/ext2fs.h	Fri Feb  8 20:30:19 2013	(r246562)
+++ head/sys/fs/ext2fs/ext2fs.h	Fri Feb  8 20:58:00 2013	(r246563)
@@ -170,7 +170,6 @@ struct m_ext2fs {
 	char     e2fs_wasvalid;   /* valid at mount time */
 	off_t    e2fs_maxfilesize;
 	struct   ext2_gd *e2fs_gd; /* Group Descriptors */
-	int32_t  e2fs_maxcontig;	/* max number of contiguous blks */
 	int32_t  e2fs_contigsumsize;    /* size of cluster summary array */
 	int32_t *e2fs_maxcluster;       /* max cluster in each cyl group */
 	struct   csum *e2fs_clustersum; /* cluster summary in each cyl group */


More information about the svn-src-all mailing list