X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fvdev_file.c;h=06999a880c0237ba299c78ddccd8b990d2ece27e;hb=refs%2Fheads%2Frertzinger%2Ffeature-zpool-get--p;hp=3c0ce53cdf80b1c344bca9d309159aba3422b6c3;hpb=1bd201e70d57464fd26bf9089ea4b44fd49e4f2d;p=zfs.git diff --git a/module/zfs/vdev_file.c b/module/zfs/vdev_file.c index 3c0ce53..06999a8 100644 --- a/module/zfs/vdev_file.c +++ b/module/zfs/vdev_file.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -139,21 +140,39 @@ vdev_file_close(vdev_t *vd) vd->vdev_tsd = NULL; } -static int -vdev_file_io_start(zio_t *zio) +static void +vdev_file_io_strategy(void *arg) { + zio_t *zio = (zio_t *)arg; vdev_t *vd = zio->io_vd; - vdev_file_t *vf; - ssize_t resid = 0; + vdev_file_t *vf = vd->vdev_tsd; + ssize_t resid; - if (!vdev_readable(vd)) { - zio->io_error = ENXIO; - return (ZIO_PIPELINE_CONTINUE); - } + zio->io_error = vn_rdwr(zio->io_type == ZIO_TYPE_READ ? + UIO_READ : UIO_WRITE, vf->vf_vnode, zio->io_data, + zio->io_size, zio->io_offset, UIO_SYSSPACE, + 0, RLIM64_INFINITY, kcred, &resid); + + if (resid != 0 && zio->io_error == 0) + zio->io_error = ENOSPC; - vf = vd->vdev_tsd; + zio_interrupt(zio); +} + +static int +vdev_file_io_start(zio_t *zio) +{ + spa_t *spa = zio->io_spa; + vdev_t *vd = zio->io_vd; + vdev_file_t *vf = vd->vdev_tsd; if (zio->io_type == ZIO_TYPE_IOCTL) { + /* XXPOLICY */ + if (!vdev_readable(vd)) { + zio->io_error = ENXIO; + return (ZIO_PIPELINE_CONTINUE); + } + switch (zio->io_cmd) { case DKIOCFLUSHWRITECACHE: zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC, @@ -166,15 +185,8 @@ vdev_file_io_start(zio_t *zio) return (ZIO_PIPELINE_CONTINUE); } - zio->io_error = vn_rdwr(zio->io_type == ZIO_TYPE_READ ? - UIO_READ : UIO_WRITE, vf->vf_vnode, zio->io_data, - zio->io_size, zio->io_offset, UIO_SYSSPACE, - 0, RLIM64_INFINITY, kcred, &resid); - - if (resid != 0 && zio->io_error == 0) - zio->io_error = ENOSPC; - - zio_interrupt(zio); + spa_taskq_dispatch_ent(spa, ZIO_TYPE_FREE, ZIO_TASKQ_ISSUE, + vdev_file_io_strategy, zio, 0, &zio->io_tqent); return (ZIO_PIPELINE_STOP); }