Date: Wed, 6 Dec 1995 17:32:36 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: current@freebsd.org Subject: Reconsidering leases Message-ID: <199512070032.RAA02483@phaeton.artisoft.com>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512070032.RAA02483>
