From: Goffredo Baroncelli Subject: [PATCH 4/5][REPOST][BTRFS-PROGS] Avoid to scan cdrom and floppy Date: Sun, 5 Dec 2010 18:47:15 +0100 Message-ID: <201012051847.15633.kreijack@libero.it> Reply-To: kreijack@libero.it Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3122124.dgmAvbM1m5"; protocol="application/pgp-signature"; micalg=pgp-sha1 Cc: linux-btrfs@vger.kernel.org, "Helmut Hullen" To: chris.mason@oracle.com Return-path: List-ID: --nextPart3122124.dgmAvbM1m5 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=20 (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'. Below the patch, but it is possible to pull the changes from: http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git branch device-checklist 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", "[|