On 10/21/08 04:52, Paul B. Henson wrote:
On Mon, 20 Oct 2008, Pramod Batni wrote:
Yes, the implementation of the above ioctl walks the list of mounted
filesystems 'vfslist' [in this case it walks 5000 nodes of a linked list
before the ioctl returns] This in-kernel traversal of the filesystems is
taking time.
Hmm, O(n) :(... I guess that is the implementation of getmntent(3C)?
In fact the problem is that 'zfs create' calls the ioctl way too many
times.
getmntent(3C) issues a single ioctl( MNTIOC_GETMNTENT).
Why does creating a new ZFS filesystem require enumerating all existing
ones?
This is to determine if any of the filesystems in the dataset are mounted.
The ioctl calls are coming from:
libc.so.1`ioctl+0x8
libc.so.1`getmntany+0x200
libzfs.so.1`is_mounted+0x60
libshare.so.1`sa_get_zfs_shares+0x118
libshare.so.1`sa_init+0x330
libzfs.so.1`zfs_init_libshare+0xac
libzfs.so.1`zfs_share_proto+0x4c
zfs`zfs_do_create+0x608
zfs`main+0x2b0
zfs`_start+0x108
zfs_init_libshare is walking through a list of filesystems and
determining if each of them
are mounted. I think there can be a better way to do this rather than
doing a is_mounted()
check on each of the filesystems. In any case a bug can be filed on this.
Pramod
You could set 'zfs set mountpoint=none <pool-name>' and then create the
filesystems under the <pool-name> . [In my experiments the number of
ioctl's went down drastically.] You could then set a mountpoint for the
pool and then issue a 'zpool mount -a' .
That would work for an initial mass creation, but we are going to need to
create and delete fairly large numbers of file systems over time, this
workaround would not help for that.
_______________________________________________
zfs-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss