Module Name:    src
Committed By:   martin
Date:           Sat May 13 12:23:13 UTC 2023

Modified Files:
        src/sys/ufs/ffs [netbsd-9]: ffs_snapshot.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #1633):

        sys/ufs/ffs/ffs_snapshot.c: revision 1.155

ffs: apply the remaining ffs_snapshot.c part of this FreeBSD commit:
  commit 364ed814e7285c8216d8a201d3ab3674eb34ce29
  Author: Kirk McKusick <mckus...@freebsd.org>
  Date:   Thu Dec 9 21:24:00 2004 +0000
    Fixes a bug that caused UFS2 filesystems bigger than 2TB to
    prematurely report that they were full and/or to panic the kernel
    with the message ``ffs_clusteralloc: allocated out of group''.
    Submitted by:   Henry Whincup <he...@jot.to>
    MFC after:      1 week

all the other changes in that commit were applied previously by others:
 - sborrill commmitted ffs_alloc.c rev 1.123 in 2009
 - simonb committed ffs_alloc.c rev 1.110 in 2008
 - the ffs_clusteralloc() part is not needed because we no longer have
   that function.

fixes PR 57307


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.149.14.1 src/sys/ufs/ffs/ffs_snapshot.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ffs/ffs_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.149 src/sys/ufs/ffs/ffs_snapshot.c:1.149.14.1
--- src/sys/ufs/ffs/ffs_snapshot.c:1.149	Thu Jun  1 02:45:15 2017
+++ src/sys/ufs/ffs/ffs_snapshot.c	Sat May 13 12:23:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_snapshot.c,v 1.149 2017/06/01 02:45:15 chs Exp $	*/
+/*	$NetBSD: ffs_snapshot.c,v 1.149.14.1 2023/05/13 12:23:13 martin Exp $	*/
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.149 2017/06/01 02:45:15 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.149.14.1 2023/05/13 12:23:13 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -997,7 +997,7 @@ cgaccount1(int cg, struct vnode *vp, voi
 		    fs->fs_bsize - fs->fs_cgsize);
 	numblks = howmany(fs->fs_size, fs->fs_frag);
 	len = howmany(fs->fs_fpg, fs->fs_frag);
-	base = cg * fs->fs_fpg / fs->fs_frag;
+	base = cgbase(fs, cg) / fs->fs_frag;
 	if (base + len >= numblks)
 		len = numblks - base - 1;
 	loc = 0;

Reply via email to