zfs userspace: use zfs_path_to_zhandle so argument can be a path
Change zfs userspace subcommand to use zfs_path_to_zhandle() so that the provided dataset can be a path (/usr) or a dataset (rpool/usr). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Allan Jude <allan@klarasystems.com> Closes #8915
This commit is contained in:
parent
edd23dba81
commit
1579483a86
|
@ -363,16 +363,16 @@ get_usage(zfs_help_t idx)
|
||||||
return (gettext("\tuserspace [-Hinp] [-o field[,...]] "
|
return (gettext("\tuserspace [-Hinp] [-o field[,...]] "
|
||||||
"[-s field] ...\n"
|
"[-s field] ...\n"
|
||||||
"\t [-S field] ... [-t type[,...]] "
|
"\t [-S field] ... [-t type[,...]] "
|
||||||
"<filesystem|snapshot>\n"));
|
"<filesystem|snapshot|path>\n"));
|
||||||
case HELP_GROUPSPACE:
|
case HELP_GROUPSPACE:
|
||||||
return (gettext("\tgroupspace [-Hinp] [-o field[,...]] "
|
return (gettext("\tgroupspace [-Hinp] [-o field[,...]] "
|
||||||
"[-s field] ...\n"
|
"[-s field] ...\n"
|
||||||
"\t [-S field] ... [-t type[,...]] "
|
"\t [-S field] ... [-t type[,...]] "
|
||||||
"<filesystem|snapshot>\n"));
|
"<filesystem|snapshot|path>\n"));
|
||||||
case HELP_PROJECTSPACE:
|
case HELP_PROJECTSPACE:
|
||||||
return (gettext("\tprojectspace [-Hp] [-o field[,...]] "
|
return (gettext("\tprojectspace [-Hp] [-o field[,...]] "
|
||||||
"[-s field] ... \n"
|
"[-s field] ... \n"
|
||||||
"\t [-S field] ... <filesystem|snapshot>\n"));
|
"\t [-S field] ... <filesystem|snapshot|path>\n"));
|
||||||
case HELP_PROJECT:
|
case HELP_PROJECT:
|
||||||
return (gettext("\tproject [-d|-r] <directory|file ...>\n"
|
return (gettext("\tproject [-d|-r] <directory|file ...>\n"
|
||||||
"\tproject -c [-0] [-d|-r] [-p id] <directory|file ...>\n"
|
"\tproject -c [-0] [-d|-r] [-p id] <directory|file ...>\n"
|
||||||
|
@ -2481,11 +2481,13 @@ zfs_do_upgrade(int argc, char **argv)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* zfs userspace [-Hinp] [-o field[,...]] [-s field [-s field]...]
|
* zfs userspace [-Hinp] [-o field[,...]] [-s field [-s field]...]
|
||||||
* [-S field [-S field]...] [-t type[,...]] filesystem | snapshot
|
* [-S field [-S field]...] [-t type[,...]]
|
||||||
|
* filesystem | snapshot | path
|
||||||
* zfs groupspace [-Hinp] [-o field[,...]] [-s field [-s field]...]
|
* zfs groupspace [-Hinp] [-o field[,...]] [-s field [-s field]...]
|
||||||
* [-S field [-S field]...] [-t type[,...]] filesystem | snapshot
|
* [-S field [-S field]...] [-t type[,...]]
|
||||||
|
* filesystem | snapshot | path
|
||||||
* zfs projectspace [-Hp] [-o field[,...]] [-s field [-s field]...]
|
* zfs projectspace [-Hp] [-o field[,...]] [-s field [-s field]...]
|
||||||
* [-S field [-S field]...] filesystem | snapshot
|
* [-S field [-S field]...] filesystem | snapshot | path
|
||||||
*
|
*
|
||||||
* -H Scripted mode; elide headers and separate columns by tabs.
|
* -H Scripted mode; elide headers and separate columns by tabs.
|
||||||
* -i Translate SID to POSIX ID.
|
* -i Translate SID to POSIX ID.
|
||||||
|
@ -3191,7 +3193,7 @@ zfs_do_userspace(int argc, char **argv)
|
||||||
} while (delim != NULL);
|
} while (delim != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM |
|
if ((zhp = zfs_path_to_zhandle(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM |
|
||||||
ZFS_TYPE_SNAPSHOT)) == NULL)
|
ZFS_TYPE_SNAPSHOT)) == NULL)
|
||||||
return (1);
|
return (1);
|
||||||
if (zhp->zfs_head_type != ZFS_TYPE_FILESYSTEM) {
|
if (zhp->zfs_head_type != ZFS_TYPE_FILESYSTEM) {
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
.Oo Fl s Ar field Oc Ns ...
|
.Oo Fl s Ar field Oc Ns ...
|
||||||
.Oo Fl S Ar field Oc Ns ...
|
.Oo Fl S Ar field Oc Ns ...
|
||||||
.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
|
.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
|
||||||
.Ar filesystem Ns | Ns Ar snapshot
|
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
|
||||||
.Nm
|
.Nm
|
||||||
.Cm groupspace
|
.Cm groupspace
|
||||||
.Op Fl Hinp
|
.Op Fl Hinp
|
||||||
|
@ -52,14 +52,14 @@
|
||||||
.Oo Fl s Ar field Oc Ns ...
|
.Oo Fl s Ar field Oc Ns ...
|
||||||
.Oo Fl S Ar field Oc Ns ...
|
.Oo Fl S Ar field Oc Ns ...
|
||||||
.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
|
.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
|
||||||
.Ar filesystem Ns | Ns Ar snapshot
|
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
|
||||||
.Nm
|
.Nm
|
||||||
.Cm projectspace
|
.Cm projectspace
|
||||||
.Op Fl Hp
|
.Op Fl Hp
|
||||||
.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
|
.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
|
||||||
.Oo Fl s Ar field Oc Ns ...
|
.Oo Fl s Ar field Oc Ns ...
|
||||||
.Oo Fl S Ar field Oc Ns ...
|
.Oo Fl S Ar field Oc Ns ...
|
||||||
.Ar filesystem Ns | Ns Ar snapshot
|
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Bl -tag -width ""
|
.Bl -tag -width ""
|
||||||
.It Xo
|
.It Xo
|
||||||
|
@ -70,10 +70,11 @@
|
||||||
.Oo Fl s Ar field Oc Ns ...
|
.Oo Fl s Ar field Oc Ns ...
|
||||||
.Oo Fl S Ar field Oc Ns ...
|
.Oo Fl S Ar field Oc Ns ...
|
||||||
.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
|
.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns ... Oc
|
||||||
.Ar filesystem Ns | Ns Ar snapshot
|
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
|
||||||
.Xc
|
.Xc
|
||||||
Displays space consumed by, and quotas on, each user in the specified filesystem
|
Displays space consumed by, and quotas on, each user in the specified filesystem,
|
||||||
or snapshot.
|
snapshot, or path.
|
||||||
|
If a path is given, the filesystem that contains that path will be used.
|
||||||
This corresponds to the
|
This corresponds to the
|
||||||
.Sy userused@ Ns Em user ,
|
.Sy userused@ Ns Em user ,
|
||||||
.Sy userobjused@ Ns Em user ,
|
.Sy userobjused@ Ns Em user ,
|
||||||
|
@ -167,7 +168,7 @@ except that the default types to display are
|
||||||
.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
|
.Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns ... Oc
|
||||||
.Oo Fl s Ar field Oc Ns ...
|
.Oo Fl s Ar field Oc Ns ...
|
||||||
.Oo Fl S Ar field Oc Ns ...
|
.Oo Fl S Ar field Oc Ns ...
|
||||||
.Ar filesystem Ns | Ns Ar snapshot
|
.Ar filesystem Ns | Ns Ar snapshot Ns | Ns Ar path
|
||||||
.Xc
|
.Xc
|
||||||
Displays space consumed by, and quotas on, each project in the specified
|
Displays space consumed by, and quotas on, each project in the specified
|
||||||
filesystem or snapshot. This subcommand is identical to
|
filesystem or snapshot. This subcommand is identical to
|
||||||
|
|
Loading…
Reference in New Issue