Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | |||||
static int zfs_version_spa = SPA_VERSION; | static int zfs_version_spa = SPA_VERSION; | ||||
SYSCTL_INT(_vfs_zfs_version, OID_AUTO, spa, CTLFLAG_RD, &zfs_version_spa, 0, | SYSCTL_INT(_vfs_zfs_version, OID_AUTO, spa, CTLFLAG_RD, &zfs_version_spa, 0, | ||||
"SPA_VERSION"); | "SPA_VERSION"); | ||||
static int zfs_version_zpl = ZPL_VERSION; | static int zfs_version_zpl = ZPL_VERSION; | ||||
SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, | SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, | ||||
"ZPL_VERSION"); | "ZPL_VERSION"); | ||||
/* END CSTYLED */ | /* END CSTYLED */ | ||||
#if __FreeBSD_version >= 1400018 | |||||
static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, | |||||
bool *mp_busy); | |||||
#else | |||||
static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg); | static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg); | ||||
#endif | |||||
jah: I believe that I really need to make these ZFS changes conditional on the new __FreeBSD_version… | |||||
Not Done Inline ActionsYes, please and thank you. freqlabs: Yes, please and thank you. | |||||
Done Inline Actionsjah: https://github.com/openzfs/zfs/pull/12052 | |||||
static int zfs_mount(vfs_t *vfsp); | static int zfs_mount(vfs_t *vfsp); | ||||
static int zfs_umount(vfs_t *vfsp, int fflag); | static int zfs_umount(vfs_t *vfsp, int fflag); | ||||
static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); | static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); | ||||
static int zfs_statfs(vfs_t *vfsp, struct statfs *statp); | static int zfs_statfs(vfs_t *vfsp, struct statfs *statp); | ||||
static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp); | static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp); | ||||
static int zfs_sync(vfs_t *vfsp, int waitfor); | static int zfs_sync(vfs_t *vfsp, int waitfor); | ||||
#if __FreeBSD_version >= 1300098 | #if __FreeBSD_version >= 1300098 | ||||
static int zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, uint64_t *extflagsp, | static int zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, uint64_t *extflagsp, | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | zfs_getquota(zfsvfs_t *zfsvfs, uid_t id, int isgroup, struct dqblk64 *dqp) | ||||
* particularly useful. | * particularly useful. | ||||
*/ | */ | ||||
dqp->dqb_btime = dqp->dqb_itime = now.tv_sec; | dqp->dqb_btime = dqp->dqb_itime = now.tv_sec; | ||||
done: | done: | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
#if __FreeBSD_version >= 1400018 | |||||
zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, bool *mp_busy) | |||||
#else | |||||
zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) | zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) | ||||
#endif | |||||
{ | { | ||||
zfsvfs_t *zfsvfs = vfsp->vfs_data; | zfsvfs_t *zfsvfs = vfsp->vfs_data; | ||||
struct thread *td; | struct thread *td; | ||||
int cmd, type, error = 0; | int cmd, type, error = 0; | ||||
int bitsize; | int bitsize; | ||||
zfs_userquota_prop_t quota_type; | zfs_userquota_prop_t quota_type; | ||||
struct dqblk64 dqblk = { 0 }; | struct dqblk64 dqblk = { 0 }; | ||||
td = curthread; | td = curthread; | ||||
cmd = cmds >> SUBCMDSHIFT; | cmd = cmds >> SUBCMDSHIFT; | ||||
type = cmds & SUBCMDMASK; | type = cmds & SUBCMDMASK; | ||||
ZFS_ENTER(zfsvfs); | ZFS_ENTER(zfsvfs); | ||||
if (id == -1) { | if (id == -1) { | ||||
switch (type) { | switch (type) { | ||||
case USRQUOTA: | case USRQUOTA: | ||||
id = td->td_ucred->cr_ruid; | id = td->td_ucred->cr_ruid; | ||||
break; | break; | ||||
case GRPQUOTA: | case GRPQUOTA: | ||||
id = td->td_ucred->cr_rgid; | id = td->td_ucred->cr_rgid; | ||||
break; | break; | ||||
default: | default: | ||||
error = EINVAL; | error = EINVAL; | ||||
#if __FreeBSD_version < 1400018 | |||||
if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) | if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) | ||||
vfs_unbusy(vfsp); | vfs_unbusy(vfsp); | ||||
#endif | |||||
goto done; | goto done; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Map BSD type to: | * Map BSD type to: | ||||
* ZFS_PROP_USERUSED, | * ZFS_PROP_USERUSED, | ||||
* ZFS_PROP_USERQUOTA, | * ZFS_PROP_USERQUOTA, | ||||
* ZFS_PROP_GROUPUSED, | * ZFS_PROP_GROUPUSED, | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | #endif | ||||
switch (cmd) { | switch (cmd) { | ||||
case Q_GETQUOTASIZE: | case Q_GETQUOTASIZE: | ||||
bitsize = 64; | bitsize = 64; | ||||
error = copyout(&bitsize, arg, sizeof (int)); | error = copyout(&bitsize, arg, sizeof (int)); | ||||
break; | break; | ||||
case Q_QUOTAON: | case Q_QUOTAON: | ||||
// As far as I can tell, you can't turn quotas on or off on zfs | // As far as I can tell, you can't turn quotas on or off on zfs | ||||
error = 0; | error = 0; | ||||
#if __FreeBSD_version < 1400018 | |||||
vfs_unbusy(vfsp); | vfs_unbusy(vfsp); | ||||
#endif | |||||
break; | break; | ||||
case Q_QUOTAOFF: | case Q_QUOTAOFF: | ||||
error = ENOTSUP; | error = ENOTSUP; | ||||
#if __FreeBSD_version < 1400018 | |||||
vfs_unbusy(vfsp); | vfs_unbusy(vfsp); | ||||
#endif | |||||
break; | break; | ||||
case Q_SETQUOTA: | case Q_SETQUOTA: | ||||
error = copyin(arg, &dqblk, sizeof (dqblk)); | error = copyin(arg, &dqblk, sizeof (dqblk)); | ||||
if (error == 0) | if (error == 0) | ||||
error = zfs_set_userquota(zfsvfs, quota_type, | error = zfs_set_userquota(zfsvfs, quota_type, | ||||
"", id, dbtob(dqblk.dqb_bhardlimit)); | "", id, dbtob(dqblk.dqb_bhardlimit)); | ||||
break; | break; | ||||
case Q_GETQUOTA: | case Q_GETQUOTA: | ||||
▲ Show 20 Lines • Show All 1,950 Lines • Show Last 20 Lines |
I believe that I really need to make these ZFS changes conditional on the new __FreeBSD_version and open a PR against the upstream OpenZFS github, is that correct?