Re: Using the upcoming fsinfo()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 13, 2019 at 01:33:22PM +0800, Ian Kent wrote:
> Some of you may know that David Howells is working on getting
> a new system call fsinfo() merged into the Linux kernel.
> 
> This system call will provide access to information about mounted
> mounts without having to read and parse file based mount tables
> such as /proc/self/mountinfo, etc.
> 
> Essentially all mounts have an id and one can get the id of a
> mount by it's path and then use that to obtain a large range
> of information about it.
> 
> The information can include a list of mounts within the mount
> which can be used to traverse a tree of mounts or the id used
> to lookup information on an individual mount without the need
> to traverse a file based mount table.
> 
> I'd like to update libmount to use the fsinfo() system call
> because I believe using file based methods to get mount
> information introduces significant overhead that can be
> avoided. 
> 
> Because the fsinfo() system call provides a very different way
> to get information
> about mounts, and having looked at the current
> code, I'm wondering what will be
> the best way to go about it.
> 
> Any suggestions about the way this could best be done, given
> that the existing methods must still work, will be very much
> appreciated.

It would be nice to start with some low-level things to read info
about a target (mountpoint) into libmnt_fs, something like:

    int mnt_fsinfo_fill_fs(chat char *tgt, struct libmnt_fs *fs)

and fill create a complete mount table by fsinfo():

    int mnt_fsinfo_fill_table(struct libmnt_table *tab)

... probably add fsinfo.c to code to keep it all together.

So, after then we can use these functions in our code. 

The nice place where is ugly overhead with the current mountinfo is
context_umount.c code, see lookup_umount_fs() and
mnt_context_find_umount_fs(). In this code we have mountpoint and we
need more information about it (due to redirection to umount.<type>
helpers, userspace mount options, etc.). It sounds like ideal to use
mnt_fsinfo_fill_fs() if possible.

The most visible change will be to use mnt_fsinfo_fill_table() with in
mnt_table_parse_file() if the file name is "/proc/self/mountinfo".
This will be huge improvement as we use this function in systemd on
each mount table change...

The question is how easily will be to replace mountinfo with fsinfo().

Note that we have also #util-linux on freenode IRC.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux