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

Commit 15c6fd97 authored by npiggin@suse.de's avatar npiggin@suse.de Committed by Al Viro
Browse files

kill spurious reference to vmtruncate



Lots of filesystems calls vmtruncate despite not implementing the old
->truncate method.  Switch them to use simple_setsize and add some
comments about the truncate code where it seems fitting.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 7bb46a67
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -322,8 +322,9 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr)
	if (error)
		goto out;

	/* XXX: this is missing some actual on-disk truncation.. */
	if (ia_valid & ATTR_SIZE)
		error = vmtruncate(inode, attr->ia_size);
		error = simple_setsize(inode, attr->ia_size);

	if (error)
		goto out;
+2 −2
Original line number Diff line number Diff line
@@ -805,7 +805,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia,
				    - (ia->ia_size & ~PAGE_CACHE_MASK));

		if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
			rc = vmtruncate(inode, ia->ia_size);
			rc = simple_setsize(inode, ia->ia_size);
			if (rc)
				goto out;
			lower_ia->ia_size = ia->ia_size;
@@ -830,7 +830,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia,
				goto out;
			}
		}
		vmtruncate(inode, ia->ia_size);
		simple_setsize(inode, ia->ia_size);
		rc = ecryptfs_write_inode_size_to_metadata(inode);
		if (rc) {
			printk(KERN_ERR	"Problem with "
+7 −1
Original line number Diff line number Diff line
@@ -700,8 +700,14 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
		return 0;

	page_cache_release(page);

	/*
	 * XXX(hch): the call below should probably be replaced with
	 * a call to the gfs2-specific truncate blocks helper to actually
	 * release disk blocks..
	 */
	if (pos + len > ip->i_inode.i_size)
		vmtruncate(&ip->i_inode, ip->i_inode.i_size);
		simple_setsize(&ip->i_inode, ip->i_inode.i_size);
out_endtrans:
	gfs2_trans_end(sdp);
out_trans_fail:
+4 −1
Original line number Diff line number Diff line
@@ -1071,6 +1071,9 @@ int gfs2_permission(struct inode *inode, int mask)
	return error;
}

/*
 * XXX: should be changed to have proper ordering by opencoding simple_setsize
 */
static int setattr_size(struct inode *inode, struct iattr *attr)
{
	struct gfs2_inode *ip = GFS2_I(inode);
@@ -1081,7 +1084,7 @@ static int setattr_size(struct inode *inode, struct iattr *attr)
		error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks);
		if (error)
			return error;
		error = vmtruncate(inode, attr->ia_size);
		error = simple_setsize(inode, attr->ia_size);
		gfs2_trans_end(sdp);
		if (error) 
			return error;
+2 −2
Original line number Diff line number Diff line
@@ -169,13 +169,13 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
	mutex_unlock(&f->sem);
	jffs2_complete_reservation(c);

	/* We have to do the vmtruncate() without f->sem held, since
	/* We have to do the simple_setsize() without f->sem held, since
	   some pages may be locked and waiting for it in readpage().
	   We are protected from a simultaneous write() extending i_size
	   back past iattr->ia_size, because do_truncate() holds the
	   generic inode semaphore. */
	if (ivalid & ATTR_SIZE && inode->i_size > iattr->ia_size) {
		vmtruncate(inode, iattr->ia_size);	
		simple_setsize(inode, iattr->ia_size);
		inode->i_blocks = (inode->i_size + 511) >> 9;
	}	

Loading