diff mbox series

[2/2] statx.2: add project support update

Message ID 1551449184-7942-3-git-send-email-wshilong1991@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] fchownat.2: add project support updates | expand

Commit Message

Wang Shilong March 1, 2019, 2:06 p.m. UTC
From: Wang Shilong <wshilong@ddn.com>

Cc: linux-man@vger.kernel.org
Signed-off-by: Wang Shilong <wshilong@ddn.com>
---
 man2/statx.2 | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Darrick J. Wong March 1, 2019, 3:51 p.m. UTC | #1
On Fri, Mar 01, 2019 at 11:06:24PM +0900, Wang Shilong wrote:
> From: Wang Shilong <wshilong@ddn.com>
> 
> Cc: linux-man@vger.kernel.org
> Signed-off-by: Wang Shilong <wshilong@ddn.com>
> ---
>  man2/statx.2 | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/man2/statx.2 b/man2/statx.2
> index 7265d8ace..6a9dede8b 100644
> --- a/man2/statx.2
> +++ b/man2/statx.2
> @@ -82,6 +82,7 @@ struct statx {
>         containing the filesystem where the file resides */
>      __u32 stx_dev_major;   /* Major ID */
>      __u32 stx_dev_minor;   /* Minor ID */
> +    __u32 stx_projid;      /* Project ID of file */
>  };
>  .EE
>  .in
> @@ -261,6 +262,7 @@ STATX_SIZE	Want stx_size
>  STATX_BLOCKS	Want stx_blocks
>  STATX_BASIC_STATS	[All of the above]
>  STATX_BTIME	Want stx_btime
> +STATX_PROJID	Want stx_projid
>  STATX_ALL	[All currently available fields]
>  .TE
>  .in
> @@ -412,6 +414,9 @@ The device on which this file (inode) resides.
>  .IR stx_rdev_major " and "  stx_rdev_minor
>  The device that this file (inode) represents if the file is of block or
>  character device type.
> +.TP
> +.I stx_projid
> +The file's project ID.
>  .PP
>  For further information on the above fields, see
>  .BR inode (7).
> @@ -458,6 +463,9 @@ See
>  .TP
>  .B STATX_ATTR_ENCRYPTED
>  A key is required for the file to be encrypted by the filesystem.
> +.TP
> +.B STATX_ATTR_PROJINHERIT
> +Sub directories or files will inherit parent's project ID automatically.

"Newly created files and directories will inherit...", I think?

I appreciate the manpage and fstests updates immensely. :)

--D

>  .SH RETURN VALUE
>  On success, zero is returned.
>  On error, \-1 is returned, and
> -- 
> 2.19.1
>
Michael Kerrisk (man-pages) March 4, 2019, 1:52 p.m. UTC | #2
Hello Wang Shilong,

On Fri, 1 Mar 2019 at 15:06, Wang Shilong <wangshilong1991@gmail.com> wrote:
>
> From: Wang Shilong <wshilong@ddn.com>

I take it that these patches relate to some API changes that are not
yet merged into the kernel, right?

Also, I think we need some accompanying info to describe project IDs.
Can you point me at any documents/resources?

Thanks,

Michael

