From 6f76c57efe95c20f420280cc12e52517f2ded05c Mon Sep 17 00:00:00 2001 From: Hiten Pandya Date: Tue, 6 Sep 2005 01:21:26 +0000 Subject: [PATCH] Document the dscheck(9) function and explain how it affects the slice- and driver-relative block numbers, bio->bio_blkno and bio->bio_pblkno respectively. The latter is modified by the said function after doing various checks on available information, such as disklabels, etc, while the former is provided by the VFS. Explain how said function re-transforms the block number fields when LABEL support is enabled in the VN driver via vnconfig(8). --- sys/dev/disk/vn/vn.c | 9 ++++++++- sys/kern/subr_disk.c | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/dev/disk/vn/vn.c b/sys/dev/disk/vn/vn.c index dba56bd4bd..7332770ace 100644 --- a/sys/dev/disk/vn/vn.c +++ b/sys/dev/disk/vn/vn.c @@ -39,7 +39,7 @@ * * from: @(#)vn.c 8.6 (Berkeley) 4/1/94 * $FreeBSD: src/sys/dev/vn/vn.c,v 1.105.2.4 2001/11/18 07:11:00 dillon Exp $ - * $DragonFly: src/sys/dev/disk/vn/vn.c,v 1.13 2004/11/12 00:09:04 dillon Exp $ + * $DragonFly: src/sys/dev/disk/vn/vn.c,v 1.14 2005/09/06 01:21:26 hmp Exp $ */ /* @@ -313,6 +313,13 @@ vnstrategy(struct buf *bp) bp->b_resid = bp->b_bcount; IFOPT(vn, VN_LABELS) { + /* + * The vnode device is using disk/slice label support. + * + * The dscheck() function is called for validating the + * slices that exist ON the vnode device itself, and + * translate the "slice-relative" block number, again. + */ if (vn->sc_slices != NULL && dscheck(bp, vn->sc_slices) <= 0) { bp->b_flags |= B_INVAL; biodone(bp); diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 6fe72cc7a4..8abf41a541 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -77,7 +77,7 @@ * @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/subr_disk.c,v 1.20.2.6 2001/10/05 07:14:57 peter Exp $ * $FreeBSD: src/sys/ufs/ufs/ufs_disksubr.c,v 1.44.2.3 2001/03/05 05:42:19 obrien Exp $ - * $DragonFly: src/sys/kern/subr_disk.c,v 1.18 2005/08/26 13:02:07 hmp Exp $ + * $DragonFly: src/sys/kern/subr_disk.c,v 1.19 2005/09/06 01:21:26 hmp Exp $ */ #include @@ -466,6 +466,11 @@ diskstrategy(struct buf *bp) } KKASSERT(bp->b_dev->si_disk == dp); + /* + * The dscheck() function will also transform the slice relative + * block number i.e. bp->b_blkno into a block number that can be + * passed directly to the underlying raw device. + */ if (dscheck(bp, dp->d_slice) <= 0) { biodone(bp); return; -- 2.41.0