From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boaz Harrosh Subject: Re: [PATCH 4/4] remove inode_setattr Date: Mon, 31 May 2010 13:36:38 +0300 Message-ID: <4C039136.9020709@panasas.com> References: <20100531093954.GA9946@lst.de> <20100531094030.GD10001@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: viro@zeniv.linux.org.uk, npiggin@suse.de, jack@suse.cz, linux-fsdevel@vger.kernel.org To: Christoph Hellwig Return-path: Received: from daytona.panasas.com ([67.152.220.89]:47596 "EHLO daytona.int.panasas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753450Ab0EaKgl (ORCPT ); Mon, 31 May 2010 06:36:41 -0400 In-Reply-To: <20100531094030.GD10001@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 05/31/2010 12:40 PM, Christoph Hellwig wrote: > 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 > > Index: linux-2.6/fs/exofs/inode.c > =================================================================== > --- linux-2.6.orig/fs/exofs/inode.c 2010-05-31 10:15:55.792254729 +0200 > +++ linux-2.6/fs/exofs/inode.c 2010-05-31 10:22:36.959254590 +0200 > @@ -887,8 +887,18 @@ int exofs_setattr(struct dentry *dentry, > if (error) > return error; > > - error = inode_setattr(inode, iattr); > - return error; > + if ((iattr->ia_valid & ATTR_SIZE) && > + iattr->ia_size != i_size_read(inode)) { > + int error; > + > + error = vmtruncate(inode, iattr->ia_size); > + if (error) > + return error; > + } > + > + setattr_copy(inode, iattr); > + mark_inode_dirty(inode); > + return 0; > } > > static const struct osd_attr g_attr_inode_file_layout = ATTR_DEF( Hold on to this for just a sec. I'm already testing a proper conversion replaying the conversion done to ext2. I'll send it your way so it can get together with this patchset. (give me couple hours) Boaz