>
> Cc: linux-man@vger.kernel.org
> Signed-off-by: Wang Shilong <wshilong@ddn.com>
> ---
>  man2/statx.2 | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/man2/statx.2 b/man2/statx.2
> index 7265d8ace..6a9dede8b 100644
> --- a/man2/statx.2
> +++ b/man2/statx.2
> @@ -82,6 +82,7 @@ struct statx {
>         containing the filesystem where the file resides */
>      __u32 stx_dev_major;   /* Major ID */
>      __u32 stx_dev_minor;   /* Minor ID */
> +    __u32 stx_projid;      /* Project ID of file */
>  };
>  .EE
>  .in
> @@ -261,6 +262,7 @@ STATX_SIZE  Want stx_size
>  STATX_BLOCKS   Want stx_blocks
>  STATX_BASIC_STATS      [All of the above]
>  STATX_BTIME    Want stx_btime
> +STATX_PROJID   Want stx_projid
>  STATX_ALL      [All currently available fields]
>  .TE
>  .in
> @@ -412,6 +414,9 @@ The device on which this file (inode) resides.
>  .IR stx_rdev_major " and "  stx_rdev_minor
>  The device that this file (inode) represents if the file is of block or
>  character device type.
> +.TP
> +.I stx_projid
> +The file's project ID.
>  .PP
>  For further information on the above fields, see
>  .BR inode (7).
> @@ -458,6 +463,9 @@ See
>  .TP
>  .B STATX_ATTR_ENCRYPTED
>  A key is required for the file to be encrypted by the filesystem.
> +.TP
> +.B STATX_ATTR_PROJINHERIT
> +Sub directories or files will inherit parent's project ID automatically.
>  .SH RETURN VALUE
>  On success, zero is returned.
>  On error, \-1 is returned, and
> --
> 2.19.1
>
Dave Chinner March 4, 2019, 8:50 p.m. UTC | #3
On Mon, Mar 04, 2019 at 02:52:59PM +0100, Michael Kerrisk (man-pages) wrote:
> Hello Wang Shilong,
> 
> On Fri, 1 Mar 2019 at 15:06, Wang Shilong <wangshilong1991@gmail.com> wrote:
> >
> > From: Wang Shilong <wshilong@ddn.com>
> 
> I take it that these patches relate to some API changes that are not
> yet merged into the kernel, right?
> 
> Also, I think we need some accompanying info to describe project IDs.
> Can you point me at any documents/resources?

Probably "best" documented in the man pages that ship with xfsprogs.
Basically, it's just another quota ID that can be used to account
for files/directories in arbitrary admin defined groups. i.e. quotas
that aren't bound by user/group identities.

$ man 8 xfs_quota
$ man 5 projects
$ man 5 projid

Cheers,

Dave.
Michael Kerrisk (man-pages) March 4, 2019, 9:16 p.m. UTC | #4
Hi Dave,
On Mon, 4 Mar 2019 at 21:50, Dave Chinner <david@fromorbit.com> wrote:
>
> On Mon, Mar 04, 2019 at 02:52:59PM +0100, Michael Kerrisk (man-pages) wrote:
> > Hello Wang Shilong,
> >
> > On Fri, 1 Mar 2019 at 15:06, Wang Shilong <wangshilong1991@gmail.com> wrote:
> > >
> > > From: Wang Shilong <wshilong@ddn.com>
> >
> > I take it that these patches relate to some API changes that are not
> > yet merged into the kernel, right?
> >
> > Also, I think we need some accompanying info to describe project IDs.
> > Can you point me at any documents/resources?
>
> Probably "best" documented in the man pages that ship with xfsprogs.

But, these IDs are a kernel construct, right? Is their scope limited
just to XFS, or do other filesystems have the concept also?

Cheers,

Michael

> Basically, it's just another quota ID that can be used to account
> for files/directories in arbitrary admin defined groups. i.e. quotas
> that aren't bound by user/group identities.
>
> $ man 8 xfs_quota
> $ man 5 projects
> $ man 5 projid
Eugene Syromyatnikov March 4, 2019, 10:56 p.m. UTC | #5
On Mon, Mar 4, 2019 at 9:57 PM Dave Chinner <david@fromorbit.com> wrote:
>
> On Mon, Mar 04, 2019 at 02:52:59PM +0100, Michael Kerrisk (man-pages) wrote:
> > Hello Wang Shilong,
> >
> > On Fri, 1 Mar 2019 at 15:06, Wang Shilong <wangshilong1991@gmail.com> wrote:
> > >
> > > From: Wang Shilong <wshilong@ddn.com>
> >
> > I take it that these patches relate to some API changes that are not
> > yet merged into the kernel, right?
> >
> > Also, I think we need some accompanying info to describe project IDs.
> > Can you point me at any documents/resources?
>
> Probably "best" documented in the man pages that ship with xfsprogs.
> Basically, it's just another quota ID that can be used to account
> for files/directories in arbitrary admin defined groups. i.e. quotas
> that aren't bound by user/group identities.
>
> $ man 8 xfs_quota
> $ man 5 projects
> $ man 5 projid

