summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_aio.c2
-rw-r--r--sys/kern/vfs_bio.c8
-rw-r--r--sys/kern/vfs_subr.c15
3 files changed, 16 insertions, 9 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index c0b55960abe54..9040865d7b0a1 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -1972,7 +1972,7 @@ sys_aio_cancel(struct thread *td, struct aio_cancel_args *uap)
if (fp->f_type == DTYPE_VNODE) {
vp = fp->f_vnode;
- if (vn_isdisk(vp, &error)) {
+ if (vn_isdisk(vp)) {
fdrop(fp, td);
td->td_retval[0] = AIO_NOTCANCELED;
return (0);
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index adc44082d9729..9ff8628e9b10c 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -2724,7 +2724,7 @@ brelse(struct buf *bp)
if ((bp->b_flags & B_VMIO) && (bp->b_flags & B_NOCACHE ||
(bp->b_ioflags & BIO_ERROR && bp->b_iocmd == BIO_READ)) &&
(v_mnt == NULL || (v_mnt->mnt_vfc->vfc_flags & VFCF_NETWORK) == 0 ||
- vn_isdisk(bp->b_vp, NULL) || (bp->b_flags & B_DELWRI) == 0)) {
+ vn_isdisk(bp->b_vp) || (bp->b_flags & B_DELWRI) == 0)) {
vfs_vmio_invalidate(bp);
allocbuf(bp, 0);
}
@@ -3757,7 +3757,7 @@ bp_unmapped_get_kva(struct buf *bp, daddr_t blkno, int size, int gbflags)
* Calculate the amount of the address space we would reserve
* if the buffer was mapped.
*/
- bsize = vn_isdisk(bp->b_vp, NULL) ? DEV_BSIZE : bp->b_bufobj->bo_bsize;
+ bsize = vn_isdisk(bp->b_vp) ? DEV_BSIZE : bp->b_bufobj->bo_bsize;
KASSERT(bsize != 0, ("bsize == 0, check bo->bo_bsize"));
offset = blkno * bsize;
maxsize = size + (offset & PAGE_MASK);
@@ -4013,7 +4013,7 @@ newbuf_unlocked:
if (flags & GB_NOCREAT)
return (EEXIST);
- bsize = vn_isdisk(vp, NULL) ? DEV_BSIZE : bo->bo_bsize;
+ bsize = vn_isdisk(vp) ? DEV_BSIZE : bo->bo_bsize;
KASSERT(bsize != 0, ("bsize == 0, check bo->bo_bsize"));
offset = blkno * bsize;
vmio = vp->v_object != NULL;
@@ -4026,7 +4026,7 @@ newbuf_unlocked:
}
maxsize = imax(maxsize, bsize);
if ((flags & GB_NOSPARSE) != 0 && vmio &&
- !vn_isdisk(vp, NULL)) {
+ !vn_isdisk(vp)) {
error = VOP_BMAP(vp, blkno, NULL, &d_blkno, 0, 0);
KASSERT(error != EOPNOTSUPP,
("GB_NOSPARSE from fs not supporting bmap, vp %p",
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 2df609d9118bc..388e576fcde41 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -4977,8 +4977,8 @@ vn_need_pageq_flush(struct vnode *vp)
/*
* Check if vnode represents a disk device
*/
-int
-vn_isdisk(struct vnode *vp, int *errp)
+bool
+vn_isdisk_error(struct vnode *vp, int *errp)
{
int error;
@@ -4996,11 +4996,18 @@ vn_isdisk(struct vnode *vp, int *errp)
error = ENOTBLK;
dev_unlock();
out:
- if (errp != NULL)
- *errp = error;
+ *errp = error;
return (error == 0);
}
+bool
+vn_isdisk(struct vnode *vp)
+{
+ int error;
+
+ return (vn_isdisk_error(vp, &error));
+}
+
/*
* VOP_FPLOOKUP_VEXEC routines are subject to special circumstances, see
* the comment above cache_fplookup for details.