All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Extended file stat system call
@ 2012-04-19 14:05 ` David Howells
  0 siblings, 0 replies; 144+ messages in thread
From: David Howells @ 2012-04-19 14:05 UTC (permalink / raw)
  To: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA,
	wine-devel-5vRYHf7vrtgdnm+yROfE0A, kfm-devel-RoXCvvDuEio,
	nautilus-list-rDKQcyrBJuzYtjvyW6yDsg,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	libc-alpha-9JcytcrH/bA+uJoB2kUjGw


Implement a pair of new system calls to provide extended and further extensible
stat functions.

The second of the associated patches is the main patch that provides these new
system calls:

	ssize_t ret = xstat(int dfd,
			    const char *filename,
			    unsigned atflag,
			    unsigned mask,
			    struct xstat *buffer);

	ssize_t ret = fxstat(int fd,
			     unsigned atflag,
			     unsigned mask,
			     struct xstat *buffer);

which are more fully documented in the first patch's description.

These new stat functions provide a number of useful features, in summary:

 (1) More information: creation time, inode generation number, data version
     number, flags/attributes.  A subset of these is available through a number
     of filesystems (such as CIFS, NFS, AFS, Ext4 and BTRFS).

 (2) Lightweight stat: Ask for just those details of interest, and allow a
     netfs (such as NFS) to approximate anything not of interest, possibly
     without going to the server.

 (3) Heavyweight stat: Force a netfs to go to the server, even if it thinks its
     cached attributes are up to date.

 (4) Allow the filesystem to indicate what it can/cannot provide: A filesystem
     can now say it doesn't support a standard stat feature if that isn't
     available.

 (5) Make the fields a consistent size on all arches, and make them large.

 (6) Can be extended by using more request flags and appending further data
     after the end of the standard return data.

Note that no lstat() equivalent is required as that can be implemented through
xstat() with atflag == 0.


=======
PATCHES
=======

Patch 1 defines the xstat() and fxstat() system calls.

Patches 2-6 implement extended stat facilities for Ext4, AFS, NFS and CIFS, and
make eCryptFS go to the lower filesystem for such details.


==============
CONSIDERATIONS
==============

Should fxstat() be implemented as xstat() with a NULL filename, using dfd as
fd?

Should the default for a network fs be to do an unconditional (heavyweight)
stat with a flag to suppress going to the server to update the locally held
attributes and flushing pending writebacks?

Should things like the Windows Archive, Hidden and System bits be handled
through IOC flags, perhaps expanded to 64-bits?

Are these things useful to userspace other than Samba and userspace NFS
servers?

Is it useful to pass the volume ID out?  Or is statfs() sufficient for this?

Should I add a sixth argument to xstat(), mark it reserved and require that
must be supplied as 0 to hedge against future use?

Is there anything else I can usefully add at the moment?


==========
TO BE DONE
==========

Autofs, ntfs, btrfs, ...

I should perhaps use u8/u32/u64 rather than uint8/32/64_t.

Handle remote filesystems being offline and indicate this with
XSTAT_INFO_OFFLINE.


=======
TESTING
=======

There's a test program attached to the description for the main patch.  It can
be run as follows:
[root@andromeda tmp]# ./xstat -R /mnt/foo

	xstat(/mnt/foo) = 0
	0000: 000081a40000ffef 0000000000000001 0000020000000000 0000100000080000
	0020: 0000000000000000 0000000600000008 000000004f88499a 0000000136fd9208
	0040: 000000004f88499a 0000000136fd9208 000000004f8849b9 0000000106daf187
	0060: 000000004f8849b9 0000000106daf187 000000000000000c 000000000000000f
	0080: 0000000000000008 00000000484ebbef 0000000000000025 5949ebd4711efd82
	00a0: d3250b5c15d5e380 0000000000000000 0000000000000000 0000000000000000
	00c0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
	00e0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
	results=ffef
	  Size: 15              Blocks: 8          IO Block: 4096    regular file
	Device: 08:06           Inode: 12          Links: 1    
	Access: (0644/-rw-r--r--)  Uid: 0   
	Gid: 0
	Access: 2012-04-13 16:43:22.922587656+0100
	Modify: 2012-04-13 16:43:53.115011975+0100
	Change: 2012-04-13 16:43:53.115011975+0100
	Create: 2012-04-13 16:43:22.922587656+0100
	Inode version: 484ebbefh
	Data version: 25h
	Inode flags: 00080000 (-------- ----e--- -------- --------)
	Information: 00000200 (-------- -------- ------a- --------)
	Volume ID: 82fd1e71d4eb4959-80e3d5155c0b25d3

David
---
David Howells (6):
      xstat: eCryptFS: Return extended attributes
      xstat: CIFS: Return extended attributes
      xstat: NFS: Return extended attributes
      xstat: AFS: Return extended attributes
      xstat: Ext4: Return extended attributes
      xstat: Add a pair of system calls to make extended file stats available


 arch/x86/syscalls/syscall_32.tbl |    2 
 arch/x86/syscalls/syscall_64.tbl |    2 
 fs/afs/inode.c                   |   29 ++-
 fs/afs/super.c                   |    7 +
 fs/cifs/cifsfs.h                 |    4 
 fs/cifs/cifsglob.h               |   16 +-
 fs/cifs/dir.c                    |    2 
 fs/cifs/inode.c                  |  120 +++++++++++--
 fs/ecryptfs/inode.c              |   14 +-
 fs/ext4/ext4.h                   |    2 
 fs/ext4/file.c                   |    2 
 fs/ext4/inode.c                  |   32 +++
 fs/ext4/namei.c                  |    2 
 fs/ext4/super.c                  |    1 
 fs/ext4/symlink.c                |    2 
 fs/nfs/inode.c                   |   49 ++++-
 fs/nfs/super.c                   |    1 
 fs/stat.c                        |  350 +++++++++++++++++++++++++++++++++++---
 include/linux/fcntl.h            |    1 
 include/linux/fs.h               |    4 
 include/linux/stat.h             |  126 +++++++++++++-
 include/linux/syscalls.h         |    7 +
 22 files changed, 694 insertions(+), 81 deletions(-)

^ permalink raw reply	[flat|nested] 144+ messages in thread

end of thread, other threads:[~2012-05-11  8:54 UTC | newest]

Thread overview: 144+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 14:05 [PATCH 0/6] Extended file stat system call David Howells
2012-04-19 14:05 ` David Howells
2012-04-19 14:06 ` [PATCH 3/6] xstat: AFS: Return extended attributes David Howells
2012-04-19 14:06 ` [PATCH 4/6] xstat: NFS: " David Howells
     [not found]   ` <20120419140653.17272.95035.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2012-04-19 14:35     ` Myklebust, Trond
