Re: Suggestion on autorelabel

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

 



> Give me a mechanism to know how many files are on the file system and
> I might be able to give you an idea.

Yes, hardlinks are a complication.  However, a useful progress measure
can be computed as the percentage of _known_ total .st_nlink that have
been seen so far.  The numerator starts at zero.  The denominator
starts at (total_inodes - free_inodes).  Update the denominator
upon seeing each inode for the first time.  Update the numerator
upon seeing each hardlink in turn, including the first time for each
inode.  So, if 2==.st_nlink, then the first directory entry for any
particular .st_ino results in
   numerator += 1;
   denominator += .st_nlink - 1;
and the remnaining directory entries for that .st_ino do just
   numerator += 1;

The fraction will wobble (go "backwards") upon first encounter
with each inode that has (1 < .st_nlink), but the wobble will be
small after 10% of duration.  This method requires one additional
stat() per inode [to check .st_nlink], assuming that a directory
entry already gives you the .st_ino.  It also requires a
bit table to track the first encounter of each inode.

-- 
--
selinux mailing list
selinux@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/selinux



[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux