X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzfs_vnops.c;h=3c3e8db4b05829ad702b8a4a7c881a62ba50581c;hb=802e7b5feb0135483de119eac1da192404eb5bb7;hp=5a9c96334672fe5c9bfd10b3014592d439b0aaee;hpb=cf91b2b6b2baaca1e56f23c985e3261cd98bd3f0;p=zfs.git diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 5a9c963..3c3e8db 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -240,15 +240,15 @@ zfs_close(struct inode *ip, int flag, cred_t *cr) } EXPORT_SYMBOL(zfs_close); -#if 0 +#if defined(SEEK_HOLE) && defined(SEEK_DATA) /* - * Lseek support for finding holes (cmd == _FIO_SEEK_HOLE) and - * data (cmd == _FIO_SEEK_DATA). "off" is an in/out parameter. + * Lseek support for finding holes (cmd == SEEK_HOLE) and + * data (cmd == SEEK_DATA). "off" is an in/out parameter. */ static int -zfs_holey(vnode_t *vp, int cmd, offset_t *off) +zfs_holey_common(struct inode *ip, int cmd, loff_t *off) { - znode_t *zp = VTOZ(vp); + znode_t *zp = ITOZ(ip); uint64_t noff = (uint64_t)*off; /* new offset */ uint64_t file_sz; int error; @@ -256,15 +256,15 @@ zfs_holey(vnode_t *vp, int cmd, offset_t *off) file_sz = zp->z_size; if (noff >= file_sz) { - return (SET_ERROR(ENXIO)); + return (ENXIO); } - if (cmd == _FIO_SEEK_HOLE) + if (cmd == SEEK_HOLE) hole = B_TRUE; else hole = B_FALSE; - error = dmu_offset_next(zp->z_zfsvfs->z_os, zp->z_id, hole, &noff); + error = dmu_offset_next(ZTOZSB(zp)->z_os, zp->z_id, hole, &noff); /* end of file? */ if ((error == ESRCH) || (noff > file_sz)) { @@ -275,7 +275,7 @@ zfs_holey(vnode_t *vp, int cmd, offset_t *off) *off = file_sz; return (0); } - return (SET_ERROR(ENXIO)); + return (ENXIO); } if (noff < *off) @@ -283,7 +283,24 @@ zfs_holey(vnode_t *vp, int cmd, offset_t *off) *off = noff; return (error); } -#endif + +int +zfs_holey(struct inode *ip, int cmd, loff_t *off) +{ + znode_t *zp = ITOZ(ip); + zfs_sb_t *zsb = ITOZSB(ip); + int error; + + ZFS_ENTER(zsb); + ZFS_VERIFY_ZP(zp); + + error = zfs_holey_common(ip, cmd, off); + + ZFS_EXIT(zsb); + return (error); +} +EXPORT_SYMBOL(zfs_holey); +#endif /* SEEK_HOLE && SEEK_DATA */ #if defined(_KERNEL) /*