From owner-freebsd-arch@FreeBSD.ORG Tue May 6 06:12:24 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 009B9106567A for ; Tue, 6 May 2008 06:12:24 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206046210.chello.pl [87.206.46.210]) by mx1.freebsd.org (Postfix) with ESMTP id 77B708FC20 for ; Tue, 6 May 2008 06:12:23 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 21A5545E13; Tue, 6 May 2008 08:12:22 +0200 (CEST) Received: from localhost (chello087206046210.chello.pl [87.206.46.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id D45CF45683; Tue, 6 May 2008 08:12:16 +0200 (CEST) Date: Tue, 6 May 2008 08:12:15 +0200 From: Pawel Jakub Dawidek To: Kostik Belousov Message-ID: <20080506061215.GB2508@garage.freebsd.pl> References: <20080504171002.GN18958@deviant.kiev.zoral.com.ua> <20080505081355.GB1628@garage.freebsd.pl> <20080505145631.GT18958@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="V88s5gaDVPzZ0KCq" Content-Disposition: inline In-Reply-To: <20080505145631.GT18958@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 Cc: arch@freebsd.org Subject: Re: Per-open file private data for the cdevs X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2008 06:12:24 -0000 --V88s5gaDVPzZ0KCq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 05, 2008 at 05:56:31PM +0300, Kostik Belousov wrote: > On Mon, May 05, 2008 at 10:13:55AM +0200, Pawel Jakub Dawidek wrote: > > Can you see if my OSD (Object-Specific-Data) KPI can be useful here? > > I've it only in perforce for now, but I think it's what you are looking > > for. I use it for jails and threads currently, but it is trivial to use > > it for other objects. Take a look: > >=20 > > http://perforce.freebsd.org/fileViewer.cgi?FSPC=3D//depot/user/pjd/zfs= /sys/sys/osd.h&REV=3D3 > >=20 > > When your code is loaded/initialized you call: > >=20 > > static int slot; > >=20 > > slot =3D osd_file_register(mod_destroy); > >=20 > > Where mod_destroy is a function which knows how to free your private > > data. On unload: > >=20 > > osd_file_deregister(slot); > >=20 > > Now, when you want to attach private data: > >=20 > > error =3D osd_file_set(fp, slot, ptr_to_your_data); > >=20 > > You can get it with: > >=20 > > ptr =3D osd_file_get(fp, slot); > This is a nice feature, but I think that privdata is a fundamental > internal operation of the kernel, and it would be wrong to use > the OSD. [...] OSD is there to be used mostly by optional modules. For example if ZFS is not loaded there is no need to keep a pointer to its private data in struct prison and struct thread. > [...] In fact, the object we shall attach OSD to is the struct > file, and we would need to export the struct file to the cdevsw operation= s. > Since it both breaks current ABI and complicates the future changes to > the struct file, I would much prefer to not engage this route. Ok. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --V88s5gaDVPzZ0KCq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFIH/a/ForvXbEpPzQRAmQ5AJ4/4aNF7nbZSXibdtD76uUZVNR71wCfUAo5 dZ5C7dh9TDj5ey1w3cjad4M= =BKfz -----END PGP SIGNATURE----- --V88s5gaDVPzZ0KCq--