From 2536f7a375dd6bc0539adab2cd5f12d413a0c241 Mon Sep 17 00:00:00 2001 From: pjd Date: Tue, 25 Oct 2011 14:05:39 +0000 Subject: [PATCH] Improve style a bit. MFC after: 3 days --- sys/geom/geom_disk.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index bc732f67228c..fd5955de5ff2 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -109,6 +109,7 @@ DECLARE_GEOM_CLASS(g_disk_class, g_disk); static void __inline g_disk_lock_giant(struct disk *dp) { + if (dp->d_flags & DISKFLAG_NEEDSGIANT) mtx_lock(&Giant); } @@ -116,6 +117,7 @@ g_disk_lock_giant(struct disk *dp) static void __inline g_disk_unlock_giant(struct disk *dp) { + if (dp->d_flags & DISKFLAG_NEEDSGIANT) mtx_unlock(&Giant); } @@ -251,9 +253,9 @@ g_disk_done(struct bio *bp) if (bp2->bio_error == 0) bp2->bio_error = bp->bio_error; bp2->bio_completed += bp->bio_completed; - if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) && - (sc = bp2->bio_to->geom->softc) && - (dp = sc->dp)) { + if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0 && + (sc = bp2->bio_to->geom->softc) != NULL && + (dp = sc->dp) != NULL) { devstat_end_transaction_bio(dp->d_devstat, bp); } g_destroy_bio(bp); @@ -282,7 +284,7 @@ g_disk_ioctl(struct g_provider *pp, u_long cmd, void * data, int fflag, struct t g_disk_lock_giant(dp); error = dp->d_ioctl(dp, cmd, data, fflag, td); g_disk_unlock_giant(dp); - return(error); + return (error); } static void @@ -546,6 +548,7 @@ disk_alloc(void) void disk_create(struct disk *dp, int version) { + if (version != DISK_VERSION_00 && version != DISK_VERSION_01) { printf("WARNING: Attempt to add disk %s%d %s", dp->d_name, dp->d_unit, @@ -635,4 +638,3 @@ sysctl_disks(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_kern, OID_AUTO, disks, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_disks, "A", "names of available disks"); -