diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-09-17 05:26:06 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@redhat.com> | 2014-10-14 13:03:40 -0400 |
commit | a4483e8a424d76bc1dfacdd94e739fba29d7f83f (patch) | |
tree | d5b88ea82a6ef8722ec2c6c4a26cfd723e614c06 /fs | |
parent | 3b70b388e3378d0b7272d649bb91451a6de4e924 (diff) |
ceph: remove redundant code for max file size verification
Both ceph_update_writeable_page and ceph_setattr will verify file size
with max size ceph supported.
There are two caller for ceph_update_writeable_page, ceph_write_begin and
ceph_page_mkwrite. For ceph_write_begin, we have already verified the size in
generic_write_checks of ceph_write_iter; for ceph_page_mkwrite, we have no
chance to change file size when mmap. Likewise we have already verified the size
in inode_change_ok when we call ceph_setattr.
So let's remove the redundant code for max file size verification.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Reviewed-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/addr.c | 9 | ||||
-rw-r--r-- | fs/ceph/inode.c | 6 |
2 files changed, 0 insertions, 15 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 90b3954d48ed..18c06bbaf136 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -1076,12 +1076,6 @@ retry_locked: | |||
1076 | /* past end of file? */ | 1076 | /* past end of file? */ |
1077 | i_size = inode->i_size; /* caller holds i_mutex */ | 1077 | i_size = inode->i_size; /* caller holds i_mutex */ |
1078 | 1078 | ||
1079 | if (i_size + len > inode->i_sb->s_maxbytes) { | ||
1080 | /* file is too big */ | ||
1081 | r = -EINVAL; | ||
1082 | goto fail; | ||
1083 | } | ||
1084 | |||
1085 | if (page_off >= i_size || | 1079 | if (page_off >= i_size || |
1086 | (pos_in_page == 0 && (pos+len) >= i_size && | 1080 | (pos_in_page == 0 && (pos+len) >= i_size && |
1087 | end_in_page - pos_in_page != PAGE_CACHE_SIZE)) { | 1081 | end_in_page - pos_in_page != PAGE_CACHE_SIZE)) { |
@@ -1099,9 +1093,6 @@ retry_locked: | |||
1099 | if (r < 0) | 1093 | if (r < 0) |
1100 | goto fail_nosnap; | 1094 | goto fail_nosnap; |
1101 | goto retry_locked; | 1095 | goto retry_locked; |
1102 | |||
1103 | fail: | ||
1104 | up_read(&mdsc->snap_rwsem); | ||
1105 | fail_nosnap: | 1096 | fail_nosnap: |
1106 | unlock_page(page); | 1097 | unlock_page(page); |
1107 | return r; | 1098 | return r; |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 5fbd0adb5724..7b6139004401 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -1813,10 +1813,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1813 | if (ia_valid & ATTR_SIZE) { | 1813 | if (ia_valid & ATTR_SIZE) { |
1814 | dout("setattr %p size %lld -> %lld\n", inode, | 1814 | dout("setattr %p size %lld -> %lld\n", inode, |
1815 | inode->i_size, attr->ia_size); | 1815 | inode->i_size, attr->ia_size); |
1816 | if (attr->ia_size > inode->i_sb->s_maxbytes) { | ||
1817 | err = -EINVAL; | ||
1818 | goto out; | ||
1819 | } | ||
1820 | if ((issued & CEPH_CAP_FILE_EXCL) && | 1816 | if ((issued & CEPH_CAP_FILE_EXCL) && |
1821 | attr->ia_size > inode->i_size) { | 1817 | attr->ia_size > inode->i_size) { |
1822 | inode->i_size = attr->ia_size; | 1818 | inode->i_size = attr->ia_size; |
@@ -1896,8 +1892,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1896 | if (mask & CEPH_SETATTR_SIZE) | 1892 | if (mask & CEPH_SETATTR_SIZE) |
1897 | __ceph_do_pending_vmtruncate(inode); | 1893 | __ceph_do_pending_vmtruncate(inode); |
1898 | return err; | 1894 | return err; |
1899 | out: | ||
1900 | spin_unlock(&ci->i_ceph_lock); | ||
1901 | out_put: | 1895 | out_put: |
1902 | ceph_mdsc_put_request(req); | 1896 | ceph_mdsc_put_request(req); |
1903 | return err; | 1897 | return err; |