From: Jan Kara Subject: Re: [patch 5/5] fat: convert to use the new truncate convention Date: Wed, 9 Dec 2009 16:08:48 +0100 Message-ID: <20091209150847.GE7044@quack.suse.cz> References: <20091208083832.GA19823@wotan.suse.de> <20091208084302.GE19823@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Al Viro , Christoph Hellwig , Jan Kara , linux-fsdevel@vger.kernel.org, OGAWA Hirofumi To: Nick Piggin Return-path: Received: from cantor2.suse.de ([195.135.220.15]:34489 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756176AbZLIQKz (ORCPT ); Wed, 9 Dec 2009 11:10:55 -0500 Content-Disposition: inline In-Reply-To: <20091208084302.GE19823@wotan.suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue 08-12-09 09:43:02, Nick Piggin wrote: > Cc: OGAWA Hirofumi > Cc: Christoph Hellwig > Signed-off-by: Nick Piggin Looks good except that the code in fat_setattr could be simplified I think. Acked-by: Jan Kara > @@ -365,7 +377,8 @@ int fat_setattr(struct dentry *dentry, s > /* > * Expand the file. Since inode_setattr() updates ->i_size > * before calling the ->truncate(), but FAT needs to fill the > - * hole before it. > + * hole before it. XXX: this is no longer true with new truncate > + * sequence. > */ > if (attr->ia_valid & ATTR_SIZE) { > if (attr->ia_size > inode->i_size) { I think the content of this condition can be moved inside the ATTR_SIZE check you've added below and the comment can be removed... > @@ -414,15 +427,20 @@ int fat_setattr(struct dentry *dentry, s > attr->ia_valid &= ~ATTR_MODE; > } > > - if (attr->ia_valid) > - error = inode_setattr(inode, attr); > + if (attr->ia_valid & ATTR_SIZE) { > + error = fat_setsize(inode, attr->ia_size); > + if (error) > + goto out; > + } > + > + generic_setattr(inode, attr); > + mark_inode_dirty(inode); Honza -- Jan Kara SUSE Labs, CR