From owner-freebsd-current@FreeBSD.ORG Wed Jan 18 08:22:59 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 533CA16A41F for ; Wed, 18 Jan 2006 08:22:59 +0000 (GMT) (envelope-from dunstan@freebsd.czest.pl) Received: from freebsd.czest.pl (freebsd.czest.pl [80.48.250.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id A0CF643D45 for ; Wed, 18 Jan 2006 08:22:58 +0000 (GMT) (envelope-from dunstan@freebsd.czest.pl) Received: from freebsd.czest.pl (freebsd.czest.pl [80.48.250.4]) by freebsd.czest.pl (8.13.4/8.12.9) with ESMTP id k0I8S4Cu004957; Wed, 18 Jan 2006 08:28:04 GMT (envelope-from dunstan@freebsd.czest.pl) Received: (from dunstan@localhost) by freebsd.czest.pl (8.13.4/8.12.9/Submit) id k0I8S41u004956; Wed, 18 Jan 2006 08:28:04 GMT (envelope-from dunstan) Date: Wed, 18 Jan 2006 08:28:04 +0000 From: "Wojciech A. Koszek" To: Maxim.Sobolev@portaone.com Message-ID: <20060118082804.GC4846@FreeBSD.czest.pl> References: <20060114223019.GA99634@FreeBSD.czest.pl> <43CC168D.9080708@portaone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: <43CC168D.9080708@portaone.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-current@freebsd.org Subject: Re: [PATCH] Support for large number of md(4) disks X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jan 2006 08:22:59 -0000 On Mon, Jan 16, 2006 at 01:56:29PM -0800, Maxim Sobolev wrote: > Hi, Hi Maxim, > IMHO there is better approach to fetch unknown amount of data from the > kernel using ioctl(2) facility. The main idea is that you allocate some > buffer of size sufficient in 95% of cases (for md(4) I think 8-16 > entries are enough), attach it to some structure which has size of the > buffer as one of its members and send pointer to that structure as an > argument to ioctl(2). > > Upon receiving this structure the kernel compares size of the buffer > with amount of information that it needs to send back. If buffer size is > sufficient to hold this information it copies it out and returns number > of entries in the buffer as one of members of this structure. I don't like using array member for holding additional data. We have something similar right now with md_pad[0]. I wanted to prevent us from doing it once again. To do it right, we'd have to add yet another structure describing size of list with pointer to list of disks and the other one for describing separate disks.. but [1] > If the buffer size is insufficient, the kernel fills in desired size of > the buffer in structure members and returns some error code indicating > that the provided buffer is insufficient. Upon receiving this error > userland increases the buffer size to the size suggested by the kernel > (perhaps adding some extra space) and repeats the ioctl(2) calls. > I belive both methods are acceptable since we always end up with sysctl(3)-like problem. Solution you've described will give us one ioctl() call in possitive case, but are there any others advantages? [1] cases in which total device number will change are as probable as using more than 100 md(4) disks ;-) This is why I decided to use simple request for a size and to do a request for md(4) list. -- * Wojciech A. Koszek && dunstan@FreeBSD.czest.pl