Goffredo Baroncelli
2011-Oct-21 17:36 UTC
Avoid error message during a scan of a static /dev directory
Hi all, as highlighted by Helmut (see "Re: btrfs still looks for not existing devices"), some btrfs tools (like mkfs.btrfs, btrfsck, btrfs-image, btrfs- label...) have the habit to scan the /dev directories looking for a valid block device in order to assemble all the devices of a btrfs filesystems. Some systems doesn''t use udev, so they have a static /dev with a lot of block device nodes without a real device. Another source of error is that some devices return ENOMEDIUM (No medium found) when they haven''t a medium (think about a CD with the tray empty, or a SD/CF reader). These two kind of errors are reported by these tools. I think that it is perfectly safe to ignore these error because the fact that a device doesn''t exist or a CD is empty is not an error which should be handled and/or reported when the system is trying to assemble the devices for a filesystem. In any case if a device *needed* for a btrfs filesystem is missing, an error is raised. The patch enclosed allow to ignore the errors: - ENXIO (device don''t exists) - ENOMEDIUM (No medium found) avoiding spurious messages during a scanning of the /dev directory. I have to highlight that if a CDROM/DVD is inserted, the btrfs tools read the cdrom, and this is a very slow operation. Hugo, Chris, please apply. Anyway comments are welcome. BR P.S. you can pull this patch from the following repository: http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git branch skip-not-existent-devices -- gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwind.it> Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512