From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [RFC] [PATCH 2/3]: ufs: track i_size Date: Mon, 26 Jun 2006 11:54:49 -0700 Message-ID: <20060626115449.d0c674a4.akpm@osdl.org> References: <20060626134836.GA8400@rain.homenetwork> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Return-path: Received: from smtp.osdl.org ([65.172.181.4]:33765 "EHLO smtp.osdl.org") by vger.kernel.org with ESMTP id S932644AbWFZSyz (ORCPT ); Mon, 26 Jun 2006 14:54:55 -0400 To: Evgeniy Dushistov In-Reply-To: <20060626134836.GA8400@rain.homenetwork> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Mon, 26 Jun 2006 17:48:36 +0400 Evgeniy Dushistov wrote: > To make possible proper work of `ufs_truncate'(see the next patch), > I need to know old size of file in` ufs_truncate', > but for some unknown for me reason VFS layer doesn't tell > old size to file system, or at least I don't find way to get > this information. > So I have to add per each inode `loff_t' field and update it > in > - alloc inode > - read inode > - commit write > - truncate(see the next patch) > is this right way to know "old size" in truncate method? You can get this info by implementing inode_operations.setattr(). See the callsite in fs/attr.c:notify_change(). You'd do something like: ufs_setattr() { loff_t old_i_size = inode->i_size; /* Stuff copied from notify_change(): */ inode_change_ok() security_inode_setattr() inode_setattr() new_i_size = inode->i_size; .... }