linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilan Schwarts <ilan84@gmail.com>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Why btrfsInode -> root is null
Date: Mon, 16 Apr 2018 11:05:15 +0300	[thread overview]
Message-ID: <CAJUuSvFzg1UyLLub1OdyBc-ctaZ-JsUouWiFj3ZVLWfJ4wzykw@mail.gmail.com> (raw)

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

                 reply	other threads:[~2018-04-16  8:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJUuSvFzg1UyLLub1OdyBc-ctaZ-JsUouWiFj3ZVLWfJ4wzykw@mail.gmail.com \
    --to=ilan84@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).