Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys disk_blocksize and disk_set_info relay the same information
details: https://anonhg.NetBSD.org/src/rev/764a6dbd32b3
branches: trunk
changeset: 805382:764a6dbd32b3
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Wed Dec 31 08:24:50 2014 +0000
description:
disk_blocksize and disk_set_info relay the same information
to the disk subsystem.
Make disk_set_info also set blocksize shift values.
Remove every call to disk_blocksize.
Keep disk_blocksize for ABI compatibility, make it also set dg_secsize.
diffstat:
sys/dev/dkwedge/dk.c | 19 +++++++++----------
sys/dev/dm/device-mapper.c | 4 +---
sys/dev/raidframe/rf_netbsdkintf.c | 9 ++++-----
sys/dev/scsipi/sd.c | 8 +++-----
sys/dev/vnd.c | 5 ++---
sys/kern/subr_disk.c | 12 +++++++++---
6 files changed, 28 insertions(+), 29 deletions(-)
diffs (227 lines):
diff -r a0370772c765 -r 764a6dbd32b3 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Tue Dec 30 22:07:21 2014 +0000
+++ b/sys/dev/dkwedge/dk.c Wed Dec 31 08:24:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.76 2014/12/08 17:45:12 mlelstv Exp $ */
+/* $NetBSD: dk.c,v 1.77 2014/12/31 08:24:50 mlelstv Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.76 2014/12/08 17:45:12 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.77 2014/12/31 08:24:50 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -258,22 +258,22 @@
}
static void
-dk_set_geometry(struct dkwedge_softc *sc)
+dk_set_geometry(struct dkwedge_softc *sc, struct disk *pdk)
{
- struct disk *disk = &sc->sc_dk;
- struct disk_geom *dg = &disk->dk_geom;
+ struct disk *dk = &sc->sc_dk;
+ struct disk_geom *dg = &dk->dk_geom;
memset(dg, 0, sizeof(*dg));
- dg->dg_secperunit = sc->sc_size >> disk->dk_blkshift;
- dg->dg_secsize = DEV_BSIZE << disk->dk_blkshift;
+ dg->dg_secperunit = sc->sc_size >> pdk->dk_blkshift;
+ dg->dg_secsize = DEV_BSIZE << pdk->dk_blkshift;
/* fake numbers, 1 cylinder is 1 MB with default sector size */
dg->dg_nsectors = 32;
dg->dg_ntracks = 64;
dg->dg_ncylinders = dg->dg_secperunit / (dg->dg_nsectors * dg->dg_ntracks);
- disk_set_info(sc->sc_dev, disk, NULL);
+ disk_set_info(sc->sc_dev, dk, NULL);
}
/*
@@ -455,8 +455,7 @@
*/
disk_init(&sc->sc_dk, device_xname(sc->sc_dev), NULL);
- disk_blocksize(&sc->sc_dk, DEV_BSIZE << pdk->dk_blkshift);
- dk_set_geometry(sc);
+ dk_set_geometry(sc, pdk);
disk_attach(&sc->sc_dk);
/* Disk wedge is ready for use! */
diff -r a0370772c765 -r 764a6dbd32b3 sys/dev/dm/device-mapper.c
--- a/sys/dev/dm/device-mapper.c Tue Dec 30 22:07:21 2014 +0000
+++ b/sys/dev/dm/device-mapper.c Wed Dec 31 08:24:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device-mapper.c,v 1.35 2014/10/02 21:01:38 justin Exp $ */
+/* $NetBSD: device-mapper.c,v 1.36 2014/12/31 08:24:50 mlelstv Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -686,6 +686,4 @@
dg->dg_ntracks = 64;
disk_set_info(NULL, disk, "ESDI");
-
- disk_blocksize(disk, secsize);
}
diff -r a0370772c765 -r 764a6dbd32b3 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c Tue Dec 30 22:07:21 2014 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c Wed Dec 31 08:24:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.317 2014/12/21 17:04:12 taca Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.318 2014/12/31 08:24:50 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.317 2014/12/21 17:04:12 taca Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.318 2014/12/31 08:24:50 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -2019,17 +2019,16 @@
disk_init(&rs->sc_dkdev, rs->sc_xname, &rf_dkdriver);
disk_attach(&rs->sc_dkdev);
- disk_blocksize(&rs->sc_dkdev, raidPtr->bytesPerSector);
/* XXX There may be a weird interaction here between this, and
* protectedSectors, as used in RAIDframe. */
rs->sc_size = raidPtr->totalSectors;
+ rf_set_geometry(rs, raidPtr);
+
dkwedge_discover(&rs->sc_dkdev);
- rf_set_geometry(rs, raidPtr);
-
}
#if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0)
/* wake up the daemon & tell it to get us a spare table
diff -r a0370772c765 -r 764a6dbd32b3 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Tue Dec 30 22:07:21 2014 +0000
+++ b/sys/dev/scsipi/sd.c Wed Dec 31 08:24:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.310 2014/11/04 07:51:55 mlelstv Exp $ */
+/* $NetBSD: sd.c,v 1.311 2014/12/31 08:24:50 mlelstv Exp $ */
/*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.310 2014/11/04 07:51:55 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.311 2014/12/31 08:24:50 mlelstv Exp $");
#include "opt_scsi.h"
@@ -2145,7 +2145,7 @@
if (sd->type == T_SIMPLE_DIRECT) {
error = sd_get_simplifiedparms(sd, dp, flags);
if (!error)
- disk_blocksize(&sd->sc_dk, dp->blksize);
+ goto setprops;
return (error);
}
@@ -2153,8 +2153,6 @@
if (error)
return (error);
- disk_blocksize(&sd->sc_dk, dp->blksize);
-
if (sd->type == T_OPTICAL)
goto page0;
diff -r a0370772c765 -r 764a6dbd32b3 sys/dev/vnd.c
--- a/sys/dev/vnd.c Tue Dec 30 22:07:21 2014 +0000
+++ b/sys/dev/vnd.c Wed Dec 31 08:24:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.235 2014/12/29 13:13:20 mlelstv Exp $ */
+/* $NetBSD: vnd.c,v 1.236 2014/12/31 08:24:50 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.235 2014/12/29 13:13:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.236 2014/12/31 08:24:50 mlelstv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@@ -1350,7 +1350,6 @@
/* Attach the disk. */
disk_attach(&vnd->sc_dkdev);
- disk_blocksize(&vnd->sc_dkdev, vnd->sc_geom.vng_secsize);
/* Initialize the xfer and buffer pools. */
pool_init(&vnd->sc_vxpool, sizeof(struct vndxfer), 0,
diff -r a0370772c765 -r 764a6dbd32b3 sys/kern/subr_disk.c
--- a/sys/kern/subr_disk.c Tue Dec 30 22:07:21 2014 +0000
+++ b/sys/kern/subr_disk.c Wed Dec 31 08:24:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_disk.c,v 1.105 2014/12/29 18:54:19 mlelstv Exp $ */
+/* $NetBSD: subr_disk.c,v 1.106 2014/12/31 08:24:51 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.105 2014/12/29 18:54:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.106 2014/12/31 08:24:51 mlelstv Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -181,6 +181,7 @@
void
disk_init(struct disk *diskp, const char *name, const struct dkdriver *driver)
{
+ u_int blocksize = DEV_BSIZE;
/*
* Initialize the wedge-related locks and other fields.
@@ -190,7 +191,8 @@
LIST_INIT(&diskp->dk_wedges);
diskp->dk_nwedges = 0;
diskp->dk_labelsector = LABELSECTOR;
- disk_blocksize(diskp, DEV_BSIZE);
+ diskp->dk_blkshift = DK_BSIZE2BLKSHIFT(blocksize);
+ diskp->dk_byteshift = DK_BSIZE2BYTESHIFT(blocksize);
diskp->dk_name = name;
diskp->dk_driver = driver;
}
@@ -311,6 +313,7 @@
diskp->dk_blkshift = DK_BSIZE2BLKSHIFT(blocksize);
diskp->dk_byteshift = DK_BSIZE2BYTESHIFT(blocksize);
+ diskp->dk_geom.dg_secsize = DEV_BSIZE << diskp->dk_blkshift;
}
/*
@@ -555,6 +558,9 @@
dg->dg_secsize = DEV_BSIZE;
}
+ dk->dk_blkshift = DK_BSIZE2BLKSHIFT(dg->dg_secsize);
+ dk->dk_byteshift = DK_BSIZE2BYTESHIFT(dg->dg_secsize);
+
prop_dictionary_t disk_info, odisk_info, geom;
disk_info = prop_dictionary_create();
Home |
Main Index |
Thread Index |
Old Index