Project quotas also mentioned in quotactl(2).
Dave Chinner March 4, 2019, 11:17 p.m. UTC | #6
On Mon, Mar 04, 2019 at 10:16:29PM +0100, Michael Kerrisk (man-pages) wrote:
> Hi Dave,
> On Mon, 4 Mar 2019 at 21:50, Dave Chinner <david@fromorbit.com> wrote:
> >
> > On Mon, Mar 04, 2019 at 02:52:59PM +0100, Michael Kerrisk (man-pages) wrote:
> > > Hello Wang Shilong,
> > >
> > > On Fri, 1 Mar 2019 at 15:06, Wang Shilong <wangshilong1991@gmail.com> wrote:
> > > >
> > > > From: Wang Shilong <wshilong@ddn.com>
> > >
> > > I take it that these patches relate to some API changes that are not
> > > yet merged into the kernel, right?
> > >
> > > Also, I think we need some accompanying info to describe project IDs.
> > > Can you point me at any documents/resources?
> >
> > Probably "best" documented in the man pages that ship with xfsprogs.
> 
> But, these IDs are a kernel construct, right?

On disk filesystem format construct, actually. The kernel doesn't
use them for anything other than filesystem quota accounting - it's
completely oblivious to the meaning of the IDs (unlike uids and gids
used for user and group quota accounting).

> Is their scope limited
> just to XFS, or do other filesystems have the concept also?

Originally only XFS. Irix implemented project quotas rather than
group quotas, IIRC, in the late 80s/early 90s(*) so XFS supported
project quotas for day zero. I think is was 2004/2005 that they were
fully supported on Linux (using an exclusive group or project
quota requirement) and with v5 filesystems we added a third quota
inode so we can have user, group and project quotas all active on a
filesystem at once.

2-3 years ago project quotas were added to ext4 and so anything that
uses the generic kernel quota infrastructure can implement it, too.

Cheers,

Dave.

(*) In some ways, we are still dragging Linux into the '80s, kicking
and screaming all the way :P
diff mbox series

Patch

diff --git a/man2/statx.2 b/man2/statx.2
index 7265d8ace..6a9dede8b 100644
--- a/man2/statx.2
+++ b/man2/statx.2
@@ -82,6 +82,7 @@  struct statx {
        containing the filesystem where the file resides */
     __u32 stx_dev_major;   /* Major ID */
     __u32 stx_dev_minor;   /* Minor ID */
+    __u32 stx_projid;      /* Project ID of file */
 };
 .EE
 .in
@@ -261,6 +262,7 @@  STATX_SIZE	Want stx_size
 STATX_BLOCKS	Want stx_blocks
 STATX_BASIC_STATS	[All of the above]
 STATX_BTIME	Want stx_btime
+STATX_PROJID	Want stx_projid
 STATX_ALL	[All currently available fields]
 .TE
 .in
@@ -412,6 +414,9 @@  The device on which this file (inode) resides.
 .IR stx_rdev_major " and "  stx_rdev_minor
 The device that this file (inode) represents if the file is of block or
 character device type.
+.TP
+.I stx_projid
+The file's project ID.
 .PP
 For further information on the above fields, see
 .BR inode (7).
@@ -458,6 +463,9 @@  See
 .TP
 .B STATX_ATTR_ENCRYPTED
 A key is required for the file to be encrypted by the filesystem.
+.TP
+.B STATX_ATTR_PROJINHERIT
+Sub directories or files will inherit parent's project ID automatically.
 .SH RETURN VALUE
 On success, zero is returned.
 On error, \-1 is returned, and