diff options
author | phk <phk@FreeBSD.org> | 1999-11-22 10:33:55 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-11-22 10:33:55 +0000 |
commit | 1848d96439c3eae03af8c379d699cf530ec39611 (patch) | |
tree | 0dd64726856780468e173aa94cbba55946f1b4cf /sys/kern | |
parent | 9fac48d9a6cd7258b469d97bb694c7e34d7d8e39 (diff) | |
download | FreeBSD-src-1848d96439c3eae03af8c379d699cf530ec39611.zip FreeBSD-src-1848d96439c3eae03af8c379d699cf530ec39611.tar.gz |
Convert various pieces of code to use vn_isdisk() rather than checking
for vp->v_type == VBLK.
In ccd: we don't need to call VOP_GETATTR to find the type of a vnode.
Reviewed by: sos
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_aio.c | 5 | ||||
-rw-r--r-- | sys/kern/vfs_bio.c | 8 | ||||
-rw-r--r-- | sys/kern/vfs_export.c | 7 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 7 |
4 files changed, 13 insertions, 14 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 8308caf..fd632a9 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -934,10 +934,7 @@ aio_qphysio(p, aiocbe) vp = (struct vnode *)fp->f_data; - /* XXX: use vn_isdisk() when VBLK and VCHR are unified */ - if (vp->v_type != VCHR) - return (-1); - if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) + if (!vn_isdisk(vp)) return (-1); if (cb->aio_nbytes % vp->v_rdev->si_bsize_phys) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index af1d835..c3dc70e 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -624,7 +624,7 @@ bwrite(struct buf * bp) * filesystem (if any). */ if ((vp = bp->b_vp) != NULL) { - if (vp->v_type == VBLK) + if (vn_isdisk(vp)) mp = vp->v_specmountpoint; else mp = vp->v_mount; @@ -915,7 +915,7 @@ brelse(struct buf * bp) */ if ((bp->b_flags & B_VMIO) && !(bp->b_vp->v_tag == VT_NFS && - bp->b_vp->v_type != VBLK && + !vn_isdisk(bp->b_vp) && (bp->b_flags & B_DELWRI)) ) { @@ -2103,7 +2103,7 @@ loop: int bsize, maxsize, vmio; off_t offset; - if (vp->v_type == VBLK) + if (vn_isdisk(vp)) bsize = DEV_BSIZE; else if (vp->v_mountedhere) bsize = vp->v_mountedhere->mnt_stat.f_iosize; @@ -2690,7 +2690,7 @@ biodone(register struct buf * bp) (int) m->pindex, (int)(foff >> 32), (int) foff & 0xffffffff, resid, i); #endif - if (vp->v_type != VBLK) + if (!vn_isdisk(vp)) #if !defined(MAX_PERF) printf(" iosize: %ld, lblkno: %d, flags: 0x%lx, npages: %d\n", bp->b_vp->v_mount->mnt_stat.f_iosize, diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index fc850ff..1b0494e 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -1021,7 +1021,7 @@ sched_sync(void) * slot we are safe. */ if (TAILQ_EMPTY(&vp->v_dirtyblkhd) && - vp->v_type != VBLK) + !vn_isdisk(vp)) panic("sched_sync: fsync failed vp %p tag %d", vp, vp->v_tag); /* * Put us back on the worklist. The worklist @@ -1207,6 +1207,7 @@ reassignbuf(bp, newvp) case VDIR: delay = dirdelay; break; + case VCHR: case VBLK: if (newvp->v_specmountpoint != NULL) { delay = metadelay; @@ -2507,7 +2508,7 @@ vfs_object_create(vp, p, cred) vm_object_t object; int error = 0; - if (vp->v_type != VBLK && vn_canvmio(vp) == FALSE) + if (!vn_isdisk(vp) && vn_canvmio(vp) == FALSE) return 0; retry: @@ -2519,7 +2520,7 @@ retry: } else if (devsw(vp->v_rdev) != NULL) { /* * This simply allocates the biggest object possible - * for a VBLK vnode. This should be fixed, but doesn't + * for a disk vnode. This should be fixed, but doesn't * cause any problems (yet). */ object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index fc850ff..1b0494e 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1021,7 +1021,7 @@ sched_sync(void) * slot we are safe. */ if (TAILQ_EMPTY(&vp->v_dirtyblkhd) && - vp->v_type != VBLK) + !vn_isdisk(vp)) panic("sched_sync: fsync failed vp %p tag %d", vp, vp->v_tag); /* * Put us back on the worklist. The worklist @@ -1207,6 +1207,7 @@ reassignbuf(bp, newvp) case VDIR: delay = dirdelay; break; + case VCHR: case VBLK: if (newvp->v_specmountpoint != NULL) { delay = metadelay; @@ -2507,7 +2508,7 @@ vfs_object_create(vp, p, cred) vm_object_t object; int error = 0; - if (vp->v_type != VBLK && vn_canvmio(vp) == FALSE) + if (!vn_isdisk(vp) && vn_canvmio(vp) == FALSE) return 0; retry: @@ -2519,7 +2520,7 @@ retry: } else if (devsw(vp->v_rdev) != NULL) { /* * This simply allocates the biggest object possible - * for a VBLK vnode. This should be fixed, but doesn't + * for a disk vnode. This should be fixed, but doesn't * cause any problems (yet). */ object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0); |