diff options
author | Christoph Hellwig <hch@lst.de> | 2010-06-04 05:30:02 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:47:37 -0400 |
commit | 1025774ce411f2bd4b059ad7b53f0003569b74fa (patch) | |
tree | 2be221c205cb5579652a6063e8ee27d1c72d1bbd /fs/cifs | |
parent | eef2380c187890816b73b1a4cb89a09203759469 (diff) |
remove inode_setattr
Replace inode_setattr with opencoded variants of it in all callers. This
moves the remaining call to vmtruncate into the filesystem methods where it
can be replaced with the proper truncate sequence.
In a few cases it was obvious that we would never end up calling vmtruncate
so it was left out in the opencoded variant:
spufs: explicitly checks for ATTR_SIZE earlier
btrfs,hugetlbfs,logfs,dlmfs: explicitly clears ATTR_SIZE earlier
ufs: contains an opencoded simple_seattr + truncate that sets the filesize just above
In addition to that ncpfs called inode_setattr with handcrafted iattrs,
which allowed to trim down the opencoded variant.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/inode.c | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index a15b3a9bbff4..9c6a40f5cc57 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1889,18 +1889,27 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) | |||
1889 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1889 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1890 | } | 1890 | } |
1891 | 1891 | ||
1892 | if (!rc) { | 1892 | if (rc) |
1893 | rc = inode_setattr(inode, attrs); | 1893 | goto out; |
1894 | 1894 | ||
1895 | /* force revalidate when any of these times are set since some | 1895 | if ((attrs->ia_valid & ATTR_SIZE) && |
1896 | of the fs types (eg ext3, fat) do not have fine enough | 1896 | attrs->ia_size != i_size_read(inode)) { |
1897 | time granularity to match protocol, and we do not have a | 1897 | rc = vmtruncate(inode, attrs->ia_size); |
1898 | a way (yet) to query the server fs's time granularity (and | 1898 | if (rc) |
1899 | whether it rounds times down). | 1899 | goto out; |
1900 | */ | ||
1901 | if (!rc && (attrs->ia_valid & (ATTR_MTIME | ATTR_CTIME))) | ||
1902 | cifsInode->time = 0; | ||
1903 | } | 1900 | } |
1901 | |||
1902 | setattr_copy(inode, attrs); | ||
1903 | mark_inode_dirty(inode); | ||
1904 | |||
1905 | /* force revalidate when any of these times are set since some | ||
1906 | of the fs types (eg ext3, fat) do not have fine enough | ||
1907 | time granularity to match protocol, and we do not have a | ||
1908 | a way (yet) to query the server fs's time granularity (and | ||
1909 | whether it rounds times down). | ||
1910 | */ | ||
1911 | if (attrs->ia_valid & (ATTR_MTIME | ATTR_CTIME)) | ||
1912 | cifsInode->time = 0; | ||
1904 | out: | 1913 | out: |
1905 | kfree(args); | 1914 | kfree(args); |
1906 | kfree(full_path); | 1915 | kfree(full_path); |
@@ -2040,8 +2049,20 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) | |||
2040 | 2049 | ||
2041 | /* do not need local check to inode_check_ok since the server does | 2050 | /* do not need local check to inode_check_ok since the server does |
2042 | that */ | 2051 | that */ |
2043 | if (!rc) | 2052 | if (rc) |
2044 | rc = inode_setattr(inode, attrs); | 2053 | goto cifs_setattr_exit; |
2054 | |||
2055 | if ((attrs->ia_valid & ATTR_SIZE) && | ||
2056 | attrs->ia_size != i_size_read(inode)) { | ||
2057 | rc = vmtruncate(inode, attrs->ia_size); | ||
2058 | if (rc) | ||
2059 | goto cifs_setattr_exit; | ||
2060 | } | ||
2061 | |||
2062 | setattr_copy(inode, attrs); | ||
2063 | mark_inode_dirty(inode); | ||
2064 | return 0; | ||
2065 | |||
2045 | cifs_setattr_exit: | 2066 | cifs_setattr_exit: |
2046 | kfree(full_path); | 2067 | kfree(full_path); |
2047 | FreeXid(xid); | 2068 | FreeXid(xid); |