xfs
[Top] [All Lists]

Re: can't use iget on XFS

To: Tomaz Beltram <tomazb@xxxxxxxxxxx>
Subject: Re: can't use iget on XFS
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 30 Jan 2004 12:51:55 +0000
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <BAY10-F119vMgJSjtPe0000435b@xxxxxxxxxxx>; from tomazb@xxxxxxxxxxx on Wed, Jan 28, 2004 at 04:14:47PM +0000
References: <BAY10-F119vMgJSjtPe0000435b@xxxxxxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
On Wed, Jan 28, 2004 at 04:14:47PM +0000, Tomaz Beltram wrote:
> In some cases the filter module has to call iget instead of lookup, since it 
> doesn't have the full pathname of the file but just its inode number (ino). 
> On XFS this only works when the inode is found in the cache. If it has to be 
> loaded from disk it oops-es. This is because iget calls read_inode which is 
> not implemented in XFS and just jumps to nowhere.

Simple answer:  Don't do that.  iget something only the filesystem may
call.

> We are considering to call xfs_iget instead of iget, but are not aware of 
> all functional implications this might have. Could someone explain if this 
> is the correct sequence to be called and why not:
> 
> 
> struct super_block *sb;
> struct inode *inode;
> 
> vfs_t       *vfsp = LINVFS_GET_VFS(sb);
> xfs_mount_t *mp = XFS_BHVTOM(vfsp->vfs_fbhv);
> 
> xfs_inode_t *ip = NULL;
> 
> int error = xfs_iget(mp, NULL, ino, XFS_ILOCK_SHARED, &ip, 0);
> 
> vnode_t     *vpp = XFS_ITOV(ip);
> inode = LINVFS_GET_IP(vpp);
> 
> /* access inode, e.g. read extended attributes */
> 
> xfs_iunlock(ip, XFS_ILOCK_SHARED);

This is bollocks.  You are absolutely not supposed to mess with filesystem
interanls.  Use the exposed interface instead (s_ops->fh_to_dentry in 2.4,
the export_operations in 2.6)


<Prev in Thread] Current Thread [Next in Thread>