Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jul 2010 12:00:18 GMT
From:      Jimmy Olgeni <olgeni@FreeBSD.org>
To:        freebsd-fs@FreeBSD.org
Subject:   Re: bin/148296: [zfs] [loader] [patch] Very slow probe in /usr/src/sys/boot/zfs/zfs.c
Message-ID:  <201007261200.o6QC0I1h036140@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/148296; it has been noted by GNATS.

From: Jimmy Olgeni <olgeni@FreeBSD.org>
To: "Andrey V. Elsukov" <bu7cher@yandex.ru>
Cc: bug-followup@FreeBSD.org, Andriy Gapon <avg@icyb.net.ua>,
        Norikatsu Shigemura <nork@FreeBSD.org>
Subject: Re: bin/148296: [zfs] [loader] [patch] Very slow probe in
 /usr/src/sys/boot/zfs/zfs.c
Date: Mon, 26 Jul 2010 13:56:03 +0200 (CEST)

 Hello,
 
 On Wed, 14 Jul 2010, Andrey V. Elsukov wrote:
 
 > just one note - user can create partition that doesn't start from 1.
 > For example:
 > 	# mdconfig -s 100m
 > 	# gpart create -s gpt md0
 > 	# gpart add -i 5 -t freebsd-zfs md0
 
 This is slower, but safer: it doesn't fall back to slices, and only 
 skips checks when a vdev is found at the unit level.
 
 --- zfs.c.orig	2010-06-14 04:09:06.000000000 +0200
 +++ zfs.c	2010-07-26 13:37:23.490536162 +0200
 @@ -408,20 +408,27 @@
 
   		/*
   		 * If we find a vdev, the zfs code will eat the fd, otherwise
 -		 * we close it.
 +		 * we close it and check for vdevs in slices and partitions.
   		 */
   		if (vdev_probe(vdev_read, (void*) (uintptr_t) fd, 0))
   			close(fd);
 +		else
 +			continue;
 +
 +		for (slice = 1; slice <= 4; slice++) {
 +			sprintf(devname, "disk%ds%d:", unit, slice);
 +			fd = open(devname, O_RDONLY);
 +			if (fd == -1)
 +				continue;
 +			if (vdev_probe(vdev_read, (void*) (uintptr_t) fd, 0))
 +				close(fd);
 +		}
 
   		for (slice = 1; slice <= 128; slice++) {
   			sprintf(devname, "disk%dp%d:", unit, slice);
   			fd = open(devname, O_RDONLY);
 -			if (fd == -1) {
 -				sprintf(devname, "disk%ds%d:", unit, slice);
 -				fd = open(devname, O_RDONLY);
 -				if (fd == -1)
 -					continue;
 -			}
 +			if (fd == -1)
 +				continue;
   			if (vdev_probe(vdev_read, (void*) (uintptr_t) fd, 0))
   				close(fd);
   		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007261200.o6QC0I1h036140>