From owner-freebsd-current Wed Dec 6 16:35:13 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id QAA12108 for current-outgoing; Wed, 6 Dec 1995 16:35:13 -0800 (PST) Received: from who.cdrom.com (who.cdrom.com [192.216.222.3]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id QAA12096 for ; Wed, 6 Dec 1995 16:35:07 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by who.cdrom.com (8.6.12/8.6.11) with ESMTP id QAA04831 for ; Wed, 6 Dec 1995 16:34:58 -0800 Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id RAA02483 for current@freebsd.org; Wed, 6 Dec 1995 17:32:36 -0700 From: Terry Lambert Message-Id: <199512070032.RAA02483@phaeton.artisoft.com> Subject: Reconsidering leases To: current@freebsd.org Date: Wed, 6 Dec 1995 17:32:36 -0700 (MST) X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@freebsd.org Precedence: bulk Really, this is a posting about "low-hanging-fruit" optimization. Leases are a facility for supporting client cache coherency in NFS clients. In vnode.h, the following is defined: extern void (*lease_check) __P((struct vnode *vp, struct proc *p, struct ucred *ucred, int flag)); extern void (*lease_updatetime) __P((int deltat)); #ifdef NFS #ifdef NQNFS #define LEASE_CHECK(vp, p, cred, flag) lease_check((vp), (p), (cred), (flag)) #define LEASE_UPDATETIME(dt) lease_updatetime(dt) #else #define LEASE_CHECK(vp, p, cred, flag) #define LEASE_UPDATETIME(dt) #endif /* NQNFS */ #else #define LEASE_CHECK(vp, p, cred, flag) \ do { if(lease_check) lease_check((vp), (p), (cred), (flag)); } while(0) #define LEASE_UPDATETIME(dt) \ do { if(lease_updatetime) lease_updatetime(dt); } while(0) #endif /* NFS */ #endif /* KERNEL */ Basically in the non-NFS case, extra code is generated to support the loading of NFS as an LKM to support lease checking. Not only that, the VOP_LOCK'ing is delayed because LEASE_CHECK wants to be called with the vp unlocked. In point of fact, there is now now way to disable lease checking without: # Note: 4.4BSD NQNFS lease checking has relatively high cost for # _local_ I/O as well as remote I/O. Don't use it unless you will # using NQNFS. options NFS #Network File System #options NQNFS #Enable NQNFS lease checking since if NQFS is defined or NFS *isn't* defined, the compare for the lease-cheking goes in. So really, what's being supported is loading of NFS with NQNFS enabled. I'd like to see a seperate definition of options FS_LEASES #Enable lease checking Since I don't believe the client caching abstraction is limited to NQNFS use of the interface. What that means is that NQNFS leasing would be dependent on whether FS_LEASES was defined in the kernel where the module is loaded. Maybe something like #ifdef FS_LEASES int fs_has_lease_checking = 0; #else int fs_has_lease_checking = 1; #endif Then in the VOP_LOCK delays to allow the LEASE_CHECK on an unlocked vp can be conditionalized on compilation. Small optimization, I know, but every 3-5% helps. 8-). There's also some short read fixes that can go in using a generation count that should speed small sequential reads significantly if there are 2 or more of the reads possible in a single logical FS block. More on that one later. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.