linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why btrfsInode -> root is null
@ 2018-04-16  8:05 Ilan Schwarts
  0 siblings, 0 replies; only message in thread
From: Ilan Schwarts @ 2018-04-16  8:05 UTC (permalink / raw)
  To: linux-btrfs

Hi all,

I maintain kernel module on top of VFS.
When action executes, e.g vfs_rename, i get dentry object.
I need to get the fsid from the dentry object.
Since I maintain the same code for alot of suse distro and kernels
(11.4, 12.0, 12.1, 12.2), i have many #if macros,

My question is in SLES 12.2 kernel 4.4.103*, How do i get BTRFS dentry FSID ?
In previous kernels I did:
1. dentry->d_inode->i_op->getattr(NULL, dentry, &kstat)
2. btrfsInode->root->anon_super.s_dev
3. btrfsInode->root->anon_dev

I cast Inode to btrfs inode:
    struct btrfs_inode *btrfsInode;
    btrfsInode = BTRFS_I(dentry->d_inode);


On this version 4.4.103*,, there is the operation:
dentry->d_inode->i_sb->s_op->get_inode_dev(dentry->d_inode);

I have 2 questions,
1. Is this the proper way to obtain it ?
2. In some dentries, after casting inode to btrfsInode, the
btrfsInode->root is null, how could that be ? shouldn't the cast fail
(return null) ?

Thanks

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-16  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-16  8:05 Why btrfsInode -> root is null Ilan Schwarts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).