sys_fstatat: Update file systems for new ->getattr callback
Subsystems (14)
RFC PATCH 2/2 sys_fstatat: Update file systems for new ->getattr callback
The previous patch changed the prototype of ->getattr by adding a flags field. This patch updates individual file system implementations for the new flags field.
--- fs/9p/vfs_inode.c | 2 +- fs/afs/inode.c | 2 +- fs/afs/internal.h | 2 +- fs/btrfs/inode.c | 2 +- fs/cifs/cifsfs.h | 2 +- fs/cifs/inode.c | 2 +- fs/coda/inode.c | 2 +- fs/ext4/ext4.h | 2 +- fs/ext4/inode.c | 2 +- fs/fat/fat.h | 2 +- fs/fat/file.c | 3 ++- fs/fuse/dir.c | 2 +- fs/gfs2/ops_inode.c | 2 +- fs/minix/inode.c | 2 +- fs/minix/minix.h | 2 +- fs/nfs/inode.c | 3 ++- fs/ocfs2/file.c | 3 ++- fs/ocfs2/file.h | 2 +- fs/proc/base.c | 4 ++-- fs/proc/generic.c | 2 +- fs/proc/proc_net.c | 2 +- fs/proc/proc_sysctl.c | 2 +- fs/proc/root.c | 2 +- fs/sysv/itree.c | 2 +- fs/sysv/sysv.h | 2 +- fs/ubifs/dir.c | 2 +- fs/ubifs/ubifs.h | 2 +- include/linux/coda_linux.h | 2 +- include/linux/nfs_fs.h | 2 +- 29 files changed, 33 insertions(+), 30 deletions(-)
fs/9p/vfs_inode.c +1 -1
@@ -737,7 +737,7 @@ done:static int v9fs_vfs_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat,int flags) {int err;struct v9fs_session_info *v9ses;
fs/afs/inode.c +1 -1
@@ -292,7 +292,7 @@ error_unlock:* read the attributes of an inode */ int afs_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat,int flags) {struct inode *inode;
fs/afs/internal.h +1 -1
@@ -546,7 +546,7 @@ extern struct inode *afs_iget(struct super_block *, struct key *, struct afs_callback *);extern void afs_zap_data (struct afs_vnode *);extern int afs_validate (struct afs_vnode *,struct key *); -extern int afs_getattr (struct vfsmount *,struct dentry *,struct kstat *); +extern int afs_getattr (struct vfsmount *,struct dentry *,struct kstat *,int );extern int afs_setattr (struct dentry *,struct iattr *);extern void afs_clear_inode (struct inode *);
fs/btrfs/inode.c +1 -1
@@ -4563,7 +4563,7 @@ fail: }static int btrfs_getattr (struct vfsmount *mnt, -struct dentry *dentry,struct kstat *stat) +struct dentry *dentry,struct kstat *stat,int flags) {struct inode *inode = dentry->d_inode;generic_fillattr (inode, stat);
fs/cifs/cifsfs.h +1 -1
@@ -49,7 +49,7 @@ extern int cifs_rmdir(struct inode *, struct dentry *);extern int cifs_rename (struct inode *,struct dentry *,struct inode *,struct dentry *);extern int cifs_revalidate (struct dentry *); -extern int cifs_getattr (struct vfsmount *,struct dentry *,struct kstat *); +extern int cifs_getattr (struct vfsmount *,struct dentry *,struct kstat *,int );extern int cifs_setattr (struct dentry *,struct iattr *);extern const struct inode_operations cifs_file_inode_ops;
fs/cifs/inode.c +1 -1
@@ -1599,7 +1599,7 @@ int cifs_revalidate(struct dentry *direntry) }int cifs_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat,int flags) {int err =cifs_revalidate (dentry);if (!err) {
fs/coda/inode.c +1 -1
@@ -220,7 +220,7 @@ static void coda_clear_inode(struct inode *inode)coda_cache_clear_inode (inode); } -int coda_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) +int coda_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat,int flags) {int err =coda_revalidate_inode (dentry);if (!err)
fs/ext4/ext4.h +1 -1
@@ -1081,7 +1081,7 @@ extern struct inode *ext4_iget(struct super_block *, unsigned long);extern int ext4_write_inode (struct inode *,int );extern int ext4_setattr (struct dentry *,struct iattr *);extern int ext4_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat); +struct kstat *stat,int flags);extern void ext4_delete_inode (struct inode *);extern int ext4_sync_inode (handle_t *,struct inode *);extern void ext4_dirty_inode (struct inode *);
fs/ext4/inode.c +1 -1
@@ -4691,7 +4691,7 @@ err_out: }int ext4_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat,int flags) {struct inode *inode;unsigned long delalloc_blocks;
fs/fat/fat.h +1 -1
@@ -295,7 +295,7 @@ extern const struct inode_operations fat_file_inode_operations;extern int fat_setattr (struct dentry * dentry,struct iattr * attr);extern void fat_truncate (struct inode *inode);extern int fat_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat); +struct kstat *stat,int flags);/* fat/inode.c */ extern void fat_attach (struct inode *inode,loff_t i_pos);
fs/fat/file.c +2 -1
@@ -253,7 +253,8 @@ void fat_truncate(struct inode *inode)fat_flush_inodes (inode->i_sb, inode,NULL ); } -int fat_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) +int fat_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat, +int flags) {struct inode *inode = dentry->d_inode;generic_fillattr (inode, stat);
fs/fuse/dir.c +1 -1
@@ -1330,7 +1330,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) }static int fuse_getattr (struct vfsmount *mnt,struct dentry *entry, -struct kstat *stat) +struct kstat *stat,int flags) {struct inode *inode = entry->d_inode;struct fuse_conn *fc =get_fuse_conn (inode);
fs/gfs2/ops_inode.c +1 -1
@@ -1130,7 +1130,7 @@ out:*/ static int gfs2_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat,int flags) {struct inode *inode = dentry->d_inode;struct gfs2_inode *ip =GFS2_I (inode);
fs/minix/inode.c +1 -1
@@ -585,7 +585,7 @@ int minix_sync_inode(struct inode * inode)return err; } -int minix_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) +int minix_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat,int flags) {struct inode *dir = dentry->d_parent->d_inode;struct super_block *sb = dir->i_sb;
fs/minix/minix.h +1 -1
@@ -49,7 +49,7 @@ extern unsigned long minix_count_free_inodes(struct minix_sb_info *sbi);extern int minix_new_block (struct inode * inode);extern void minix_free_block (struct inode *inode,unsigned long block);extern unsigned long minix_count_free_blocks (struct minix_sb_info *sbi); -extern int minix_getattr (struct vfsmount *,struct dentry *,struct kstat *); +extern int minix_getattr (struct vfsmount *,struct dentry *,struct kstat *,int );extern int __minix_write_begin (struct file *file,struct address_space *mapping,loff_t pos,unsigned len,unsigned flags,struct page **pagep,void **fsdata);
fs/nfs/inode.c +2 -1
@@ -471,7 +471,8 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr) } } -int nfs_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) +int nfs_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat, +int flags) {struct inode *inode = dentry->d_inode;int need_atime =NFS_I (inode)->cache_validity &NFS_INO_INVALID_ATIME ;
fs/ocfs2/file.c +2 -1
@@ -1055,7 +1055,8 @@ bail:int ocfs2_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat, +int flags) {struct inode *inode = dentry->d_inode;struct super_block *sb = dentry->d_inode->i_sb;
fs/ocfs2/file.h +1 -1
@@ -58,7 +58,7 @@ int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size, u64 zero_to);int ocfs2_setattr (struct dentry *dentry,struct iattr *attr);int ocfs2_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat); +struct kstat *stat,int flags);int ocfs2_permission (struct inode *inode,int mask); int ocfs2_should_update_atime(struct inode *inode,
fs/proc/base.c +2 -2
@@ -1468,7 +1468,7 @@ out_unlock:return NULL ; } -static int pid_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) +static int pid_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat,int flags) {struct inode *inode = dentry->d_inode;struct task_struct *task;
@@ -3121,7 +3121,7 @@ out_no_task:return retval; } -static int proc_task_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) +static int proc_task_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat,int flags) {struct inode *inode = dentry->d_inode;struct task_struct *p =get_proc_task (inode);
fs/proc/generic.c +1 -1
@@ -243,7 +243,7 @@ out: }static int proc_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat,int flags) {struct inode *inode = dentry->d_inode;struct proc_dir_entry *de =PROC_I (inode)->pde;
fs/proc/proc_net.c +1 -1
@@ -133,7 +133,7 @@ static struct dentry *proc_tgid_net_lookup(struct inode *dir, }static int proc_tgid_net_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat,int flags) {struct inode *inode = dentry->d_inode;struct net *net;
fs/proc/proc_sysctl.c +1 -1
@@ -335,7 +335,7 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)return error; } -static int proc_sys_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) +static int proc_sys_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat,int flags) {struct inode *inode = dentry->d_inode;struct ctl_table_header *head =grab_header (inode);
fs/proc/root.c +1 -1
@@ -138,7 +138,7 @@ void __init proc_root_init(void)proc_sys_init (); } -static int proc_root_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat +static int proc_root_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat,int flags ) {generic_fillattr (dentry->d_inode, stat);
fs/sysv/itree.c +1 -1
@@ -440,7 +440,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size)return blocks; } -int sysv_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) +int sysv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat, 0) {struct super_block *s = mnt->mnt_sb;generic_fillattr (dentry->d_inode, stat);
fs/sysv/sysv.h +1 -1
@@ -146,7 +146,7 @@ extern int sysv_write_inode(struct inode *, int);extern int sysv_sync_inode (struct inode *);extern int sysv_sync_file (struct file *,struct dentry *,int );extern void sysv_set_inode (struct inode *,dev_t ); -extern int sysv_getattr (struct vfsmount *,struct dentry *,struct kstat *); +extern int sysv_getattr (struct vfsmount *,struct dentry *,struct kstat *,int );extern int sysv_init_icache (void );extern void sysv_destroy_icache (void );
fs/ubifs/dir.c +1 -1
@@ -1132,7 +1132,7 @@ out_cancel: }int ubifs_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat) +struct kstat *stat,int flags) {loff_t size;struct inode *inode = dentry->d_inode;
fs/ubifs/ubifs.h +1 -1
@@ -1672,7 +1672,7 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr);struct inode *ubifs_new_inode (struct ubifs_info *c,const struct inode *dir,int mode);int ubifs_getattr (struct vfsmount *mnt,struct dentry *dentry, -struct kstat *stat); +struct kstat *stat,int flags);/* xattr.c */ int ubifs_setxattr(struct dentry *dentry, const char *name,
include/linux/coda_linux.h +1 -1
@@ -39,7 +39,7 @@ int coda_open(struct inode *i, struct file *f);int coda_release (struct inode *i,struct file *f);int coda_permission (struct inode *inode,int mask);int coda_revalidate_inode (struct dentry *); -int coda_getattr (struct vfsmount *,struct dentry *,struct kstat *); +int coda_getattr (struct vfsmount *,struct dentry *,struct kstat *,int );int coda_setattr (struct dentry *,struct iattr *);/* this file: heloers */
include/linux/nfs_fs.h +1 -1
@@ -332,7 +332,7 @@ extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,extern int nfs_refresh_inode (struct inode *,struct nfs_fattr *);extern int nfs_post_op_update_inode (struct inode *inode,struct nfs_fattr *fattr);extern int nfs_post_op_update_inode_force_wcc (struct inode *inode,struct nfs_fattr *fattr); -extern int nfs_getattr (struct vfsmount *,struct dentry *,struct kstat *); +extern int nfs_getattr (struct vfsmount *,struct dentry *,struct kstat *,int );extern int nfs_permission (struct inode *,int );extern int nfs_open (struct inode *,struct file *);extern int nfs_release (struct inode *,struct file *);
Signature · 1 line
1.5.6
Re: [PATCH 3/2] [RFC] NFS: Support the AT_NO_TIMES and AT_STRICT fstatat flags
If the kernel knows that the application doesn't care about the time information, then we can avoid having to flush out writes, and we can avoid revalidating the atime information.
OTOH, if the app sets AT_STRICT then we must force a revalidation of the attribute metadata.
--- fs/nfs/inode.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)
fs/nfs/inode.c +11 -5
@@ -506,9 +506,14 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat, int flags) {struct inode *inode = dentry->d_inode; -int need_atime =NFS_I (inode)->cache_validity &NFS_INO_INVALID_ATIME ; +int force_reval =0 ;int err; + force_reval |= (flags &AT_STRICT ) !=0 ; + +if (!(flags &AT_NO_TIMES )) + goto do_revalidate; +/* * Flush out writes to the server in order to update c/mtime. *
@@ -531,11 +536,12 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat,* - NFS never sets MS_NOATIME or MS_NODIRATIME so there is * no point in checking those. */ -if ((mnt->mnt_flags &MNT_NOATIME ) || - ((mnt->mnt_flags &MNT_NODIRATIME ) &&S_ISDIR (inode->i_mode))) - need_atime =0 ; +if (!((mnt->mnt_flags &MNT_NOATIME ) || + ((mnt->mnt_flags &MNT_NODIRATIME ) &&S_ISDIR (inode->i_mode)))) + force_reval |= (NFS_I (inode)->cache_validity &NFS_INO_INVALID_ATIME ) !=0 ; -if (need_atime) +do_revalidate: +if (force_reval) err =__nfs_revalidate_inode (NFS_SERVER (inode), inode);else err =nfs_revalidate_inode (NFS_SERVER (inode), inode);
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Re: [PATCH 3/2] [RFC] NFS: Support the AT_NO_TIMES and AT_STRICT fstatat flags
Hello!
fs/nfs/inode.c int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat, · line 515
Quoted 2 lines · Trond Myklebust
fs/nfs/inode.c +2
-0+if (!(flags &AT_NO_TIMES )) + goto do_revalidate;
This is already a shortcoming of the less-fine grained control. Suppose a normal ls -l command, it does not care about atimes, only mtimes, but there is no way to specify it and NFS only cares if atimes were requested or not.
Bye,
Oleg
Re: [PATCH 3/2] [RFC] NFS: Support the AT_NO_TIMES and AT_STRICT fstatat flags
Quoted 11 lines · Oleg Drokin
Hello!
fs/nfs/inode.c int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat, · line 515
Quoted 2 lines · Trond Myklebust
fs/nfs/inode.c +2
-0+if (!(flags &AT_NO_TIMES )) + goto do_revalidate;This is already a shortcoming of the less-fine grained control. Suppose a normal ls -l command, it does not care about atimes, only mtimes, but there is no way to specify it and NFS only cares if atimes were requested or not.
I agree that an explicit AT_NO_ATIME might be useful.
Cheers
Trond
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com