Jürgen Keil
2006-Dec-18 13:35 UTC
[zfs-discuss] zfs/fstyp slows down recognizing pcfs formatted floppies
I''ve noticed that fstyp on a floppy media formatted with "pcfs" now needs somewhere between 30 - 100 seconds to find out that the floppy media is formatted with "pcfs". E.g. on sparc snv_48, I currently observe this: % time fstyp /vol/dev/rdiskette0/nomedia pcfs 0.01u 0.10s 1:38.84 0.1% zfs''s /usr/lib/fs/zfs/fstyp.so.1 seems to add about 40 seconds to that time, because it reads 1 mbyte from the floppy media (~ 2/3 of a 1.44MB floppy), only to find out that the floppy media does not contain a zfs pool: SPARC snv_48, before tamarack: % time /usr/lib/fs/zfs/fstyp /vol/dev/rdiskette0/nomedia unknown_fstyp (no matches) 0.01u 0.04s 0:36.27 0.1% x86, snv_53, with tamarack: % time /usr/lib/fs/zfs/fstyp /dev/rdiskette unknown_fstyp (no matches) 0.00u 0.01s 0:35.25 0.0% (the rest of the time is wasted probing for an udfs filesystem) Isn''t the minimum device size required for a zfs pool 64 mbytes? (SPA_MINDEVSIZE, from the sys/fs/zfs.h header) Shouldn''t zfs/fstyp skip probing for zfs / zpools on small capacity devices like a floppy media, that are less than this 64 mbytes ? diff -r 367766133bfe usr/src/cmd/fs.d/zfs/fstyp/fstyp.c --- a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c Fri Dec 15 09:03:53 2006 -0800 +++ b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c Sun Dec 17 11:27:08 2006 +0100 @@ -32,6 +32,8 @@ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> +#include <sys/stat.h> +#include <sys/fs/zfs.h> #include <unistd.h> #include <libintl.h> #include <locale.h> @@ -88,6 +90,15 @@ fstyp_mod_ident(fstyp_mod_handle_t handl char *str; uint64_t u64; char buf[64]; + struct stat stb; + + /* + * don''t probe for zfs on small media (e.g. floppy) that is + * too small for a zpool. + */ + if (fstat(h->fd, &stb) == 0 && stb.st_size < SPA_MINDEVSIZE) { + return (FSTYP_ERR_NO_MATCH); + } if (zpool_read_label(h->fd, &h->config) != 0 || h->config == NULL) { This message posted from opensolaris.org
Peter Buckingham
2006-Dec-19 01:19 UTC
[zfs-discuss] zfs/fstyp slows down recognizing pcfs formatted floppies
J?rgen Keil wrote:> Shouldn''t zfs/fstyp skip probing for zfs / zpools on small capacity > devices like a floppy media, that are less than this 64 mbytes ?To add to this. I''ve also seen that uninitialised disk slices are listed as a corrupted pool when I try to do a zfs import. In my case the slices are < 16 MB in size. I don''t know if that is significant... peter