Date: Sat, 12 Jan 2002 17:30:38 -0800 From: Alfred Perlstein <bright@mu.org> To: smp@freebsd.org Cc: dillon@freebsd.org, tanimura@freebsd.org Subject: Re: fd locking. Message-ID: <20020112173038.H7984@elvis.mu.org> In-Reply-To: <20020112031144.F7984@elvis.mu.org>; from bright@mu.org on Sat, Jan 12, 2002 at 03:11:44AM -0800 References: <20020112031144.F7984@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
* Alfred Perlstein <bright@mu.org> [020112 03:11] wrote: > I've got world building with these patches. > > http://people.freebsd.org/~alfred/fd.diff > > or > > http://people.freebsd.org/~alfred/fd.diff.gz I've been asked for an archetectural overview. Here we go: Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the filelist. void fhold(struct file *fp); /* increments reference count on a file */ void fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file *ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file *ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe Dillon's fget cruft, but I'll get to that asap. -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductable donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020112173038.H7984>