Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Fix calculation of cylinder count from medium size.



details:   https://anonhg.NetBSD.org/src/rev/c3ffeec0d39a
branches:  trunk
changeset: 958422:c3ffeec0d39a
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Jan 04 16:17:26 2021 +0000

description:
Fix calculation of cylinder count from medium size.
Pullups needed.

diffstat:

 sys/dev/vnd.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 232ee14c5ec2 -r c3ffeec0d39a sys/dev/vnd.c
--- a/sys/dev/vnd.c     Mon Jan 04 15:56:24 2021 +0000
+++ b/sys/dev/vnd.c     Mon Jan 04 16:17:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.277 2020/04/23 09:40:08 jdolecek Exp $       */
+/*     $NetBSD: vnd.c,v 1.278 2021/01/04 16:17:26 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.277 2020/04/23 09:40:08 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.278 2021/01/04 16:17:26 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -1456,8 +1456,9 @@
                         * Compute missing cylinder count from size
                         */
                        if (vnd->sc_geom.vng_ncylinders == 0)
-                               vnd->sc_geom.vng_ncylinders = vnd->sc_size /
-                                       (vnd->sc_geom.vng_ntracks *
+                               vnd->sc_geom.vng_ncylinders = vnd->sc_size / (
+                                       (vnd->sc_geom.vng_secsize / DEV_BSIZE) *
+                                       vnd->sc_geom.vng_ntracks *
                                        vnd->sc_geom.vng_nsectors);
 
                        /*



Home | Main Index | Thread Index | Old Index