Mapping of Filename to allocated blocks

Manoj Rao linux at manojrajarao.com
Thu Jul 21 21:05:49 EDT 2016


Thank you Valids. That worked!

For others who may look for this info:
If you have access to the struct file *
then you could obtain this info with the following
condition check:

============================================
struct file *filp = <blah blah>;
if (filp->f_path.mnt->mnt_flags & MNT_NODEV)
        pr_info("ramfs node\n");
else
        pr_info("persist storage backed node\n");
============================================


On Wed, Jul 20, 2016 at 7:49 PM, <Valdis.Kletnieks at vt.edu> wrote:

> On Wed, 20 Jul 2016 18:46:47 -0700, Manoj Rao said:
>
> > However, I need to run this for each and every read system call which
> > includes all the procfs, sysfs and other RAM fs based file reads. My
> > code is causing the kernel to panic at some point due to an illegal
> > memory access while trying to obtain the starting sector/block for the
> > file that's currently being read. My hunch is the crash occurs when
> > file being read is on a non-persistent fs such as a sysfs node
> > I have gotten hold of the inode structure and I'm trying to find if
> > a given inode is stored persistently or not and I've been unable to
> > find this information so far.
>
> Hint:  First, check if the filesystem is a pseudo filesystem before
> bothering
> to look for baking store.  If you need to know how to do that, steal the
> code from the code that prints /proc/filesystems - if it says 'nodev',
> you'll
> only find pain looking for backing storage.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160721/16d38530/attachment.html 


More information about the Kernelnewbies mailing list