Re: [RFC] [PATCH 2/3]: ufs: track i_size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 26 Jun 2006 17:48:36 +0400
Evgeniy Dushistov <[email protected]> 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;
	....
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux