- ffs_blkpref() changes:

- don't both updating fs->fs_cgrotor, since it's actually not used in
	  the kernel. from Manuel Bouyer in [kern/3389]
	- when examining cylinder groups from startcg to startcg-1 (wrapping
	  at fs->fs_ncg), there's no need to check startcg at the end as well
	  as the start...
- highlight in the struct fs declaration that fs_cgrotor is UNUSED
This commit is contained in:
lukem 2001-09-19 01:38:16 +00:00
parent 3792a5d8c5
commit 9c5c77ae54
2 changed files with 4 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_alloc.c,v 1.51 2001/09/15 20:36:41 chs Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.52 2001/09/19 01:38:16 lukem Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -857,12 +857,10 @@ ffs_blkpref(ip, lbn, indx, bap)
avgbfree = fs->fs_cstotal.cs_nbfree / fs->fs_ncg;
for (cg = startcg; cg < fs->fs_ncg; cg++)
if (fs->fs_cs(fs, cg).cs_nbfree >= avgbfree) {
fs->fs_cgrotor = cg;
return (fs->fs_fpg * cg + fs->fs_frag);
}
for (cg = 0; cg <= startcg; cg++)
for (cg = 0; cg < startcg; cg++)
if (fs->fs_cs(fs, cg).cs_nbfree >= avgbfree) {
fs->fs_cgrotor = cg;
return (fs->fs_fpg * cg + fs->fs_frag);
}
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fs.h,v 1.20 2001/09/06 02:16:02 lukem Exp $ */
/* $NetBSD: fs.h,v 1.21 2001/09/19 01:38:17 lukem Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -241,7 +241,7 @@ struct fs {
int8_t fs_flags; /* see FS_ flags below */
u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */
/* these fields retain the current block allocation info */
int32_t fs_cgrotor; /* last cg searched */
int32_t fs_cgrotor; /* last cg searched (UNUSED) */
void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */
u_int16_t *fs_contigdirs; /* # of contiguously allocated dirs */
struct csum *fs_csp; /* cg summary info buffer for fs_cs */