git: a57a2c01aacc - main - ffs_blkpref_ufsX(): do not iterate over startcg twice

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 13 Jan 2025 19:23:29 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=a57a2c01aacc5e2a29fa33d50aecc516e37cecd0

commit a57a2c01aacc5e2a29fa33d50aecc516e37cecd0
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-01-05 23:00:10 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-01-13 19:22:44 +0000

    ffs_blkpref_ufsX(): do not iterate over startcg twice
    
    Tested by:      pho
    Reviewed by:    mckusick
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D48378
---
 sys/ufs/ffs/ffs_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 713dcf1ca97a..01bfdb85c2e6 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1496,7 +1496,7 @@ ffs_blkpref_ufs1(struct inode *ip,
 				fs->fs_cgrotor = cg;
 				return (cgdata(fs, cg));
 			}
-		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 (cgdata(fs, cg));
@@ -1608,7 +1608,7 @@ ffs_blkpref_ufs2(struct inode *ip,
 				fs->fs_cgrotor = cg;
 				return (cgdata(fs, cg));
 			}
-		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 (cgdata(fs, cg));