From owner-cvs-all Sun Jan 13 3:58:25 2002 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D692A37B41C; Sun, 13 Jan 2002 03:58:06 -0800 (PST) Received: (from alfred@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0DBw6w02449; Sun, 13 Jan 2002 03:58:06 -0800 (PST) (envelope-from alfred) Message-Id: <200201131158.g0DBw6w02449@freefall.freebsd.org> From: Alfred Perlstein Date: Sun, 13 Jan 2002 03:58:06 -0800 (PST) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/alpha/osf1 osf1_misc.c osf1_mount.c src/sys/compat/linux linux_file.c linux_ioctl.c linux_stats.c src/sys/compat/svr4 svr4_fcntl.c svr4_filio.c svr4_ioctl.c svr4_misc.c svr4_stream.c src/sys/dev/aac aac.c ... X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG alfred 2002/01/13 03:58:06 PST Modified files: sys/alpha/osf1 osf1_misc.c osf1_mount.c sys/compat/linux linux_file.c linux_ioctl.c linux_stats.c sys/compat/svr4 svr4_fcntl.c svr4_filio.c svr4_ioctl.c svr4_misc.c svr4_stream.c sys/dev/aac aac.c sys/dev/streams streams.c sys/dev/tdfx tdfx_pci.c sys/fs/fdescfs fdesc_vfsops.c fdesc_vnops.c sys/fs/fifofs fifo_vnops.c sys/fs/portalfs portal_vfsops.c portal_vnops.c sys/fs/unionfs union_subr.c union_vfsops.c sys/i386/ibcs2 ibcs2_fcntl.c ibcs2_ioctl.c ibcs2_misc.c ibcs2_stat.c sys/kern init_main.c kern_acl.c kern_descrip.c kern_event.c kern_exec.c kern_fork.c sys_generic.c sys_pipe.c sys_socket.c uipc_syscalls.c uipc_usrreq.c vfs_cache.c vfs_lookup.c vfs_syscalls.c vfs_vnops.c sys/netgraph ng_socket.c sys/netsmb smb_dev.c sys/sys fcntl.h file.h filedesc.h sys/ufs/ffs ffs_alloc.c sys/vm vm_mmap.c Log: SMP Lock struct file, filedesc and the global file list. Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. 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 global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * 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 the fget cruft, I'll get to that asap. Revision Changes Path 1.23 +3 -4 src/sys/alpha/osf1/osf1_misc.c 1.6 +4 -2 src/sys/alpha/osf1/osf1_mount.c 1.59 +23 -11 src/sys/compat/linux/linux_file.c 1.80 +184 -94 src/sys/compat/linux/linux_ioctl.c 1.39 +10 -7 src/sys/compat/linux/linux_stats.c 1.17 +30 -11 src/sys/compat/svr4/svr4_fcntl.c 1.11 +9 -4 src/sys/compat/svr4/svr4_filio.c 1.10 +15 -8 src/sys/compat/svr4/svr4_ioctl.c 1.35 +29 -10 src/sys/compat/svr4/svr4_misc.c 1.24 +54 -25 src/sys/compat/svr4/svr4_stream.c 1.33 +7 -2 src/sys/dev/aac/aac.c 1.28 +22 -4 src/sys/dev/streams/streams.c 1.16 +6 -2 src/sys/dev/tdfx/tdfx_pci.c 1.32 +2 -0 src/sys/fs/fdescfs/fdesc_vfsops.c 1.71 +19 -7 src/sys/fs/fdescfs/fdesc_vnops.c 1.59 +13 -4 src/sys/fs/fifofs/fifo_vnops.c 1.35 +3 -1 src/sys/fs/portalfs/portal_vfsops.c 1.45 +7 -1 src/sys/fs/portalfs/portal_vnops.c 1.57 +6 -1 src/sys/fs/unionfs/union_subr.c 1.51 +2 -0 src/sys/fs/unionfs/union_vfsops.c 1.18 +7 -3 src/sys/i386/ibcs2/ibcs2_fcntl.c 1.20 +106 -59 src/sys/i386/ibcs2/ibcs2_ioctl.c 1.39 +20 -7 src/sys/i386/ibcs2/ibcs2_misc.c 1.13 +4 -2 src/sys/i386/ibcs2/ibcs2_stat.c 1.181 +3 -0 src/sys/kern/init_main.c 1.21 +4 -0 src/sys/kern/kern_acl.c 1.114 +292 -49 src/sys/kern/kern_descrip.c 1.35 +71 -21 src/sys/kern/kern_event.c 1.148 +4 -1 src/sys/kern/kern_exec.c 1.128 +9 -3 src/sys/kern/kern_fork.c 1.84 +96 -37 src/sys/kern/sys_generic.c 1.88 +20 -4 src/sys/kern/sys_pipe.c 1.37 +4 -3 src/sys/kern/sys_socket.c 1.102 +29 -7 src/sys/kern/uipc_syscalls.c 1.79 +55 -15 src/sys/kern/uipc_usrreq.c 1.64 +17 -0 src/sys/kern/vfs_cache.c 1.48 +3 -1 src/sys/kern/vfs_lookup.c 1.218 +151 -38 src/sys/kern/vfs_syscalls.c 1.126 +1 -1 src/sys/kern/vfs_vnops.c 1.32 +5 -4 src/sys/netgraph/ng_socket.c 1.5 +19 -8 src/sys/netsmb/smb_dev.c 1.12 +4 -3 src/sys/sys/fcntl.h 1.34 +67 -38 src/sys/sys/file.h 1.30 +28 -3 src/sys/sys/filedesc.h 1.84 +3 -0 src/sys/ufs/ffs/ffs_alloc.c 1.130 +9 -12 src/sys/vm/vm_mmap.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message