NFS: Optimise away unnecessary setattrs for open(O_TRUNC);
Currently, we will correctly optimise away a truncate that doesn't change the file size. However, in the case of open(O_TRUNC), we also want to optimise away the time changes. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
@ -402,7 +402,7 @@ out_no_inode:
|
||||
goto out;
|
||||
}
|
||||
|
||||
#define NFS_VALID_ATTRS (ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|ATTR_ATIME|ATTR_ATIME_SET|ATTR_MTIME|ATTR_MTIME_SET|ATTR_FILE)
|
||||
#define NFS_VALID_ATTRS (ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|ATTR_ATIME|ATTR_ATIME_SET|ATTR_MTIME|ATTR_MTIME_SET|ATTR_FILE|ATTR_OPEN)
|
||||
|
||||
int
|
||||
nfs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
@ -424,7 +424,7 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
|
||||
/* Optimization: if the end result is no change, don't RPC */
|
||||
attr->ia_valid &= NFS_VALID_ATTRS;
|
||||
if ((attr->ia_valid & ~ATTR_FILE) == 0)
|
||||
if ((attr->ia_valid & ~(ATTR_FILE|ATTR_OPEN)) == 0)
|
||||
return 0;
|
||||
|
||||
/* Write all dirty data */
|
||||
|
Reference in New Issue
Block a user