If i stat a file from userspace:

      File: ‘/home/builder/leon10’
       Size: 0               Blocks: 0          IO Block: 4096   directory
      Device: 31h/49d Inode: 550109      Links: 1


Inode is 550109 and device id is 49.

When I am in the kernel, I try to get that device id (49), I call
vfs_stat("/home/builder/leon10"), this returns me also 49.
If i look at the vfs_stat implementation (located at fs/stat.c):

    vfs_stat(..) -> vfs_fstatat(..) -> vfs_getattr(..) -> this return:
inode->i_op->getattr(path->mnt, path->dentry, stat);

This is a btrfs file system, so i am looking at function getattr on
inode.c (in fs\btrfs\inode.c kernel sources)
static int btrfs_getattr(struct vfsmount *mnt,
struct dentry *dentry, struct kstat *stat)
{
u64 delalloc_bytes;
struct inode *inode = dentry->d_inode;
u32 blocksize = inode->i_sb->s_blocksize;

generic_fillattr(inode, stat);
stat->dev = BTRFS_I(inode)->root->anon_dev;
So look at stat->dev = BTRFS_I(inode)->root->anon_dev; carefully, When
on my kernel module code i take an inode i hold, and try to print
this:

    LOG( V_LOG_NOTICE, "BTRFS_I(inode)->root->anon_dev=%d",
BTRFS_I(inode)->root->anon_dev);
I get 0 or some wierd numbers like 1064756416.

Why is that miss match ? What am I missing ?

Isn't that the right getattr btrfs implementaion ?
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to