diff options
author | pjd <pjd@FreeBSD.org> | 2011-10-25 14:05:39 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-10-25 14:05:39 +0000 |
commit | 2536f7a375dd6bc0539adab2cd5f12d413a0c241 (patch) | |
tree | 9d45508da6f3a8517334b8229c44f135efdc3aad | |
parent | 44f9590751b4a1fb895d504ef9547a654e54038d (diff) | |
download | FreeBSD-src-2536f7a375dd6bc0539adab2cd5f12d413a0c241.zip FreeBSD-src-2536f7a375dd6bc0539adab2cd5f12d413a0c241.tar.gz |
Improve style a bit.
MFC after: 3 days
-rw-r--r-- | sys/geom/geom_disk.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index bc732f6..fd5955d 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"); - |