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 <hch@xxxxxx> > <snip> > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html