Re: [zfs-discuss] zfs/fstyp slows down recognizing pcfs formatted floppies

2006-12-18 Thread Peter Buckingham

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
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


[zfs-discuss] zfs/fstyp slows down recognizing pcfs formatted floppies

2006-12-18 Thread Jürgen Keil
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.cFri Dec 15 09:03:53 2006 -0800
+++ b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.cSun Dec 17 11:27:08 2006 +0100
@@ -32,6 +32,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -88,6 +90,15 @@ fstyp_mod_ident(fstyp_mod_handle_t handl
char*str;
uint64_t u64;
charbuf[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
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss