From: Goffredo Baroncelli Subject: [PATCH] Btrfs-progs: avoid to scan cdrom and floppy Date: Thu, 11 Nov 2010 20:27:43 +0100 Message-ID: <201011112027.55875.kreijack@libero.it> Reply-To: kreijack@libero.it Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1655542.9P49YC18dL"; protocol="application/pgp-signature"; micalg=pgp-sha1 Cc: "Helmut Hullen" To: linux-btrfs@vger.kernel.org Return-path: List-ID: --nextPart1655542.9P49YC18dL Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all, the commands "btrfs filesystem show" and "btrfs device scan" look at the /d= ev directory (and it subdirectories) for every block devices. This is a slow process because floppy and cdrom are also checked. Moreover, as highlighted by Helmut, if udev is not used, the /dev directory is popula= ted by high number of non-existant devices, which slow the process. My patch changes the behaviour of these commands. The list of the devices a= re extracted from /proc/partitions, and on the basis of the file=20 /etc/btrfs.devices some devices may be skipped. The file /etc/btrfs.devices contains a list of devices which have to be ski= pped (if the line starts with '!') or to be evaluated. Shell wildcard may be use= d. If the file doesn't exists the default is to skip cdroms (/dev/cdrom*) and= =20 floppies (/dev/fd*). To revert to the old behaviour use the switch '--all-devices'. Comment are welcome. Regards G.Baroncelli btrfs.c | 10 +- btrfs.devices | 24 ++++++ btrfs_cmds.c | 39 +++++++++-- man/btrfs.8.in | 22 ++++-- utils.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++- utils.h | 5 + 6 files changed, 279 insertions(+), 17 deletions(-) diff --git a/btrfs.c b/btrfs.c index 46314cf..d850e60 100644 =2D-- a/btrfs.c +++ b/btrfs.c @@ -83,9 +83,10 @@ static struct Command commands[] =3D { "will occupe all available space on the device." }, { do_show_filesystem, 999, =2D "filesystem show", "[|