Unix/Linux Go Back    


Hardware Device drivers, hardware compatibility issues, motherboards, disk drives, graphics cards and other hardware related topics.

What is my readl device id - BTRFS?

Hardware


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-15-2017
hookedatwalla hookedatwalla is offline
Registered User
 
Join Date: May 2012
Last Activity: 16 February 2017, 8:58 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
What is my readl device id - BTRFS?

Hello,
I am monitoring file operations events (VFS).
I have a problem with BTRFS filesystem. BTRFS is using subvolumes. All highest hierarchy directories in btrfs has the same inode (256/512)

Short story:
When I receive file operation event, I receive the path and then resolve it to inode.
By resolving I mean: given a path, I get its dentry (user_path() call), from dentry i pull: dEntry->d_inode->i_ino
The problem is I receive same inode for different directories on the same Device.
I guess, BTRFS has some sort of abstraction layer, that create a "virtual" inode number (the identical ones are virtual) - there is no way for two identical inodes on same device id.
Proof for device id issue:
From kernel I receive device id 29:
-----------------------------------

Code:
Code: device id resolving: for a given path (/home) -> Get the dentry with user_path, then dEntry->d_inode->i_sb->s_dev
OR I run command: "grep btrfs /proc/self/mountinfo | less"
output:
/proc/self/mountinfo return inode 29 also: 34 18 0:29 /home /home rw,noatime,nodiratime shared:19 - btrfs /dev/md127 rw,nospace_cache,subvolid=257,subvol=/home

From user space:
---------------------

Code:
root@nas-B9-43-AA:/# stat /home
  File: `/home'
  Size: 90              Blocks: 0          IO Block: 4096   directory
Device: 21h/33d Inode: 256         Links: 1

root@nas-B9-43-AA:/# mountpoint -d /home
0:33

So I get 29 and 33 as device id.
Lets call device id 29 "actual id"", and 33 is "virtual id".
Is there a way to obtain the actual id from kernel code ? I am looking for replacement to dEntry->d_inode->i_sb->s_dev.. to obtain the same id as we receive from user mode.

Moderator's Comments:
What is my readl device id - BTRFS? Please wrap all code, data, files, input & output/errors in CODE tags.
It make it far easier to read and preservers spaces for indenting or fixed width data.
I have guessed what to add in. Perhaps you could edit this post and confirm what it should be.

Last edited by rbatte1; 02-15-2017 at 09:55 AM.. Reason: Added CODE tags
Sponsored Links
    #2  
Old Unix and Linux 02-15-2017
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 28 April 2017, 12:29 PM EDT
Location: Lancashire, UK
Posts: 3,080
Thanks: 1,287
Thanked 590 Times in 534 Posts
Before we get too far in to this, can you confirm the OS & version you are running? The output from uname -a would be really useful. Please paste it into your message in CODE tags.


Thanks,
Robin
Sponsored Links
    #3  
Old Unix and Linux 02-16-2017
hookedatwalla hookedatwalla is offline
Registered User
 
Join Date: May 2012
Last Activity: 16 February 2017, 8:58 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
This is an appliance that has its own "kernel".

Code:
Linux nas-B9-43-AA 4.1.21.x86_64.1

but under the hood it's:

Code:
root@nas-B9-43-AA:/# cat /etc/*release
PRETTY_NAME="ReadyNASOS 6.5.1"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"

---------- Post updated 02-16-17 at 07:58 AM ---------- Previous update was 02-15-17 at 09:58 AM ----------

Hi,
Instead of going to the dentry - inode - superblock - device id.
I get the device Id using the getattr(..) on the dentry.

My solution is taken from the Suse patch in the subject (after alot of google digging).

btrfs: stat(2) and /proc/pid/maps returns different devices - Patchwork

Last edited by rbatte1; 02-15-2017 at 10:06 AM.. Reason: Added CODE tags and corrected spelling
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Failed to open tape device /dev/rmt/0mn:Device busy (errno = 16) anuragr HP-UX 4 04-25-2016 10:27 AM
Unable To Activate Ethernet Network Device in RHEL 5.5 - e100 device eth0 does not seem to be presen Tanmoy Red Hat 0 02-06-2013 04:06 PM
Tutorial for btrfs EssenceNY Linux 0 11-07-2010 10:07 PM



All times are GMT -4. The time now is 03:16 AM.