Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4483e8a authored by Chao Yu's avatar Chao Yu Committed by Ilya Dryomov
Browse files

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: default avatarChao Yu <chao2.yu@samsung.com>
Reviewed-by: default avatarYan, Zheng <zyan@redhat.com>
parent 3b70b388
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -1076,12 +1076,6 @@ static int ceph_update_writeable_page(struct file *file,
	/* past end of file? */
	i_size = inode->i_size;   /* caller holds i_mutex */

	if (i_size + len > inode->i_sb->s_maxbytes) {
		/* file is too big */
		r = -EINVAL;
		goto fail;
	}

	if (page_off >= i_size ||
	    (pos_in_page == 0 && (pos+len) >= i_size &&
	     end_in_page - pos_in_page != PAGE_CACHE_SIZE)) {
@@ -1099,9 +1093,6 @@ static int ceph_update_writeable_page(struct file *file,
	if (r < 0)
		goto fail_nosnap;
	goto retry_locked;

fail:
	up_read(&mdsc->snap_rwsem);
fail_nosnap:
	unlock_page(page);
	return r;
+0 −6
Original line number Diff line number Diff line
@@ -1813,10 +1813,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
	if (ia_valid & ATTR_SIZE) {
		dout("setattr %p size %lld -> %lld\n", inode,
		     inode->i_size, attr->ia_size);
		if (attr->ia_size > inode->i_sb->s_maxbytes) {
			err = -EINVAL;
			goto out;
		}
		if ((issued & CEPH_CAP_FILE_EXCL) &&
		    attr->ia_size > inode->i_size) {
			inode->i_size = attr->ia_size;
@@ -1896,8 +1892,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
	if (mask & CEPH_SETATTR_SIZE)
		__ceph_do_pending_vmtruncate(inode);
	return err;
out:
	spin_unlock(&ci->i_ceph_lock);
out_put:
	ceph_mdsc_put_request(req);
	return err;