On 12/11/2014 09:37 PM, Dimitri John Ledkov wrote:
> On 10 December 2014 at 19:00, Goffredo Baroncelli <kreij...@gmail.com> wrote:
[...]
>> But also udev contains a btrfs rules
>>
>> - 64-btrfs.rules
>>
>> All rules do the same thing: invoke "btrfs device scan". Ok the
>> udev rules uses an internal builtin, but the results is the same
>> of the first two rules.
>>
> 
> 64-btrfs.rules does not call scan, it marks btrfs devices as ready
> only. These are not equivalent.

It does a "BTRFS_IOC_DEVICES_READY" ioctl (see udev-builtin-btrfs.c), 
which, despite its name, *registers* the passed device *and checks* if 
the number of registered device is sufficient. From fs/btrfs/super.c

[...]
/*
 * used by btrfsctl to scan devices when no FS is mounted
 */
static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
                                unsigned long arg)
{
[...]
        switch (cmd) {
        case BTRFS_IOC_SCAN_DEV:
                ret = btrfs_scan_one_device(vol->name, FMODE_READ,
                                            &btrfs_fs_type, &fs_devices);
                break;
        case BTRFS_IOC_DEVICES_READY:
                ret = btrfs_scan_one_device(vol->name, FMODE_READ,
                                            &btrfs_fs_type, &fs_devices);
                if (ret)
                        break;
                ret = !(fs_devices->num_devices == fs_devices->total_devices);
                break;
        }


As you can see BTRFS_IOC_DEVICES_READY acts ALSO as BTRFS_IOC_SCAN_DEV.
(Yes, the name is very confusing, so only looking at the code this thing 
is clear)


> 
>> I am asking to remove the btrfs-tools rules (80-... and 70-...)
>> because the udev rule is sufficient and always present.
>>
> 
> All three do different things, under different conditions and are not
> equivalent.

The 64-btrfs.rules is able to superseed the two btrfs-tools package rules 
(80-...
and 70-...). So it is not true that these rules do different thing.


The 80-btrfs-lvm.rules and 70-btrfs.rules appeared before the 64-btrfs.rules 
(March 2012 vs September 2012). This explain the redundancy.

BTW, ironically I was one of the first to suggest to put "btrfs device scan" in 
a btrfs rule (http://permalink.gmane.org/gmane.comp.file-systems.btrfs/5374)

> 
>> As confirmation I checked fedora, and there is only one
>> btrfs rule, the udev one.
>>
> 
> Fedora does not use initramfs-tools, but dracut which incidentally
> ships a udev rule to call btrfs device scan. 

I checked a fedora initramfs and I was unable to find this rule (except
the 64-btrfs.rules)

I am referring the Fedora case to support my request to leave
only 64-btrfs.rules: it is sufficient to cover all the cases. Otherwise
we could drop the 64-btrfs.rules and leave the 70-... and 80-... But
because these are less generic and Debian specific I don't see a valid reason
for that.
64-btrfs.rules is also more efficient because it calls a built-in command and
not an external one.

> Thus even fedora has an
> extra udev rule to call btrfs scan.

No, it has only the 64-btrfs.rules. I re-checked now a fedora-20 initramfs (
initramfs-3.17.4-200.fc20.x86_64.img) and:

- I was able to find the btrfs tools
- I found /lib/udev/rules/64-btrfs.rules (which is the same shipped by
the debian udev package)
- I didn't find any "btrfs dev scan" invocation.

 
> Do you have a bug with current package? If yes, please describe it,
> otherwise I will be closing this bug report as won't fix.

the problem tha I found was that we have three udev rules, when only one 
is sufficient; I am suggesting to adopt the rule shipped with udev.
If you think that this is not a bug, please consider it as wishlist

BTW, I noticed that the debian rules do the insmod the btrfs module. But this 
should be not necessary anymore. Udev is in charge to create the 
/dev/btrfs-control
device. Any access to this device name starts the insmod of the btrfs module.
(see https://lkml.org/lkml/2010/5/21/134)

> 
> Regards,
> 
> Dimitri.
> 
BR
Goffredo

> 
>> BR
>> G.Baroncelli
>>
>>
>> -- System Information:
>> Debian Release: 8.0
>>   APT prefers unstable
>>   APT policy: (500, 'unstable')
>> Architecture: amd64 (x86_64)
>>
>> Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
>> Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
>> Shell: /bin/sh linked to /bin/dash
>> Init: systemd (via /run/systemd/system)
>>
>> Versions of packages btrfs-tools depends on:
>> ii  e2fslibs    1.42.12-1
>> ii  libblkid1   2.25.2-3
>> ii  libc6       2.19-13
>> ii  libcomerr2  1.42.12-1
>> ii  liblzo2-2   2.08-1
>> ii  libuuid1    2.25.2-3
>> ii  zlib1g      1:1.2.8.dfsg-2+b1
>>
>> btrfs-tools recommends no packages.
>>
>> btrfs-tools suggests no packages.
>>
>> -- no debconf information
> 


-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to