Re: Assumption on fixed device numbers in Plasma's desktop search Baloo

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

 



On 6/25/21 5:54 PM, NeilBrown wrote:
> On Sat, 26 Jun 2021, Martin Steigerwald wrote:
>>                                  And that Baloo needs an "invariant" for 
>> a file. See comment #11 of that bug report:
> 
> That is really hard to provide in general.  Possibly the best approach
> is to use the statfs() systemcall to get the "f_fsid" field.  This is
> 64bits.  It is not supported uniformly well by all filesystems, but I
> think it is at least not worse than using the device number.  For a lot
> of older filesystems it is just an encoding of the device number.
> 
> For btrfs, xfs, ext4 it is much much better.

How about combining the UUID of the partition with the file path? An
example from one of the VMs on my workstation:

$ df .
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       25670972 12730276  11613648  53% /
$ lsblk -O | grep vda1
└─vda1 vda1  /dev/vda1 252:1     11.1G  24.5G ext4    12.1G    50% 1.0
 /                84cebea8-7e6f-4c2a-8a1b-8bc0c9744751 ae2151de
                    dos    0x83     Linux                  ae2151de-01
                        0x80      128  0  0       0
                 25G         root  disk  brw-rw----         0    512
  0     512     512    1 mq-deadline     256 part        0      512B
   2G         0    0B        0 vda                      block:virtio:pci
                   none    0

In other words, UUID 84cebea8-7e6f-4c2a-8a1b-8bc0c9744751 has been
associated with the block device under the filesystem that owns the
directory from which the 'df' command has been run.

Bart.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux