Extra per-inode data

Martin Mares (mj@ucw.cz)
Wed, 28 Jan 1998 14:06:23 +0100


Hi,

I'm now playing with some filesystem capable of >4G files and I need to
store lot of data (approx. 1K) per inode, so I decided to use the inode->u.generic_ip
field to point to my local data instead of putting it directly to the inode structure.
But it seems that there is no way to free such data when the inode gets flushed
out of the inode cache (it can be still reused after super_ops->put_inode gets called).

The only solution I see is to introduce a new super_op called from clear_inode
to free such auxiliary data (see the patch below). Does anybody have a better idea?

Have a nice fortnight

-- 
Martin `MJ' Mares   <mj@ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Windows Error: 002 - No error yet ..."

--- ./fs/inode.c.xx Wed Jan 28 13:56:06 1998 +++ ./fs/inode.c Wed Jan 28 13:58:38 1998 @@ -225,6 +225,8 @@ wait_on_inode(inode); if (IS_QUOTAINIT(inode)) DQUOT_DROP(inode); + if (inode->i_sb && inode->i_sb->s_op && inode->i_sb->s_op->clear_inode) + inode->i_sb->s_op->clear_inode(inode); inode->i_state = 0; } --- ./include/linux/fs.h.xx Wed Jan 28 13:56:14 1998 +++ ./include/linux/fs.h Wed Jan 28 13:56:30 1998 @@ -612,6 +612,7 @@ void (*write_super) (struct super_block *); int (*statfs) (struct super_block *, struct statfs *, int); int (*remount_fs) (struct super_block *, int *, char *); + void (*clear_inode) (struct inode *); }; struct dquot_operations {