2012-04-19 14:35       ` Myklebust, Trond
2012-04-26 13:52   ` David Howells
2012-04-19 14:07 ` [PATCH 5/6] xstat: CIFS: " David Howells
     [not found]   ` <20120419140706.17272.72290.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2012-04-19 15:19     ` Steve French
2012-04-19 15:19       ` Steve French
2012-04-19 16:32 ` [PATCH 0/6] Extended file stat system call Roland McGrath
2012-04-19 21:51   ` Paul Eggert
2012-04-19 23:05     ` Roland McGrath
2012-04-26 14:16     ` David Howells
     [not found]       ` <20173.1335449760-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-26 18:22         ` Roland McGrath
2012-04-26 18:22           ` Roland McGrath
     [not found]   ` <4F9088D6.9020203-764C0pRuGfqVc3sceRu5cw@public.gmane.org>
2012-04-26 14:04     ` David Howells
2012-04-26 14:04       ` David Howells
     [not found]       ` <19638.1335449047-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-26 18:24         ` Roland McGrath
2012-04-26 18:24           ` Roland McGrath
2012-04-19 23:29 ` Andreas Dilger
2012-04-26 13:54 ` David Howells
     [not found]   ` <19184.1335448455-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-26 18:25     ` Roland McGrath
2012-04-26 18:25       ` Roland McGrath
2012-04-27 23:54       ` Paul Eggert
     [not found]   ` <20120426182524.E5ADF2C0EC-j1d2VQoJOwwHfwO+Tb3JRVaTQe2KTcn/@public.gmane.org>
2012-04-26 21:54     ` David Howells
2012-04-26 21:54       ` David Howells
     [not found]       ` <9931.1335477281-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-26 22:02         ` Roland McGrath
2012-04-26 22:02           ` Roland McGrath
2012-04-26 22:21           ` Nix
2012-04-26 14:25 ` David Howells
2012-04-26 14:54   ` Steve French
     [not found]     ` <CAH2r5mv1Lijdwk5zsQwYJr4Etb6fhrRyNXm-iFCQX+HecboGrQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-26 15:25       ` Myklebust, Trond
2012-04-26 15:25         ` Myklebust, Trond
2012-04-26 16:56         ` Steve French
2012-04-26 16:56           ` Steve French
     [not found]           ` <CAH2r5mt5af-_hxBRKK72iD5Gr99bo91ec78Rov8EGVEx8=21mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-26 17:00             ` Myklebust, Trond
2012-04-26 17:00               ` Myklebust, Trond
2012-04-26 17:03               ` Steve French
2012-04-26 17:03                 ` Steve French
     [not found]                 ` <CAH2r5mvmCfLrxRHje6Wx5X84zxPEHwRMUJGsjvWBujMu7w841w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-26 17:06                   ` Myklebust, Trond
2012-04-26 17:06                     ` Myklebust, Trond
     [not found]                     ` <1335460011.9701.30.camel-SyLVLa/KEI9HwK5hSS5vWB2eb7JE58TQ@public.gmane.org>
2012-04-26 17:09                       ` Steve French
2012-04-26 17:09                         ` Steve French
     [not found]                         ` <CAH2r5muXk+frkFz9X523Ny=RMwJGeqOPH75G1ToNa5QoMo5SkQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-26 17:10                           ` Steve French
2012-04-26 17:10                             ` Steve French
2012-04-26 21:57                       ` David Howells
2012-04-26 21:57                         ` David Howells
     [not found]                         ` <10104.1335477476-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-26 22:05                           ` Roland McGrath
2012-04-26 22:05                             ` Roland McGrath
     [not found]                             ` <20120426220552.D98D62C0D3-j1d2VQoJOwwHfwO+Tb3JRVaTQe2KTcn/@public.gmane.org>
2012-04-27  0:33                               ` Myklebust, Trond
2012-04-27  0:33                                 ` Myklebust, Trond
2012-04-27  0:30                           ` Myklebust, Trond
2012-04-27  0:30                             ` Myklebust, Trond
2012-04-26 15:52   ` David Howells
2012-04-27  0:29     ` Andreas Dilger
2012-04-27  0:29       ` Andreas Dilger
     [not found]     ` <3F302713-B675-4BAA-B2B7-235E03C5975F-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
2012-04-27  9:19       ` David Howells
2012-04-27  9:19         ` David Howells
     [not found] ` <20120419140558.17272.74360.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2012-04-19 14:06   ` [PATCH 1/6] xstat: Add a pair of system calls to make extended file stats available David Howells
2012-04-19 14:06     ` David Howells
2012-04-19 23:36     ` Andreas Dilger
     [not found]     ` <20120419140612.17272.57774.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2012-04-24 21:29       ` J. Bruce Fields
2012-04-24 21:29         ` J. Bruce Fields
     [not found]         ` <20120424212911.GA26073-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-04-24 22:08           ` Steve French
2012-04-24 22:08             ` Steve French
2012-04-25 14:44           ` Andreas Dilger
2012-04-25 14:44             ` Andreas Dilger
2012-04-26 13:45         ` David Howells
     [not found]           ` <18765.1335447954-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-26 14:28             ` J. Bruce Fields
2012-04-26 14:28               ` J. Bruce Fields
2012-04-26 17:06               ` Steve French
2012-04-26 17:06                 ` Steve French
2012-04-26 13:32     ` David Howells
     [not found]       ` <18195.1335447156-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-27  0:51         ` Dave Chinner
2012-04-27  0:51           ` Dave Chinner
2012-04-27  3:11           ` Andreas Dilger
2012-04-27  3:11             ` Andreas Dilger
2012-04-26 13:40     ` David Howells
     [not found]       ` <18533.1335447617-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-26 14:23         ` J. Bruce Fields
2012-04-26 14:23           ` J. Bruce Fields
2012-04-30 16:27       ` Ben Hutchings
2012-04-30 20:15         ` David Howells
2012-04-30 20:30           ` J. Bruce Fields
2012-04-30 23:31             ` Ben Hutchings
2012-04-19 14:06   ` [PATCH 2/6] xstat: Ext4: Return extended attributes David Howells
2012-04-19 14:06     ` David Howells
     [not found]     ` <20120419140625.17272.23303.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2012-04-19 16:03       ` Steve French
2012-04-19 16:03         ` Steve French
2012-04-26 13:47     ` David Howells
2012-04-26 17:00       ` Steve French
2012-04-26 17:00         ` Steve French
2012-04-19 14:07   ` [PATCH 6/6] xstat: eCryptFS: " David Howells
2012-04-19 14:07     ` David Howells
2012-04-19 17:11   ` [PATCH 0/6] Extended file stat system call Steve French
2012-04-19 17:11     ` Steve French
2012-04-27  1:06   ` Dave Chinner
2012-04-27  1:06     ` Dave Chinner
2012-04-27  3:22     ` Andreas Dilger
     [not found]       ` <ED5B8F1B-6C99-4516-85FA-A767E94B635F-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
2012-04-28  0:38         ` Dave Chinner
2012-04-28  0:38           ` Dave Chinner
2012-04-28  0:54           ` Steve French
2012-05-08 20:19   ` Extended file stat: Splitting file- and fs-specific info? David Howells
2012-05-08 20:19     ` David Howells
2012-05-08 21:13     ` Myklebust, Trond
2012-05-08 21:13       ` Myklebust, Trond
     [not found]     ` <16281.1336508382-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-05-09  0:24       ` Dave Chinner
2012-05-09  0:24         ` Dave Chinner
2012-05-09  1:09         ` J. Bruce Fields
2012-05-09  1:09           ` J. Bruce Fields
2012-05-09  4:25           ` Dave Chinner
2012-05-09 11:14             ` J. Bruce Fields
2012-05-09 11:14               ` J. Bruce Fields
2012-05-09  1:16         ` Andreas Dilger
2012-05-09  1:16           ` Andreas Dilger
2012-05-10  9:23         ` David Howells
     [not found]           ` <14477.1336641794-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-05-10 16:05             ` Andreas Dilger
2012-05-10 16:05               ` Andreas Dilger
2012-05-10 17:10             ` Roland McGrath
2012-05-10 17:10               ` Roland McGrath
2012-05-11  8:54               ` Andreas Dilger
2012-05-09  9:21     ` David Howells
2012-05-09  9:21       ` David Howells
     [not found]       ` <20170.1336555274-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-05-09 11:19         ` Christoph Hellwig
2012-05-09 11:19           ` Christoph Hellwig
     [not found]           ` <20120509111958.GA11345-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2012-05-09 11:55             ` Bernd Schubert
2012-05-09 11:55               ` Bernd Schubert
     [not found]               ` <4FAA5B24.1020306-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
2012-05-09 12:05                 ` Christoph Hellwig
2012-05-09 12:05                   ` Christoph Hellwig
     [not found]                   ` <20120509120544.GA17535-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2012-05-09 12:25                     ` Bernd Schubert
2012-05-09 12:25                       ` Bernd Schubert
2012-05-09 13:51                       ` Andreas Dilger
2012-05-09 14:12                         ` Bernd Schubert
2012-05-10  9:14     ` David Howells
2012-05-10  9:14       ` David Howells
2012-04-27  9:39 ` [PATCH 0/6] Extended file stat system call David Howells
     [not found]   ` <4111.1335519545-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-27 13:13     ` Dave Chinner
2012-04-27 13:13       ` Dave Chinner
2012-04-27 15:10       ` J. Bruce Fields
     [not found]         ` <20120427151057.GA16580-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-04-27 16:32           ` Steve French
2012-04-27 16:32             ` Steve French
2012-04-27 19:31       ` Andreas Dilger
2012-04-28  0:58         ` Dave Chinner
2012-05-10  9:51         ` David Howells

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.