From owner-svn-src-user@FreeBSD.ORG Sun May 24 03:49:08 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D7911065670; Sun, 24 May 2009 03:49:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B4FA8FC22; Sun, 24 May 2009 03:49:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4O3n8tP076258; Sun, 24 May 2009 03:49:08 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4O3n7nk076257; Sun, 24 May 2009 03:49:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905240349.n4O3n7nk076257@svn.freebsd.org> From: Kip Macy Date: Sun, 24 May 2009 03:49:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192676 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 03:49:08 -0000 Author: kmacy Date: Sun May 24 03:49:07 2009 New Revision: 192676 URL: http://svn.freebsd.org/changeset/base/192676 Log: try allowing the arc to grow while still permitting backpressure Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun May 24 03:22:49 2009 (r192675) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun May 24 03:49:07 2009 (r192676) @@ -1822,14 +1822,15 @@ arc_reclaim_needed(void) #ifdef _KERNEL if (needfree) return (1); - + if (arc_size > arc_c_max) + return (1); if (arc_size <= arc_c_min) return (0); /* * If pages are needed and we're using more than half * of kmem ... be charitable */ - if (vm_pages_needed && (arc_size > kmem_size()/2)) + if (vm_pages_needed && (arc_size > (kmem_size()*2)/3)) return (1); #if 0 @@ -3431,8 +3432,14 @@ arc_init(void) /* Convert seconds to clock ticks */ arc_min_prefetch_lifespan = 1 * hz; +#ifdef __amd64__ + /* Start out with 1/8 of all memory */ + arc_c = (physmem*PAGE_SIZE) / 8; + +#else /* Start out with 1/8 of all memory */ arc_c = kmem_size() / 8; +#endif #if 0 #ifdef _KERNEL /* From owner-svn-src-user@FreeBSD.ORG Sun May 24 21:00:03 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BEDD1065670; Sun, 24 May 2009 21:00:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F6A08FC13; Sun, 24 May 2009 21:00:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OL03LB001115; Sun, 24 May 2009 21:00:03 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OL03Tk001114; Sun, 24 May 2009 21:00:03 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905242100.n4OL03Tk001114@svn.freebsd.org> From: Kip Macy Date: Sun, 24 May 2009 21:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192698 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 21:00:03 -0000 Author: kmacy Date: Sun May 24 21:00:02 2009 New Revision: 192698 URL: http://svn.freebsd.org/changeset/base/192698 Log: align the arc state lock and reduce the length of time that it is held Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun May 24 20:49:22 2009 (r192697) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun May 24 21:00:02 2009 (r192698) @@ -221,7 +221,7 @@ typedef struct arc_state { list_t arcs_list[ARC_BUFC_NUMTYPES]; /* list of evictable buffers */ uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; /* amount of evictable data */ uint64_t arcs_size; /* total amount of data in this state */ - kmutex_t arcs_mtx; + kmutex_t arcs_mtx __aligned(128); } arc_state_t; /* The 6 states: */ @@ -966,6 +966,8 @@ add_reference(arc_buf_hdr_t *ab, kmutex_ mutex_enter(&ab->b_state->arcs_mtx); ASSERT(list_link_active(&ab->b_arc_node)); list_remove(list, ab); + mutex_exit(&ab->b_state->arcs_mtx); + if (GHOST_STATE(ab->b_state)) { ASSERT3U(ab->b_datacnt, ==, 0); ASSERT3P(ab->b_buf, ==, NULL); @@ -974,7 +976,6 @@ add_reference(arc_buf_hdr_t *ab, kmutex_ ASSERT(delta > 0); ASSERT3U(*size, >=, delta); atomic_add_64(size, -delta); - mutex_exit(&ab->b_state->arcs_mtx); /* remove the prefetch flag if we get a reference */ if (ab->b_flags & ARC_PREFETCH) ab->b_flags &= ~ARC_PREFETCH; @@ -998,9 +999,10 @@ remove_reference(arc_buf_hdr_t *ab, kmut mutex_enter(&state->arcs_mtx); ASSERT(!list_link_active(&ab->b_arc_node)); list_insert_head(&state->arcs_list[ab->b_type], ab); + mutex_exit(&state->arcs_mtx); + ASSERT(ab->b_datacnt > 0); atomic_add_64(size, ab->b_size * ab->b_datacnt); - mutex_exit(&state->arcs_mtx); } return (cnt); } From owner-svn-src-user@FreeBSD.ORG Sun May 24 23:24:49 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB8CD106566B; Sun, 24 May 2009 23:24:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E4E58FC1A; Sun, 24 May 2009 23:24:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ONOnaD004080; Sun, 24 May 2009 23:24:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ONOnXP004079; Sun, 24 May 2009 23:24:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905242324.n4ONOnXP004079@svn.freebsd.org> From: Kip Macy Date: Sun, 24 May 2009 23:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192704 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 23:24:50 -0000 Author: kmacy Date: Sun May 24 23:24:49 2009 New Revision: 192704 URL: http://svn.freebsd.org/changeset/base/192704 Log: don't block I/O progress waiting for a pre-fetch stream if we find a matching stream but can't get the lock skip the prefetch Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Sun May 24 22:17:59 2009 (r192703) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Sun May 24 23:24:49 2009 (r192704) @@ -50,11 +50,11 @@ uint64_t zfetch_array_rd_sz = 1024 * 102 SYSCTL_DECL(_vfs_zfs); TUNABLE_INT("vfs.zfs.prefetch_disable", &zfs_prefetch_disable); -SYSCTL_INT(_vfs_zfs, OID_AUTO, prefetch_disable, CTLFLAG_RDTUN, +SYSCTL_INT(_vfs_zfs, OID_AUTO, prefetch_disable, CTLFLAG_RW, &zfs_prefetch_disable, 0, "Disable prefetch"); SYSCTL_NODE(_vfs_zfs, OID_AUTO, zfetch, CTLFLAG_RW, 0, "ZFS ZFETCH"); TUNABLE_INT("vfs.zfs.zfetch.max_streams", &zfetch_max_streams); -SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_streams, CTLFLAG_RDTUN, +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_streams, CTLFLAG_RW, &zfetch_max_streams, 0, "Max # of streams per zfetch"); TUNABLE_INT("vfs.zfs.zfetch.min_sec_reap", &zfetch_min_sec_reap); SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, min_sec_reap, CTLFLAG_RDTUN, @@ -339,8 +339,10 @@ top: reset = !prefetched && zs->zst_len > 1; - mutex_enter(&zs->zst_lock); - + if (mutex_tryenter(&zs->zst_lock) == 0) { + rc = 1; + goto out; + } if (zh->zst_offset != zs->zst_offset + zs->zst_len) { mutex_exit(&zs->zst_lock); goto top; @@ -364,8 +366,10 @@ top: reset = !prefetched && zs->zst_len > 1; - mutex_enter(&zs->zst_lock); - + if (mutex_tryenter(&zs->zst_lock) == 0) { + rc = 1; + goto out; + } if (zh->zst_offset != zs->zst_offset - zh->zst_len) { mutex_exit(&zs->zst_lock); goto top; @@ -392,8 +396,10 @@ top: zs->zst_len) && (zs->zst_len != zs->zst_stride)) { /* strided forward access */ - mutex_enter(&zs->zst_lock); - + if (mutex_tryenter(&zs->zst_lock) == 0) { + rc = 1; + goto out; + } if ((zh->zst_offset - zs->zst_offset - zs->zst_stride >= zs->zst_len) || (zs->zst_len == zs->zst_stride)) { mutex_exit(&zs->zst_lock); @@ -409,8 +415,10 @@ top: zs->zst_len) && (zs->zst_len != zs->zst_stride)) { /* strided reverse access */ - mutex_enter(&zs->zst_lock); - + if (mutex_tryenter(&zs->zst_lock) == 0) { + rc = 1; + goto out; + } if ((zh->zst_offset - zs->zst_offset + zs->zst_stride >= zs->zst_len) || (zs->zst_len == zs->zst_stride)) { mutex_exit(&zs->zst_lock); From owner-svn-src-user@FreeBSD.ORG Mon May 25 02:09:10 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CE48106566B; Mon, 25 May 2009 02:09:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B2C88FC13; Mon, 25 May 2009 02:09:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P29AF9007469; Mon, 25 May 2009 02:09:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P29AN9007468; Mon, 25 May 2009 02:09:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905250209.n4P29AN9007468@svn.freebsd.org> From: Kip Macy Date: Mon, 25 May 2009 02:09:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192712 - user/kmacy/releng_7_2_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 02:09:10 -0000 Author: kmacy Date: Mon May 25 02:09:09 2009 New Revision: 192712 URL: http://svn.freebsd.org/changeset/base/192712 Log: remove SX_SPINS limit Modified: user/kmacy/releng_7_2_fcs/sys/kern/kern_sx.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/kern_sx.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/kern_sx.c Mon May 25 02:05:00 2009 (r192711) +++ user/kmacy/releng_7_2_fcs/sys/kern/kern_sx.c Mon May 25 02:09:09 2009 (r192712) @@ -57,10 +57,6 @@ __FBSDID("$FreeBSD$"); #ifdef ADAPTIVE_SX #include - -#ifndef SX_SPINS -#define SX_SPINS 1000 -#endif #endif #ifdef DDB @@ -481,12 +477,8 @@ _sx_xlock_hard(struct sx *sx, uintptr_t GIANT_SAVE(); spin_count = 0; while (SX_OWNER(sx->sx_lock) == x && - TD_IS_RUNNING(owner) && - (spin_count++ < SX_SPINS)) + TD_IS_RUNNING(owner)) cpu_spinwait(); - - if (spin_count < SX_SPINS) - continue; } } #endif @@ -718,11 +710,8 @@ _sx_slock_hard(struct sx *sx, int opts, GIANT_SAVE(); spin_count = 0; while (SX_OWNER(sx->sx_lock) == x && - TD_IS_RUNNING(owner) && - (spin_count++ < SX_SPINS)) + TD_IS_RUNNING(owner)) cpu_spinwait(); - if (spin_count < SX_SPINS) - continue; } } #endif From owner-svn-src-user@FreeBSD.ORG Mon May 25 03:41:40 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C93381065676; Mon, 25 May 2009 03:41:40 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B824A8FC22; Mon, 25 May 2009 03:41:40 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P3fepi009654; Mon, 25 May 2009 03:41:40 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P3feQA009653; Mon, 25 May 2009 03:41:40 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905250341.n4P3feQA009653@svn.freebsd.org> From: Kip Macy Date: Mon, 25 May 2009 03:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192717 - user/kmacy/releng_7_2_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 03:41:41 -0000 Author: kmacy Date: Mon May 25 03:41:40 2009 New Revision: 192717 URL: http://svn.freebsd.org/changeset/base/192717 Log: eliminate one point of contention for the mnt lock by making mnt_opwritecount atomically updated Modified: user/kmacy/releng_7_2_fcs/sys/kern/vfs_vnops.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/vfs_vnops.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/vfs_vnops.c Mon May 25 03:24:47 2009 (r192716) +++ user/kmacy/releng_7_2_fcs/sys/kern/vfs_vnops.c Mon May 25 03:41:40 2009 (r192717) @@ -929,7 +929,7 @@ vn_start_write(vp, mpp, flags) } if (flags & V_XSLEEP) goto unlock; - mp->mnt_writeopcount++; + atomic_add_int(&mp->mnt_writeopcount, 1); unlock: MNT_REL(mp); MNT_IUNLOCK(mp); @@ -999,19 +999,23 @@ vn_start_secondary_write(vp, mpp, flags) * now in effect. */ void -vn_finished_write(mp) - struct mount *mp; +vn_finished_write(struct mount *mp) { + int writeopcount; + if (mp == NULL) return; - MNT_ILOCK(mp); - mp->mnt_writeopcount--; - if (mp->mnt_writeopcount < 0) + + writeopcount = atomic_fetchadd_int(&mp->mnt_writeopcount, -1) - 1; + + if (writeopcount < 0) panic("vn_finished_write: neg cnt"); if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0 && - mp->mnt_writeopcount <= 0) + writeopcount <= 0) { + MNT_ILOCK(mp); wakeup(&mp->mnt_writeopcount); - MNT_IUNLOCK(mp); + MNT_IUNLOCK(mp); + } } From owner-svn-src-user@FreeBSD.ORG Mon May 25 21:12:49 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AACA2106567B; Mon, 25 May 2009 21:12:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98EE28FC08; Mon, 25 May 2009 21:12:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PLCnpQ034926; Mon, 25 May 2009 21:12:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PLCnif034925; Mon, 25 May 2009 21:12:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905252112.n4PLCnif034925@svn.freebsd.org> From: Kip Macy Date: Mon, 25 May 2009 21:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192771 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 21:12:50 -0000 Author: kmacy Date: Mon May 25 21:12:49 2009 New Revision: 192771 URL: http://svn.freebsd.org/changeset/base/192771 Log: tell vfs not to refcount the mountpoint, we already do this ourselves Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon May 25 20:35:41 2009 (r192770) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon May 25 21:12:49 2009 (r192771) @@ -4777,6 +4777,13 @@ vop_listextattr { return (error); } +static int +zfs_freebsd_getwritemount(struct vop_getwritemount_args *unused) +{ + + return (EOPNOTSUPP); +} + struct vop_vector zfs_vnodeops; struct vop_vector zfs_fifoops; @@ -4791,6 +4798,7 @@ struct vop_vector zfs_vnodeops = { #else .vop_lookup = zfs_freebsd_lookup, #endif + .vop_getwritemount = zfs_freebsd_getwritemount, .vop_getattr = zfs_freebsd_getattr, .vop_setattr = zfs_freebsd_setattr, .vop_create = zfs_freebsd_create, From owner-svn-src-user@FreeBSD.ORG Tue May 26 00:23:04 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 106701065675; Tue, 26 May 2009 00:23:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F228A8FC17; Tue, 26 May 2009 00:23:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q0N3TM040879; Tue, 26 May 2009 00:23:03 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q0N3MB040864; Tue, 26 May 2009 00:23:03 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905260023.n4Q0N3MB040864@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 00:23:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192779 - in user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 00:23:04 -0000 Author: kmacy Date: Tue May 26 00:23:03 2009 New Revision: 192779 URL: http://svn.freebsd.org/changeset/base/192779 Log: - make tx type operation dependent rather than vfs state dependent - simplify ZIL replay handing - add dmu_read_flags to allow explicit disabling of prefetch Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid2.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue May 26 00:23:03 2009 (r192779) @@ -177,22 +177,22 @@ dmu_bonus_hold(objset_t *os, uint64_t ob * whose dnodes are in the same block. */ static int -dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, - uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp) +dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length, + int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags) { dsl_pool_t *dp = NULL; dmu_buf_t **dbp; uint64_t blkid, nblks, i; - uint32_t flags; + uint32_t dbuf_flags; int err; zio_t *zio; hrtime_t start; ASSERT(length <= DMU_MAX_ACCESS); - flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT; - if (length > zfetch_array_rd_sz) - flags |= DB_RF_NOPREFETCH; + dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT; + if (flags & DMU_READ_NO_PREFETCH || length > zfetch_array_rd_sz) + dbuf_flags |= DB_RF_NOPREFETCH; rw_enter(&dn->dn_struct_rwlock, RW_READER); if (dn->dn_datablkshift) { @@ -230,7 +230,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, /* initiate async i/o */ if (read) { rw_exit(&dn->dn_struct_rwlock); - (void) dbuf_read(db, zio, flags); + (void) dbuf_read(db, zio, dbuf_flags); rw_enter(&dn->dn_struct_rwlock, RW_READER); } dbp[i] = &db->db; @@ -282,7 +282,7 @@ dmu_buf_hold_array(objset_t *os, uint64_ return (err); err = dmu_buf_hold_array_by_dnode(dn, offset, length, read, tag, - numbufsp, dbpp); + numbufsp, dbpp, DMU_READ_PREFETCH); dnode_rele(dn, FTAG); @@ -297,7 +297,7 @@ dmu_buf_hold_array_by_bonus(dmu_buf_t *d int err; err = dmu_buf_hold_array_by_dnode(dn, offset, length, read, tag, - numbufsp, dbpp); + numbufsp, dbpp, DMU_READ_PREFETCH); return (err); } @@ -536,8 +536,8 @@ dmu_free_range(objset_t *os, uint64_t ob } int -dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, - void *buf) +dmu_read_flags(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, + void *buf, uint32_t flags) { dnode_t *dn; dmu_buf_t **dbp; @@ -567,7 +567,7 @@ dmu_read(objset_t *os, uint64_t object, * to be reading in parallel. */ err = dmu_buf_hold_array_by_dnode(dn, offset, mylen, - TRUE, FTAG, &numbufs, &dbp); + TRUE, FTAG, &numbufs, &dbp, flags); if (err) break; @@ -593,6 +593,13 @@ dmu_read(objset_t *os, uint64_t object, return (err); } +int +dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, + void *buf) +{ + return dmu_read_flags(os, object, offset, size, buf, 0); +} + void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, const void *buf, dmu_tx_t *tx) Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Tue May 26 00:23:03 2009 (r192779) @@ -447,8 +447,12 @@ int dmu_free_object(objset_t *os, uint64 * Canfail routines will return 0 on success, or an errno if there is a * nonrecoverable I/O error. */ +#define DMU_READ_PREFETCH 0 /* prefetch */ +#define DMU_READ_NO_PREFETCH 1 /* don't prefetch */ int dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, void *buf); +int dmu_read_flags(objset_t *os, uint64_t object, uint64_t offset, + uint64_t size, void *buf, uint32_t flags); void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, const void *buf, dmu_tx_t *tx); int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size); @@ -456,7 +460,10 @@ int dmu_write_uio(objset_t *os, uint64_t dmu_tx_t *tx); int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, struct page *pp, dmu_tx_t *tx); - +struct arc_buf *dmu_request_arcbuf(dmu_buf_t *handle, int size); +void dmu_return_arcbuf(struct arc_buf *buf); +void dmu_assign_arcbuf(dmu_buf_t *handle, uint64_t offset, struct arc_buf *buf, + dmu_tx_t *tx); extern int zfs_prefetch_disable; /* Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Tue May 26 00:23:03 2009 (r192779) @@ -47,7 +47,6 @@ struct zfsvfs { uint64_t z_root; /* id of root znode */ uint64_t z_unlinkedobj; /* id of unlinked zapobj */ uint64_t z_max_blksz; /* maximum block size for files */ - uint64_t z_assign; /* TXG_NOWAIT or set by zil_replay() */ uint64_t z_fuid_obj; /* fuid table object number */ uint64_t z_fuid_size; /* fuid table size */ avl_tree_t z_fuid_idx; /* fuid tree keyed by index */ @@ -72,6 +71,7 @@ struct zfsvfs { boolean_t z_issnap; /* true if this is a snapshot */ boolean_t z_vscan; /* virus scan on/off */ boolean_t z_use_fuids; /* version allows fuids */ + boolean_t z_replay; /* set during ZIL replay */ kmutex_t z_online_recv_lock; /* recv in prog grabs as WRITER */ uint64_t z_version; /* ZPL version */ #define ZFS_OBJ_MTX_SZ 64 Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Tue May 26 00:23:03 2009 (r192779) @@ -335,7 +335,6 @@ typedef void zil_parse_blk_func_t(zilog_ typedef void zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, uint64_t txg); typedef int zil_replay_func_t(); -typedef void zil_replay_cleaner_t(); typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t *zio); extern uint64_t zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func, @@ -350,9 +349,8 @@ extern void zil_free(zilog_t *zilog); extern zilog_t *zil_open(objset_t *os, zil_get_data_t *get_data); extern void zil_close(zilog_t *zilog); -extern void zil_replay(objset_t *os, void *arg, uint64_t *txgp, - zil_replay_func_t *replay_func[TX_MAX_TYPE], - zil_replay_cleaner_t *replay_cleaner); +extern void zil_replay(objset_t *os, void *arg, + zil_replay_func_t *replay_func[TX_MAX_TYPE]); extern void zil_destroy(zilog_t *zilog, boolean_t keep_first); extern void zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx); Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Tue May 26 00:23:03 2009 (r192779) @@ -74,13 +74,14 @@ struct zilog { uint64_t zl_commit_seq; /* committed upto this number */ uint64_t zl_lr_seq; /* log record sequence number */ uint64_t zl_destroy_txg; /* txg of last zil_destroy() */ - uint64_t zl_replay_seq[TXG_SIZE]; /* seq of last replayed rec */ + uint64_t zl_replayed_seq[TXG_SIZE]; /* seq of last replayed rec */ + uint64_t zl_replaying_seq; /* current replay seq number */ uint32_t zl_suspend; /* log suspend count */ kcondvar_t zl_cv_writer; /* log writer thread completion */ kcondvar_t zl_cv_suspend; /* log suspend completion */ uint8_t zl_suspending; /* log is currently suspending */ uint8_t zl_keep_first; /* keep first log block in destroy */ - uint8_t zl_stop_replay; /* don't replay any further */ + uint8_t zl_replay; /* don't replay any further */ uint8_t zl_stop_sync; /* for debugging */ uint8_t zl_writer; /* boolean: write setup in progress */ uint8_t zl_log_error; /* boolean: log write error */ @@ -102,6 +103,9 @@ typedef struct zil_dva_node { avl_node_t zn_node; } zil_dva_node_t; +#define ZIL_MAX_LOG_DATA (SPA_MAXBLOCKSIZE - sizeof (zil_trailer_t) - \ + sizeof (lr_write_t)) + #ifdef __cplusplus } #endif Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue May 26 00:23:03 2009 (r192779) @@ -2140,12 +2140,12 @@ top: } } - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_WAIT); if (error) { mutex_exit(&zp->z_acl_lock); mutex_exit(&zp->z_lock); - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -2201,7 +2201,7 @@ zfs_zaccess_common(znode_t *zp, uint32_t *check_privs = B_TRUE; - if (zfsvfs->z_assign >= TXG_INITIAL) { /* ZIL replay */ + if (zfsvfs->z_replay) { *working_mode = 0; return (0); } Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue May 26 00:23:03 2009 (r192779) @@ -561,27 +561,10 @@ zfs_rmnode(znode_t *zp) vfslocked = VFS_LOCK_GIANT(zfsvfs->z_vfs); + ASSERT(ZTOV(zp)->v_count == 0); ASSERT(zp->z_phys->zp_links == 0); /* - * If this is a ZIL replay then leave the object in the unlinked set. - * Otherwise we can get a deadlock, because the delete can be - * quite large and span multiple tx's and txgs, but each replay - * creates a tx to atomically run the replay function and mark the - * replay record as complete. We deadlock trying to start a tx in - * a new txg to further the deletion but can't because the replay - * tx hasn't finished. - * - * We actually delete the object if we get a failure to create an - * object in zil_replay_log_record(), or after calling zil_replay(). - */ - if (zfsvfs->z_assign >= TXG_INITIAL) { - zfs_znode_dmu_fini(zp); - zfs_znode_free(zp); - return; - } - - /* * If this is an attribute directory, purge its contents. */ if (ZTOV(zp) != NULL && ZTOV(zp)->v_type == VDIR && @@ -849,9 +832,9 @@ zfs_make_xattrdir(znode_t *zp, vattr_t * FUID_SIZE_ESTIMATE(zfsvfs)); } } - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) + if (error == ERESTART) dmu_tx_wait(tx); dmu_tx_abort(tx); return (error); @@ -936,7 +919,7 @@ top: error = zfs_make_xattrdir(zp, &va, xvpp, cr); zfs_dirent_unlock(dl); - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { /* NB: we already did dmu_tx_wait() if necessary */ goto top; } @@ -967,7 +950,7 @@ zfs_sticky_remove_access(znode_t *zdp, z uid_t fowner; zfsvfs_t *zfsvfs = zdp->z_zfsvfs; - if (zdp->z_zfsvfs->z_assign >= TXG_INITIAL) /* ZIL replay */ + if (zdp->z_zfsvfs->z_replay) return (0); if ((zdp->z_phys->zp_mode & S_ISVTX) == 0) Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c Tue May 26 00:23:03 2009 (r192779) @@ -525,7 +525,6 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64 uint32_t rid; idmap_stat status; uint64_t idx; - boolean_t is_replay = (zfsvfs->z_assign >= TXG_INITIAL); zfs_fuid_t *zfuid = NULL; zfs_fuid_info_t *fuidp; @@ -540,7 +539,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64 if (!zfsvfs->z_use_fuids || !IS_EPHEMERAL(id) || fuid_idx != 0) return (id); - if (is_replay) { + if (zfsvfs->z_replay) { fuidp = zfsvfs->z_fuid_replay; /* @@ -594,7 +593,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64 idx = zfs_fuid_find_by_domain(zfsvfs, domain, &kdomain, tx); - if (!is_replay) + if (!zfsvfs->z_replay) zfs_fuid_node_add(fuidpp, kdomain, rid, idx, id, type); else if (zfuid != NULL) { list_remove(&fuidp->z_fuids, zfuid); Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid2.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid2.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid2.c Tue May 26 00:23:03 2009 (r192779) @@ -525,7 +525,6 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64 uint32_t rid; idmap_stat status; uint64_t idx; - boolean_t is_replay = (zfsvfs->z_assign >= TXG_INITIAL); zfs_fuid_t *zfuid = NULL; zfs_fuid_info_t *fuidp; @@ -540,7 +539,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64 if (!zfsvfs->z_use_fuids || !IS_EPHEMERAL(id) || fuid_idx != 0) return (id); - if (is_replay) { + if (zfsvfs->z_replay) { fuidp = zfsvfs->z_fuid_replay; /* @@ -594,7 +593,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64 idx = zfs_fuid_find_by_domain(zfsvfs, domain, &kdomain, tx); - if (!is_replay) + if (!zfsvfs->z_replay) zfs_fuid_node_add(fuidpp, kdomain, rid, idx, id, type); else if (zfuid != NULL) { list_remove(&fuidp->z_fuids, zfuid); Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Tue May 26 00:23:03 2009 (r192779) @@ -42,6 +42,17 @@ #include #include #include +#include + +#define ZFS_HANDLE_REPLAY(zilog, tx) \ + if (zilog->zl_replay) { \ + dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); \ + zilog->zl_replayed_seq[dmu_tx_get_txg(tx) & TXG_MASK] = \ + zilog->zl_replaying_seq; \ + return; \ + } + + /* * All the functions in this file are used to construct the log entries @@ -236,6 +247,8 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t if (zilog == NULL) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + /* * If we have FUIDs present then add in space for * domains and ACE fuid's if any. @@ -339,6 +352,8 @@ zfs_log_remove(zilog_t *zilog, dmu_tx_t if (zilog == NULL) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + itx = zil_itx_create(txtype, sizeof (*lr) + namesize); lr = (lr_remove_t *)&itx->itx_lr; lr->lr_doid = dzp->z_id; @@ -363,6 +378,8 @@ zfs_log_link(zilog_t *zilog, dmu_tx_t *t if (zilog == NULL) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + itx = zil_itx_create(txtype, sizeof (*lr) + namesize); lr = (lr_link_t *)&itx->itx_lr; lr->lr_doid = dzp->z_id; @@ -390,6 +407,8 @@ zfs_log_symlink(zilog_t *zilog, dmu_tx_t if (zilog == NULL) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + itx = zil_itx_create(txtype, sizeof (*lr) + namesize + linksize); lr = (lr_create_t *)&itx->itx_lr; lr->lr_doid = dzp->z_id; @@ -424,6 +443,8 @@ zfs_log_rename(zilog_t *zilog, dmu_tx_t if (zilog == NULL) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + itx = zil_itx_create(txtype, sizeof (*lr) + snamesize + dnamesize); lr = (lr_rename_t *)&itx->itx_lr; lr->lr_sdoid = sdzp->z_id; @@ -456,6 +477,8 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t * if (zilog == NULL || zp->z_unlinked) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + /* * Writes are handled in three different ways: * @@ -553,6 +576,8 @@ zfs_log_truncate(zilog_t *zilog, dmu_tx_ if (zilog == NULL || zp->z_unlinked) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + itx = zil_itx_create(txtype, sizeof (*lr)); lr = (lr_truncate_t *)&itx->itx_lr; lr->lr_foid = zp->z_id; @@ -582,6 +607,8 @@ zfs_log_setattr(zilog_t *zilog, dmu_tx_t if (zilog == NULL || zp->z_unlinked) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + /* * If XVATTR set, then log record size needs to allow * for lr_attr_t + xvattr mask, mapsize and create time @@ -648,6 +675,8 @@ zfs_log_acl(zilog_t *zilog, dmu_tx_t *tx if (zilog == NULL || zp->z_unlinked) return; + ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */ + txtype = (zp->z_zfsvfs->z_version < ZPL_VERSION_FUID) ? TX_ACL_V0 : TX_ACL; Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue May 26 00:23:03 2009 (r192779) @@ -492,6 +492,13 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t dmu_objset_set_user(zfsvfs->z_os, zfsvfs); mutex_exit(&zfsvfs->z_os->os->os_user_ptr_lock); + zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); + if (zil_disable) { + zil_destroy(zfsvfs->z_log, 0); + zfsvfs->z_log = NULL; + } + + /* * If we are not mounting (ie: online recv), then we don't * have to worry about replaying the log as we blocked all @@ -505,21 +512,27 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t * allow replays to succeed. */ readonly = zfsvfs->z_vfs->vfs_flag & VFS_RDONLY; - zfsvfs->z_vfs->vfs_flag &= ~VFS_RDONLY; - - /* - * Parse and replay the intent log. - */ - zil_replay(zfsvfs->z_os, zfsvfs, &zfsvfs->z_assign, - zfs_replay_vector, zfs_unlinked_drain); - - zfs_unlinked_drain(zfsvfs); + if (readonly != 0) + zfsvfs->z_vfs->vfs_flag &= ~VFS_RDONLY; + else + zfs_unlinked_drain(zfsvfs); + + if (zfsvfs->z_log) { + + /* + * Parse and replay the intent log. + * Because of ziltest, this must be done after + * zfs_unlinked_drain(). (Further note: ziltest + * doesn't use readonly mounts, where + */ + zfsvfs->z_replay = B_TRUE; + zil_replay(zfsvfs->z_os, zfsvfs, zfs_replay_vector); + zfsvfs->z_replay = B_FALSE; + } + zfsvfs->z_vfs->vfs_flag |= readonly; /* restore readonly bit */ } - if (!zil_disable) - zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); - return (0); } @@ -555,7 +568,6 @@ zfs_domount(vfs_t *vfsp, char *osname) zfsvfs = kmem_zalloc(sizeof (zfsvfs_t), KM_SLEEP); zfsvfs->z_vfs = vfsp; zfsvfs->z_parent = zfsvfs; - zfsvfs->z_assign = TXG_NOWAIT; zfsvfs->z_max_blksz = SPA_MAXBLOCKSIZE; zfsvfs->z_show_ctldir = ZFS_SNAPDIR_VISIBLE; Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 26 00:23:03 2009 (r192779) @@ -133,12 +133,12 @@ * rw_enter(...); // grab any other locks you need * tx = dmu_tx_create(...); // get DMU tx * dmu_tx_hold_*(); // hold each object you might modify - * error = dmu_tx_assign(tx, zfsvfs->z_assign); // try to assign + * error = dmu_tx_assign(tx, TXG_NOWAIT); // try to assign * if (error) { * rw_exit(...); // drop locks * zfs_dirent_unlock(dl); // unlock directory entry * VN_RELE(...); // release held vnodes - * if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + * if (error == ERESTART) { * dmu_tx_wait(tx); * dmu_tx_abort(tx); * goto top; @@ -794,10 +794,9 @@ zfs_write(vnode_t *vp, uio_t *uio, int i tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_bonus(tx, zp->z_id); dmu_tx_hold_write(tx, zp->z_id, woff, MIN(n, max_blksz)); - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - if (error == ERESTART && - zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); continue; @@ -907,7 +906,7 @@ zfs_write(vnode_t *vp, uio_t *uio, int i * If we're in replay mode, or we made no progress, return error. * Otherwise, it's at least a partial write, so it's successful. */ - if (zfsvfs->z_assign >= TXG_INITIAL || uio->uio_resid == start_resid) { + if (zfsvfs->z_replay || uio->uio_resid == start_resid) { ZFS_EXIT(zfsvfs); return (error); } @@ -1396,11 +1395,10 @@ top: dmu_tx_hold_write(tx, DMU_NEW_OBJECT, 0, SPA_MAXBLOCKSIZE); } - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); - if (error == ERESTART && - zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -1609,11 +1607,11 @@ top: /* charge as an update -- would be nice not to charge at all */ dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); VN_RELE(vp); - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -1811,10 +1809,10 @@ top: if ((dzp->z_phys->zp_flags & ZFS_INHERIT_ACE) || aclp) dmu_tx_hold_write(tx, DMU_NEW_OBJECT, 0, SPA_MAXBLOCKSIZE); - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -1941,13 +1939,13 @@ top: dmu_tx_hold_zap(tx, dzp->z_id, FALSE, name); dmu_tx_hold_bonus(tx, zp->z_id); dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { rw_exit(&zp->z_parent_lock); rw_exit(&zp->z_name_lock); zfs_dirent_unlock(dl); VN_RELE(vp); - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -2841,7 +2839,7 @@ top: dmu_tx_hold_bonus(tx, attrzp->z_id); } - err = dmu_tx_assign(tx, zfsvfs->z_assign); + err = dmu_tx_assign(tx, TXG_NOWAIT); if (err) { if (attrzp) VN_RELE(ZTOV(attrzp)); @@ -2851,7 +2849,7 @@ top: aclp = NULL; } - if (err == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (err == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -3296,7 +3294,7 @@ top: if (tzp) dmu_tx_hold_bonus(tx, tzp->z_id); /* parent changes */ dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { if (zl != NULL) zfs_rename_unlock(&zl); @@ -3305,7 +3303,7 @@ top: VN_RELE(ZTOV(szp)); if (tzp) VN_RELE(ZTOV(tzp)); - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -3442,10 +3440,10 @@ top: FUID_SIZE_ESTIMATE(zfsvfs)); } } - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -3661,10 +3659,10 @@ top: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_bonus(tx, szp->z_id); dmu_tx_hold_zap(tx, dzp->z_id, TRUE, name); - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue May 26 00:23:03 2009 (r192779) @@ -664,7 +664,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, d ASSERT(vap && (vap->va_mask & (AT_TYPE|AT_MODE)) == (AT_TYPE|AT_MODE)); - if (zfsvfs->z_assign >= TXG_INITIAL) { /* ZIL replay */ + if (zfsvfs->z_replay) { obj = vap->va_nodeid; flag |= IS_REPLAY; now = vap->va_ctime; /* see zfs_replay_create() */ @@ -1194,9 +1194,9 @@ top: newblksz = 0; } - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -1316,9 +1316,9 @@ zfs_trunc(znode_t *zp, uint64_t end) top: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_bonus(tx, zp->z_id); - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; @@ -1395,9 +1395,9 @@ zfs_freesp(znode_t *zp, uint64_t off, ui log: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_bonus(tx, zp->z_id); - error = dmu_tx_assign(tx, zfsvfs->z_assign); + error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - if (error == ERESTART && zfsvfs->z_assign == TXG_NOWAIT) { + if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto log; @@ -1503,7 +1503,6 @@ zfs_create_fs(objset_t *os, cred_t *cr, bzero(&zfsvfs, sizeof (zfsvfs_t)); zfsvfs.z_os = os; - zfsvfs.z_assign = TXG_NOWAIT; zfsvfs.z_parent = &zfsvfs; zfsvfs.z_version = version; zfsvfs.z_use_fuids = USE_FUIDS(version, os); Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue May 26 00:23:03 2009 (r192779) @@ -357,7 +357,7 @@ zil_create(zilog_t *zilog) txg_wait_synced(zilog->zl_dmu_pool, zilog->zl_destroy_txg); ASSERT(zh->zh_claim_txg == 0); - ASSERT(zh->zh_replay_seq == 0); + ASSERT(zh->zh_replayed_seq == 0); blk = zh->zh_log; @@ -1225,7 +1225,7 @@ zil_sync(zilog_t *zilog, dmu_tx_t *tx) ASSERT(zilog->zl_stop_sync == 0); - zh->zh_replay_seq = zilog->zl_replay_seq[txg & TXG_MASK]; + zh->zh_replay_seq = zilog->zl_replayed_seq[txg & TXG_MASK]; if (zilog->zl_destroy_txg == txg) { blkptr_t blk = zh->zh_log; @@ -1234,7 +1234,7 @@ zil_sync(zilog_t *zilog, dmu_tx_t *tx) ASSERT(spa_sync_pass(spa) == 1); bzero(zh, sizeof (zil_header_t)); - bzero(zilog->zl_replay_seq, sizeof (zilog->zl_replay_seq)); + bzero(zilog->zl_replayed_seq, sizeof (zilog->zl_replayed_seq)); if (zilog->zl_keep_first) { /* @@ -1471,9 +1471,7 @@ zil_resume(zilog_t *zilog) typedef struct zil_replay_arg { objset_t *zr_os; zil_replay_func_t **zr_replay; - zil_replay_cleaner_t *zr_replay_cleaner; void *zr_arg; - uint64_t *zr_txgp; boolean_t zr_byteswap; char *zr_lrbuf; } zil_replay_arg_t; @@ -1488,7 +1486,7 @@ zil_replay_log_record(zilog_t *zilog, lr char *name; int pass, error, sunk; - if (zilog->zl_stop_replay) + if (!zilog->zl_replay) /* giving up */ return; if (lr->lrc_txg < claim_txg) /* already committed */ @@ -1552,44 +1550,14 @@ zil_replay_log_record(zilog_t *zilog, lr /* * We must now do two things atomically: replay this log record, * and update the log header to reflect the fact that we did so. - * We use the DMU's ability to assign into a specific txg to do this. + * At the end of each replay function the sequence number + * is updated if we are in replay mode. */ - for (pass = 1, sunk = B_FALSE; /* CONSTANTCONDITION */; pass++) { - uint64_t replay_txg; - dmu_tx_t *replay_tx; - - replay_tx = dmu_tx_create(zr->zr_os); - error = dmu_tx_assign(replay_tx, TXG_WAIT); - if (error) { - dmu_tx_abort(replay_tx); - break; - } - - replay_txg = dmu_tx_get_txg(replay_tx); - - if (txtype == 0 || txtype >= TX_MAX_TYPE) { - error = EINVAL; - } else { - /* - * On the first pass, arrange for the replay vector - * to fail its dmu_tx_assign(). That's the only way - * to ensure that those code paths remain well tested. - * - * Only byteswap (if needed) on the 1st pass. - */ - *zr->zr_txgp = replay_txg - (pass == 1); - error = zr->zr_replay[txtype](zr->zr_arg, zr->zr_lrbuf, - zr->zr_byteswap && pass == 1); - *zr->zr_txgp = TXG_NOWAIT; - } - - if (error == 0) { - dsl_dataset_dirty(dmu_objset_ds(zr->zr_os), replay_tx); - zilog->zl_replay_seq[replay_txg & TXG_MASK] = - lr->lrc_seq; - } - - dmu_tx_commit(replay_tx); + for (pass = 1; pass <= 2; pass++) { + zilog->zl_replaying_seq = lr->lrc_seq; + /* Only byteswap (if needed) on the 1st pass. */ + error = zr->zr_replay[txtype](zr->zr_arg, zr->zr_lrbuf, + zr->zr_byteswap && pass == 1); if (!error) return; @@ -1597,36 +1565,22 @@ zil_replay_log_record(zilog_t *zilog, lr /* * The DMU's dnode layer doesn't see removes until the txg * commits, so a subsequent claim can spuriously fail with - * EEXIST. So if we receive any error other than ERESTART - * we try syncing out any removes then retrying the - * transaction. + * EEXIST. So if we receive any error we try syncing out + * any removes then retry the transaction. */ - if (error != ERESTART && !sunk) { - if (zr->zr_replay_cleaner) - zr->zr_replay_cleaner(zr->zr_arg); + if (pass == 1) txg_wait_synced(spa_get_dsl(zilog->zl_spa), 0); - sunk = B_TRUE; - continue; /* retry */ - } - - if (error != ERESTART) - break; - - if (pass != 1) - txg_wait_open(spa_get_dsl(zilog->zl_spa), - replay_txg + 1); - - dprintf("pass %d, retrying\n", pass); } - - ASSERT(error && error != ERESTART); +bad: + + ASSERT(error); name = kmem_alloc(MAXNAMELEN, KM_SLEEP); dmu_objset_name(zr->zr_os, name); cmn_err(CE_WARN, "ZFS replay transaction error %d, " "dataset %s, seq 0x%llx, txtype %llu %s\n", error, name, (u_longlong_t)lr->lrc_seq, (u_longlong_t)txtype, (lr->lrc_txtype & TX_CI) ? "CI" : ""); - zilog->zl_stop_replay = 1; + zilog->zl_replay = B_FALSE; kmem_free(name, MAXNAMELEN); } @@ -1641,9 +1595,8 @@ zil_incr_blks(zilog_t *zilog, blkptr_t * * If this dataset has a non-empty intent log, replay it and destroy it. */ void -zil_replay(objset_t *os, void *arg, uint64_t *txgp, - zil_replay_func_t *replay_func[TX_MAX_TYPE], - zil_replay_cleaner_t *replay_cleaner) +zil_replay(objset_t *os, void *arg, + zil_replay_func_t *replay_func[TX_MAX_TYPE]) { zilog_t *zilog = dmu_objset_zil(os); const zil_header_t *zh = zilog->zl_header; @@ -1657,9 +1610,7 @@ zil_replay(objset_t *os, void *arg, uint zr.zr_os = os; zr.zr_replay = replay_func; - zr.zr_replay_cleaner = replay_cleaner; zr.zr_arg = arg; - zr.zr_txgp = txgp; zr.zr_byteswap = BP_SHOULD_BYTESWAP(&zh->zh_log); zr.zr_lrbuf = kmem_alloc(2 * SPA_MAXBLOCKSIZE, KM_SLEEP); @@ -1668,7 +1619,7 @@ zil_replay(objset_t *os, void *arg, uint */ txg_wait_synced(zilog->zl_dmu_pool, 0); - zilog->zl_stop_replay = 0; + zilog->zl_replay = B_TRUE; zilog->zl_replay_time = LBOLT; ASSERT(zilog->zl_replay_blks == 0); (void) zil_parse(zilog, zil_incr_blks, zil_replay_log_record, &zr, @@ -1677,6 +1628,7 @@ zil_replay(objset_t *os, void *arg, uint zil_destroy(zilog, B_FALSE); txg_wait_synced(zilog->zl_dmu_pool, zilog->zl_destroy_txg); + zilog->zl_replay = B_FALSE; //printf("ZFS: Replay of ZIL on %s finished.\n", os->os->os_spa->spa_name); } Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue May 26 00:16:16 2009 (r192778) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue May 26 00:23:03 2009 (r192779) @@ -73,6 +73,7 @@ #include #include #include +#include #include "zfs_namecheck.h" @@ -138,6 +139,7 @@ typedef struct zvol_state { #define ZVOL_RDONLY 0x1 #define ZVOL_DUMPIFIED 0x2 #define ZVOL_EXCL 0x4 +#define ZVOL_WCE 0x8 /* * zvol maximum transfer in one DMU tx. @@ -278,28 +280,72 @@ zvol_access(struct g_provider *pp, int a ssize_t zvol_immediate_write_sz = 32768; static void -zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, offset_t off, ssize_t len) +zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, offset_t off, ssize_t resid, + boolean_t sync) { uint32_t blocksize = zv->zv_volblocksize; - lr_write_t *lr; + zilog_t *zilog = zv->zv_zilog; + boolean_t slogging; - while (len) { - ssize_t nbytes = MIN(len, blocksize - P2PHASE(off, blocksize)); - itx_t *itx = zil_itx_create(TX_WRITE, sizeof (*lr)); + if (zil_disable) + return; - itx->itx_wr_state = - len > zvol_immediate_write_sz ? WR_INDIRECT : WR_NEED_COPY; - itx->itx_private = zv; + if (zilog->zl_replay) { + dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); + zilog->zl_replayed_seq[dmu_tx_get_txg(tx) & TXG_MASK] = + zilog->zl_replaying_seq; + return; + } + slogging = spa_has_slogs(zilog->zl_spa); + + while (resid) { + ssize_t len; + itx_t *itx; + lr_write_t *lr; + itx_wr_state_t write_state; + + /* + * Unlike zfs_log_write() we can be called with + * upto DMU_MAX_ACCESS/2 (5MB) writes. + */ + if (blocksize > zvol_immediate_write_sz && !slogging && + resid >= blocksize && off % blocksize == 0) { + write_state = WR_INDIRECT; /* uses dmu_sync */ + len = blocksize; + } else if (sync) { + write_state = WR_COPIED; + len = MIN(ZIL_MAX_LOG_DATA, resid); + } else { + write_state = WR_NEED_COPY; + len = MIN(ZIL_MAX_LOG_DATA, resid); + } + + itx = zil_itx_create(TX_WRITE, sizeof (*lr) + + (write_state == WR_COPIED ? len : 0)); lr = (lr_write_t *)&itx->itx_lr; + if (write_state == WR_COPIED && dmu_read_flags(zv->zv_objset, + ZVOL_OBJ, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { + kmem_free(itx, offsetof(itx_t, itx_lr) + + itx->itx_lr.lrc_reclen); + itx = zil_itx_create(TX_WRITE, sizeof (*lr)); + lr = (lr_write_t *)&itx->itx_lr; + write_state = WR_NEED_COPY; + } + + itx->itx_wr_state = write_state; + if (write_state == WR_NEED_COPY) + itx->itx_sod += len; + itx->itx_private = zv; lr->lr_foid = ZVOL_OBJ; lr->lr_offset = off; - lr->lr_length = nbytes; + lr->lr_length = len; lr->lr_blkoff = off - P2ALIGN_TYPED(off, blocksize, uint64_t); BP_ZERO(&lr->lr_blkptr); (void) zil_itx_assign(zv->zv_zilog, itx, tx); - len -= nbytes; - off += nbytes; + + off += len; + resid -= len; } } @@ -337,6 +383,7 @@ zvol_serve_one(zvol_state_t *zv, struct rl_t *rl; int error = 0; boolean_t reading; + boolean_t sync; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue May 26 04:33:17 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38CDC106566C; Tue, 26 May 2009 04:33:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 270188FC1D; Tue, 26 May 2009 04:33:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q4XHfR046251; Tue, 26 May 2009 04:33:17 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q4XG17046248; Tue, 26 May 2009 04:33:16 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905260433.n4Q4XG17046248@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 04:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192785 - in user/kmacy/releng_7_2_fcs/sys: amd64/conf conf kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 04:33:17 -0000 Author: kmacy Date: Tue May 26 04:33:16 2009 New Revision: 192785 URL: http://svn.freebsd.org/changeset/base/192785 Log: add the option of having condvars ignoring extra locks held this makes WITNESS much quietery (i.e. more useful) with ZFS Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS user/kmacy/releng_7_2_fcs/sys/conf/options user/kmacy/releng_7_2_fcs/sys/kern/kern_condvar.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS Tue May 26 03:56:56 2009 (r192784) +++ user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS Tue May 26 04:33:16 2009 (r192785) @@ -73,6 +73,7 @@ options INVARIANT_SUPPORT options WITNESS options WITNESS_SKIPSPIN +options WITNESS_SKIPCV options DEBUG options KDB options DDB Modified: user/kmacy/releng_7_2_fcs/sys/conf/options ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/options Tue May 26 03:56:56 2009 (r192784) +++ user/kmacy/releng_7_2_fcs/sys/conf/options Tue May 26 04:33:16 2009 (r192785) @@ -642,6 +642,7 @@ KTR_VERBOSE opt_ktr.h WITNESS opt_global.h WITNESS_KDB opt_witness.h WITNESS_SKIPSPIN opt_witness.h +WITNESS_SKIPCV opt_witness.h # options for ACPI support ACPI_DEBUG opt_acpi.h Modified: user/kmacy/releng_7_2_fcs/sys/kern/kern_condvar.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/kern_condvar.c Tue May 26 03:56:56 2009 (r192784) +++ user/kmacy/releng_7_2_fcs/sys/kern/kern_condvar.c Tue May 26 04:33:16 2009 (r192785) @@ -106,8 +106,10 @@ _cv_wait(struct cv *cvp, struct lock_obj ktrcsw(1, 0); #endif CV_ASSERT(cvp, lock, td); +#ifndef WITNESS_SKIPCV WITNESS_WARN(WARN_GIANTOK, lock, "Waiting on \"%s\"", cvp->cv_description); +#endif WITNESS_SAVE(lock, lock_witness); class = LOCK_CLASS(lock); From owner-svn-src-user@FreeBSD.ORG Tue May 26 04:35:31 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84B2C1065677; Tue, 26 May 2009 04:35:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72A868FC0C; Tue, 26 May 2009 04:35:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q4ZVYY046329; Tue, 26 May 2009 04:35:31 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q4ZVT0046328; Tue, 26 May 2009 04:35:31 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905260435.n4Q4ZVT0046328@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 04:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192786 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 04:35:31 -0000 Author: kmacy Date: Tue May 26 04:35:31 2009 New Revision: 192786 URL: http://svn.freebsd.org/changeset/base/192786 Log: fix assert Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue May 26 04:33:16 2009 (r192785) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue May 26 04:35:31 2009 (r192786) @@ -357,7 +357,7 @@ zil_create(zilog_t *zilog) txg_wait_synced(zilog->zl_dmu_pool, zilog->zl_destroy_txg); ASSERT(zh->zh_claim_txg == 0); - ASSERT(zh->zh_replayed_seq == 0); + ASSERT(zh->zh_replay_seq == 0); blk = zh->zh_log; From owner-svn-src-user@FreeBSD.ORG Tue May 26 04:42:31 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B588106566B; Tue, 26 May 2009 04:42:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49EC88FC21; Tue, 26 May 2009 04:42:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q4gVik046482; Tue, 26 May 2009 04:42:31 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q4gVfJ046481; Tue, 26 May 2009 04:42:31 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905260442.n4Q4gVfJ046481@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 04:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192787 - user/kmacy/releng_7_2_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 04:42:31 -0000 Author: kmacy Date: Tue May 26 04:42:31 2009 New Revision: 192787 URL: http://svn.freebsd.org/changeset/base/192787 Log: add opt_witness.h for last commit Modified: user/kmacy/releng_7_2_fcs/sys/kern/kern_condvar.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/kern_condvar.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/kern_condvar.c Tue May 26 04:35:31 2009 (r192786) +++ user/kmacy/releng_7_2_fcs/sys/kern/kern_condvar.c Tue May 26 04:42:31 2009 (r192787) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ktrace.h" +#include "opt_witness.h" #include #include From owner-svn-src-user@FreeBSD.ORG Tue May 26 05:30:22 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF4DE106564A; Tue, 26 May 2009 05:30:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA5158FC1C; Tue, 26 May 2009 05:30:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q5ULjY047477; Tue, 26 May 2009 05:30:21 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q5ULOK047475; Tue, 26 May 2009 05:30:21 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905260530.n4Q5ULOK047475@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 05:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192789 - in user/kmacy/releng_7_2_fcs/sys: amd64/amd64 amd64/include cddl/contrib/opensolaris/uts/common/fs/zfs dev/md kern nfsclient ufs/ffs vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 05:30:22 -0000 Author: kmacy Date: Tue May 26 05:30:21 2009 New Revision: 192789 URL: http://svn.freebsd.org/changeset/base/192789 Log: incorporate Jeffr's patch breaking down the vm_page_queue mutex for operations which don't actually manipulate the page queues in to a hashed set of locks Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c user/kmacy/releng_7_2_fcs/sys/amd64/include/pmap.h user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/kmacy/releng_7_2_fcs/sys/dev/md/md.c user/kmacy/releng_7_2_fcs/sys/kern/kern_exec.c user/kmacy/releng_7_2_fcs/sys/kern/kern_subr.c user/kmacy/releng_7_2_fcs/sys/kern/sys_pipe.c user/kmacy/releng_7_2_fcs/sys/kern/sys_process.c user/kmacy/releng_7_2_fcs/sys/kern/uipc_cow.c user/kmacy/releng_7_2_fcs/sys/kern/uipc_syscalls.c user/kmacy/releng_7_2_fcs/sys/kern/vfs_bio.c user/kmacy/releng_7_2_fcs/sys/nfsclient/nfs_bio.c user/kmacy/releng_7_2_fcs/sys/ufs/ffs/ffs_vnops.c user/kmacy/releng_7_2_fcs/sys/vm/device_pager.c user/kmacy/releng_7_2_fcs/sys/vm/pmap.h user/kmacy/releng_7_2_fcs/sys/vm/swap_pager.c user/kmacy/releng_7_2_fcs/sys/vm/uma_core.c user/kmacy/releng_7_2_fcs/sys/vm/vm_contig.c user/kmacy/releng_7_2_fcs/sys/vm/vm_fault.c user/kmacy/releng_7_2_fcs/sys/vm/vm_glue.c user/kmacy/releng_7_2_fcs/sys/vm/vm_kern.c user/kmacy/releng_7_2_fcs/sys/vm/vm_map.c user/kmacy/releng_7_2_fcs/sys/vm/vm_mmap.c user/kmacy/releng_7_2_fcs/sys/vm/vm_object.c user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c user/kmacy/releng_7_2_fcs/sys/vm/vnode_pager.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Tue May 26 04:51:56 2009 (r192788) +++ user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Tue May 26 05:30:21 2009 (r192789) @@ -168,6 +168,17 @@ __FBSDID("$FreeBSD$"); #define pa_index(pa) ((pa) >> PDRSHIFT) #define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) +#define PA_LOCKPTR(pa) &pa_lock[pa_index((pa)) % PA_LOCK_COUNT] +#define PA_LOCK(pa) mtx_lock(PA_LOCKPTR(pa)) +#define PA_TRYLOCK(pa) mtx_trylock(PA_LOCKPTR(pa)) +#define PA_UNLOCK(pa) mtx_unlock(PA_LOCKPTR(pa)) +#define PA_LOCK_ASSERT(pa, a) mtx_assert(PA_LOCKPTR(pa), (a)) + +#define PA_LOCK_COUNT 64 + +struct mtx pa_lock[PA_LOCK_COUNT]; +struct mtx pv_lock; + struct pmap kernel_pmap_store; vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ @@ -184,6 +195,14 @@ static int pg_ps_enabled; SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RD, &pg_ps_enabled, 0, "Are large page mappings enabled?"); +static int pmap_tryrelock_calls; +SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_calls, CTLFLAG_RD, + &pmap_tryrelock_calls, 0, "Number of tryrelock calls"); + +static int pmap_tryrelock_restart; +SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_restart, CTLFLAG_RD, + &pmap_tryrelock_restart, 0, "Number of tryrelock restarts"); + static u_int64_t KPTphys; /* phys addr of kernel level 1 */ static u_int64_t KPDphys; /* phys addr of kernel level 2 */ u_int64_t KPDPphys; /* phys addr of kernel level 3 */ @@ -244,10 +263,13 @@ static void pmap_insert_entry(pmap_t pma static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); -static vm_page_t pmap_allocpde(pmap_t pmap, vm_offset_t va, int flags); -static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags); +static vm_page_t pmap_allocpde(pmap_t pmap, vm_paddr_t pa, vm_offset_t va, + int flags); +static vm_page_t pmap_allocpte(pmap_t pmap, vm_paddr_t pa, vm_offset_t va, + int flags); -static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags); +static vm_page_t _pmap_allocpte(pmap_t pmap, vm_paddr_t pa, + vm_pindex_t ptepindex, int flags); static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t* free); static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t, vm_page_t *); @@ -405,6 +427,37 @@ vtopde(vm_offset_t va) return (PDmap + ((va >> PDRSHIFT) & mask)); } +/* + * Try to acquire a physical address lock while a pmap is locked. If we + * fail to trylock we unlock and lock the pmap directly and cache the + * locked pa in *locked. The caller should then restart their loop in case + * the virtual to physical mapping has changed. + */ +static int +pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked) +{ + vm_paddr_t lockpa; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + atomic_add_int((volatile int *)&pmap_tryrelock_calls, 1); + lockpa = *locked; + *locked = pa; + if (lockpa) { + PA_LOCK_ASSERT(lockpa, MA_OWNED); + if (PA_LOCKPTR(pa) == PA_LOCKPTR(lockpa)) + return (0); + PA_UNLOCK(lockpa); + } + if (PA_TRYLOCK(pa)) + return 0; + PMAP_UNLOCK(pmap); + PA_LOCK(pa); + PMAP_LOCK(pmap); + atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1); + + return (EAGAIN); +} + static u_int64_t allocpages(vm_paddr_t *firstaddr, int n) { @@ -502,6 +555,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) { vm_offset_t va; pt_entry_t *pte, *unused; + int i; /* * Create an initial set of page tables to run the kernel in. @@ -524,6 +578,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) PMAP_LOCK_INIT(kernel_pmap); kernel_pmap->pm_pml4 = (pdp_entry_t *) (KERNBASE + KPML4phys); kernel_pmap->pm_root = NULL; + kernel_pmap->pm_free = NULL; kernel_pmap->pm_active = -1; /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvchunk); @@ -560,6 +615,11 @@ pmap_bootstrap(vm_paddr_t *firstaddr) /* Initialize the PAT MSR. */ pmap_init_pat(); + + /* Setup page locks. */ + for (i = 0; i < PA_LOCK_COUNT; i++) + mtx_init(&pa_lock[i], "page lock", NULL, MTX_DEF | MTX_RECURSE); + mtx_init(&pv_lock, "pv list lock", NULL, MTX_DEF); } /* @@ -614,6 +674,13 @@ pmap_page_init(vm_page_t m) TAILQ_INIT(&m->md.pv_list); } +struct mtx * +pmap_page_lockptr(vm_page_t m) +{ + KASSERT(m != NULL, ("pmap_page_lockptr: NULL page")); + return (PA_LOCKPTR(VM_PAGE_TO_PHYS(m))); +} + /* * Initialize the pmap module. * Called by vm_init, to initialize any structures that the pmap @@ -996,29 +1063,35 @@ pmap_extract_and_hold(pmap_t pmap, vm_of { pd_entry_t pde, *pdep; pt_entry_t pte; + vm_paddr_t pa; vm_page_t m; + pa = 0; m = NULL; - vm_page_lock_queues(); PMAP_LOCK(pmap); +retry: pdep = pmap_pde(pmap, va); if (pdep != NULL && (pde = *pdep)) { if (pde & PG_PS) { if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) { - m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) | - (va & PDRMASK)); + if (pa_tryrelock(pmap, pde & PG_PS_FRAME, &pa)) + goto retry; + m = PHYS_TO_VM_PAGE(pa | (va & PDRMASK)); vm_page_hold(m); } } else { pte = *pmap_pde_to_pte(pdep, va); if ((pte & PG_V) && ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) { - m = PHYS_TO_VM_PAGE(pte & PG_FRAME); + if (pa_tryrelock(pmap, pte & PG_FRAME, &pa)) + goto retry; + m = PHYS_TO_VM_PAGE(pa); vm_page_hold(m); } } } - vm_page_unlock_queues(); + if (pa) + PA_UNLOCK(pa); PMAP_UNLOCK(pmap); return (m); } @@ -1371,6 +1444,7 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); pmap->pm_pml4 = (pml4_entry_t *)(KERNBASE + KPML4phys); pmap->pm_root = NULL; + pmap->pm_free = NULL; pmap->pm_active = 0; TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -1408,6 +1482,7 @@ pmap_pinit(pmap_t pmap) pmap->pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | PG_V | PG_RW | PG_A | PG_M; pmap->pm_root = NULL; + pmap->pm_free = NULL; pmap->pm_active = 0; TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -1425,7 +1500,7 @@ pmap_pinit(pmap_t pmap) * race conditions. */ static vm_page_t -_pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags) +_pmap_allocpte(pmap_t pmap, vm_paddr_t pa, vm_pindex_t ptepindex, int flags) { vm_page_t m, pdppg, pdpg; @@ -1440,9 +1515,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if (flags & M_WAITOK) { PMAP_UNLOCK(pmap); - vm_page_unlock_queues(); + PA_UNLOCK(pa); VM_WAIT; - vm_page_lock_queues(); + PA_LOCK(pa); PMAP_LOCK(pmap); } @@ -1484,7 +1559,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t pml4 = &pmap->pm_pml4[pml4index]; if ((*pml4 & PG_V) == 0) { /* Have to allocate a new pdp, recurse */ - if (_pmap_allocpte(pmap, NUPDE + NUPDPE + pml4index, + if (_pmap_allocpte(pmap, pa, NUPDE + NUPDPE + pml4index, flags) == NULL) { --m->wire_count; vm_page_free(m); @@ -1516,7 +1591,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t pml4 = &pmap->pm_pml4[pml4index]; if ((*pml4 & PG_V) == 0) { /* Have to allocate a new pd, recurse */ - if (_pmap_allocpte(pmap, NUPDE + pdpindex, + if (_pmap_allocpte(pmap, pa, NUPDE + pdpindex, flags) == NULL) { --m->wire_count; vm_page_free(m); @@ -1529,7 +1604,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t pdp = &pdp[pdpindex & ((1ul << NPDPEPGSHIFT) - 1)]; if ((*pdp & PG_V) == 0) { /* Have to allocate a new pd, recurse */ - if (_pmap_allocpte(pmap, NUPDE + pdpindex, + if (_pmap_allocpte(pmap, pa, NUPDE + pdpindex, flags) == NULL) { --m->wire_count; vm_page_free(m); @@ -1552,7 +1627,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t } static vm_page_t -pmap_allocpde(pmap_t pmap, vm_offset_t va, int flags) +pmap_allocpde(pmap_t pmap, vm_paddr_t pa, vm_offset_t va, int flags) { vm_pindex_t pdpindex, ptepindex; pdp_entry_t *pdpe; @@ -1571,7 +1646,7 @@ retry: /* Allocate a pd page. */ ptepindex = pmap_pde_pindex(va); pdpindex = ptepindex >> NPDPEPGSHIFT; - pdpg = _pmap_allocpte(pmap, NUPDE + pdpindex, flags); + pdpg = _pmap_allocpte(pmap, pa, NUPDE + pdpindex, flags); if (pdpg == NULL && (flags & M_WAITOK)) goto retry; } @@ -1579,10 +1654,11 @@ retry: } static vm_page_t -pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags) +pmap_allocpte(pmap_t pmap, vm_paddr_t pa, vm_offset_t va, int flags) { vm_pindex_t ptepindex; pd_entry_t *pd; + vm_paddr_t lockedpa; vm_page_t m; KASSERT((flags & (M_NOWAIT | M_WAITOK)) == M_NOWAIT || @@ -1592,6 +1668,7 @@ pmap_allocpte(pmap_t pmap, vm_offset_t v /* * Calculate pagetable page index */ + lockedpa = pa; ptepindex = pmap_pde_pindex(va); retry: /* @@ -1604,6 +1681,8 @@ retry: * normal 4K page. */ if (pd != NULL && (*pd & (PG_PS | PG_V)) == (PG_PS | PG_V)) { + if (pa_tryrelock(pmap, *pd & PG_FRAME, &lockedpa)) + goto retry; if (!pmap_demote_pde(pmap, pd, va)) { /* * Invalidation of the 2MB page mapping may have caused @@ -1612,6 +1691,13 @@ retry: pd = NULL; } } + if (pa) { + if (pa_tryrelock(pmap, pa, &lockedpa)) + goto retry; + } else if (lockedpa) { + PA_UNLOCK(lockedpa); + lockedpa = 0; + } /* * If the page table page is mapped, we just increment the @@ -1625,7 +1711,7 @@ retry: * Here if the pte page isn't mapped, or if it has been * deallocated. */ - m = _pmap_allocpte(pmap, ptepindex, flags); + m = _pmap_allocpte(pmap, pa, ptepindex, flags); if (m == NULL && (flags & M_WAITOK)) goto retry; } @@ -1842,9 +1928,14 @@ pmap_collect(pmap_t locked_pmap, struct vm_offset_t va; vm_page_t m, free; + vm_page_lock_queues(); TAILQ_FOREACH(m, &vpq->pl, pageq) { - if (m->hold_count || m->busy) + if (m->hold_count || m->busy || vm_page_trylock(m) == 0) + continue; + if (m->hold_count || m->busy) { + vm_page_unlock(m); continue; + } TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; pmap = PV_PMAP(pv); @@ -1879,7 +1970,9 @@ pmap_collect(pmap_t locked_pmap, struct if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + vm_page_unlock(m); } + vm_page_unlock_queues(); } @@ -1893,8 +1986,8 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv struct pv_chunk *pc; int idx, field, bit; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); + mtx_lock(&pv_lock); PV_STAT(pv_entry_frees++); PV_STAT(pv_entry_spare++); pv_entry_count--; @@ -1908,6 +2001,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv if (pc->pc_map[0] != PC_FREE0 || pc->pc_map[1] != PC_FREE1 || pc->pc_map[2] != PC_FREE2) { TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); + mtx_unlock(&pv_lock); return; } PV_STAT(pv_entry_spare -= _NPCPV); @@ -1916,7 +2010,8 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv /* entire chunk is free, return it */ m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m->phys_addr); - vm_page_unwire(m, 0); + m->wire_count--; + mtx_unlock(&pv_lock); vm_page_free(m); } @@ -1937,7 +2032,7 @@ get_pv_entry(pmap_t pmap, int try) vm_page_t m; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + mtx_lock(&pv_lock); PV_STAT(pv_entry_allocs++); pv_entry_count++; if (pv_entry_count > pv_entry_high_water) @@ -1965,6 +2060,7 @@ retry: TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } PV_STAT(pv_entry_spare--); + mtx_unlock(&pv_lock); return (pv); } } @@ -1976,6 +2072,7 @@ retry: if (try) { pv_entry_count--; PV_STAT(pc_chunk_tryfail++); + mtx_unlock(&pv_lock); return (NULL); } /* @@ -2006,6 +2103,7 @@ retry: pv = &pc->pc_pventry[0]; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); PV_STAT(pv_entry_spare += _NPCPV - 1); + mtx_unlock(&pv_lock); return (pv); } @@ -2020,7 +2118,6 @@ pmap_pvh_remove(struct md_page *pvh, pma { pv_entry_t pv; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) { if (pmap == PV_PMAP(pv) && va == pv->pv_va) { TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); @@ -2043,7 +2140,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse vm_offset_t va_last; vm_page_t m; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + PA_LOCK_ASSERT(pa, MA_OWNED); KASSERT((pa & PDRMASK) == 0, ("pmap_pv_demote_pde: pa is not 2mpage aligned")); @@ -2081,7 +2178,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offs vm_offset_t va_last; vm_page_t m; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + PA_LOCK_ASSERT(pa, MA_OWNED); KASSERT((pa & PDRMASK) == 0, ("pmap_pv_promote_pde: pa is not 2mpage aligned")); @@ -2127,7 +2224,7 @@ pmap_remove_entry(pmap_t pmap, vm_page_t { struct md_page *pvh; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); pmap_pvh_free(&m->md, pmap, va); if (TAILQ_EMPTY(&m->md.pv_list)) { pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); @@ -2146,7 +2243,7 @@ pmap_insert_entry(pmap_t pmap, vm_offset pv_entry_t pv; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); pv = get_pv_entry(pmap, FALSE); pv->pv_va = va; TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); @@ -2161,7 +2258,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm pv_entry_t pv; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); if (pv_entry_count < pv_entry_high_water && (pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; @@ -2180,7 +2277,7 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse struct md_page *pvh; pv_entry_t pv; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + PA_LOCK_ASSERT(pa, MA_OWNED); if (pv_entry_count < pv_entry_high_water && (pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; @@ -2304,6 +2401,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t pmap_invalidate_page(kernel_pmap, sva); pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE; if (oldpde & PG_MANAGED) { + PA_LOCK_ASSERT(oldpde & PG_PS_FRAME, MA_OWNED); pvh = pa_to_pvh(oldpde & PG_PS_FRAME); pmap_pvh_free(pvh, pmap, sva); eva = sva + NBPDR; @@ -2336,6 +2434,9 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t return (pmap_unuse_pt(pmap, sva, *pmap_pdpe(pmap, sva), free)); } +#define PMAP_REMOVE_LAST 0x1 +#define PMAP_REMOVE_UNLOCKED 0x2 + /* * pmap_remove_pte: do the things to unmap a page in a process */ @@ -2345,8 +2446,10 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t { pt_entry_t oldpte; vm_page_t m; + int ret; PMAP_LOCK_ASSERT(pmap, MA_OWNED); + ret = 0; oldpte = pte_load_clear(ptq); if (oldpte & PG_W) pmap->pm_stats.wired_count -= 1; @@ -2357,15 +2460,23 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t if (oldpte & PG_G) pmap_invalidate_page(kernel_pmap, va); pmap->pm_stats.resident_count -= 1; + if (pmap_unuse_pt(pmap, va, ptepde, free)) + ret = PMAP_REMOVE_LAST; if (oldpte & PG_MANAGED) { m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME); + if (vm_page_trylock(m) == 0) { + PMAP_UNLOCK(pmap); + vm_page_lock(m); + PMAP_LOCK(pmap); + } if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); if (oldpte & PG_A) vm_page_flag_set(m, PG_REFERENCED); pmap_remove_entry(pmap, m, va); + vm_page_unlock(m); } - return (pmap_unuse_pt(pmap, va, ptepde, free)); + return (ret); } /* @@ -2401,6 +2512,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva pd_entry_t ptpaddr, *pde; pt_entry_t *pte; vm_page_t free = NULL; + vm_paddr_t pa; int anyvalid; /* @@ -2409,11 +2521,12 @@ pmap_remove(pmap_t pmap, vm_offset_t sva if (pmap->pm_stats.resident_count == 0) return; + pa = 0; anyvalid = 0; - vm_page_lock_queues(); PMAP_LOCK(pmap); +restart: /* * special handling of removing one page. a very * common operation and easy to short circuit some @@ -2468,6 +2581,10 @@ pmap_remove(pmap_t pmap, vm_offset_t sva * Check for large page. */ if ((ptpaddr & PG_PS) != 0) { + if (pa_tryrelock(pmap, ptpaddr & PG_FRAME, &pa)) { + va_next = sva; + continue; + } /* * Are we removing the entire large page? If not, * demote the mapping and fall through. @@ -2484,8 +2601,12 @@ pmap_remove(pmap_t pmap, vm_offset_t sva } else if (!pmap_demote_pde(pmap, pde, sva)) { /* The large page mapping was destroyed. */ continue; - } else - ptpaddr = *pde; + } + ptpaddr = *pde; + } + if (pa) { + PA_UNLOCK(pa); + pa = 0; } /* @@ -2498,6 +2619,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++, sva += PAGE_SIZE) { + int ret; if (*pte == 0) continue; @@ -2507,14 +2629,20 @@ pmap_remove(pmap_t pmap, vm_offset_t sva */ if ((*pte & PG_G) == 0) anyvalid = 1; - if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free)) + ret = pmap_remove_pte(pmap, pte, sva, ptpaddr, &free); + if (ret & PMAP_REMOVE_LAST) break; + if (ret & PMAP_REMOVE_UNLOCKED) { + va_next = sva + PAGE_SIZE; + goto restart; + } } } + if (pa) + PA_UNLOCK(pa); out: if (anyvalid) pmap_invalidate_all(pmap); - vm_page_unlock_queues(); PMAP_UNLOCK(pmap); pmap_free_zero_pages(free); } @@ -2545,7 +2673,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->flags & PG_FICTITIOUS) == 0, ("pmap_remove_all: page %p is fictitious", m)); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); while ((pv = TAILQ_FIRST(&pvh->pv_list)) != NULL) { va = pv->pv_va; @@ -2646,6 +2774,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv pd_entry_t ptpaddr, *pde; pt_entry_t *pte; int anychanged; + vm_paddr_t pa; if ((prot & VM_PROT_READ) == VM_PROT_NONE) { pmap_remove(pmap, sva, eva); @@ -2656,10 +2785,10 @@ pmap_protect(pmap_t pmap, vm_offset_t sv (VM_PROT_WRITE|VM_PROT_EXECUTE)) return; + pa = 0; anychanged = 0; - - vm_page_lock_queues(); PMAP_LOCK(pmap); +restart: for (; sva < eva; sva = va_next) { pml4e = pmap_pml4e(pmap, sva); @@ -2727,6 +2856,8 @@ retry: continue; if (pbits & PG_MANAGED) { m = NULL; + if (pa_tryrelock(pmap, pbits & PG_FRAME, &pa)) + goto restart; if (pbits & PG_A) { m = PHYS_TO_VM_PAGE(pbits & PG_FRAME); vm_page_flag_set(m, PG_REFERENCED); @@ -2755,9 +2886,10 @@ retry: } } } + if (pa) + PA_UNLOCK(pa); if (anychanged) pmap_invalidate_all(pmap); - vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } @@ -2893,7 +3025,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_paddr_t pa; pd_entry_t *pde; pt_entry_t *pte; - vm_paddr_t opa; + vm_paddr_t opa, lockedpa; pt_entry_t origpte, newpte; vm_page_t mpte, om; boolean_t invlva; @@ -2905,16 +3037,16 @@ pmap_enter(pmap_t pmap, vm_offset_t va, mpte = NULL; - vm_page_lock_queues(); + lockedpa = pa = VM_PAGE_TO_PHYS(m); + PA_LOCK(pa); PMAP_LOCK(pmap); - +restart: /* * In the case that a page table page is not * resident, we are creating it here. */ - if (va < VM_MAXUSER_ADDRESS) { - mpte = pmap_allocpte(pmap, va, M_WAITOK); - } + if (va < VM_MAXUSER_ADDRESS) + mpte = pmap_allocpte(pmap, lockedpa, va, M_WAITOK); pde = pmap_pde(pmap, va); if (pde != NULL && (*pde & PG_V) != 0) { @@ -2924,10 +3056,11 @@ pmap_enter(pmap_t pmap, vm_offset_t va, } else panic("pmap_enter: invalid page directory va=%#lx", va); - pa = VM_PAGE_TO_PHYS(m); om = NULL; origpte = *pte; opa = origpte & PG_FRAME; + if (pa_tryrelock(pmap, opa ? opa : pa, &lockedpa)) + goto restart; /* * Mapping has not changed, must be protection or wiring change. @@ -2965,11 +3098,18 @@ pmap_enter(pmap_t pmap, vm_offset_t va, * handle validating new mapping. */ if (opa) { + origpte = pte_load_clear(pte); if (origpte & PG_W) pmap->pm_stats.wired_count--; if (origpte & PG_MANAGED) { om = PHYS_TO_VM_PAGE(opa); + vm_page_lock_assert(om, MA_OWNED); pmap_remove_entry(pmap, om, va); + if (origpte & PG_A) + vm_page_flag_set(om, PG_REFERENCED); + if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) + vm_page_dirty(om); + om = NULL; } if (mpte != NULL) { mpte->wire_count--; @@ -2977,9 +3117,15 @@ pmap_enter(pmap_t pmap, vm_offset_t va, ("pmap_enter: missing reference to page table page," " va: 0x%lx", va)); } + if (origpte & PG_A || + (origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) + pmap_invalidate_page(pmap, va); + origpte = 0; } else pmap->pm_stats.resident_count++; + if (pa_tryrelock(pmap, pa, &lockedpa)) + goto restart; /* * Enter on the PV list if part of our managed memory. */ @@ -2997,6 +3143,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, pmap->pm_stats.wired_count++; validate: + vm_page_lock_assert(m, MA_OWNED); /* * Now validate mapping with desired protection/wiring. */ @@ -3027,14 +3174,14 @@ validate: origpte = pte_load_store(pte, newpte); if (origpte & PG_A) { if (origpte & PG_MANAGED) - vm_page_flag_set(om, PG_REFERENCED); - if (opa != VM_PAGE_TO_PHYS(m) || ((origpte & - PG_NX) == 0 && (newpte & PG_NX))) + vm_page_flag_set(m, PG_REFERENCED); + if (((origpte & PG_NX) == 0 && + (newpte & PG_NX))) invlva = TRUE; } if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { if ((origpte & PG_MANAGED) != 0) - vm_page_dirty(om); + vm_page_dirty(m); if ((newpte & PG_RW) == 0) invlva = TRUE; } @@ -3052,7 +3199,7 @@ validate: pg_ps_enabled && vm_reserv_level_iffullpop(m) == 0) pmap_promote_pde(pmap, pde, va); - vm_page_unlock_queues(); + PA_UNLOCK(pa); PMAP_UNLOCK(pmap); } @@ -3067,10 +3214,12 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t { pd_entry_t *pde, newpde; vm_page_t free, mpde; + vm_paddr_t pa; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((mpde = pmap_allocpde(pmap, va, M_NOWAIT)) == NULL) { + pa = VM_PAGE_TO_PHYS(m); + if ((mpde = pmap_allocpde(pmap, pa, va, M_NOWAIT)) == NULL) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); @@ -3148,9 +3297,10 @@ pmap_enter_object(pmap_t pmap, vm_offset psize = atop(end - start); mpte = NULL; m = m_start; - PMAP_LOCK(pmap); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { va = start + ptoa(diff); + vm_page_lock(m); + PMAP_LOCK(pmap); if ((va & PDRMASK) == 0 && va + NBPDR <= end && (VM_PAGE_TO_PHYS(m) & PDRMASK) == 0 && pg_ps_enabled && vm_reserv_level_iffullpop(m) == 0 && @@ -3159,9 +3309,10 @@ pmap_enter_object(pmap_t pmap, vm_offset else mpte = pmap_enter_quick_locked(pmap, va, m, prot, mpte); + PMAP_UNLOCK(pmap); + vm_page_unlock(m); m = TAILQ_NEXT(m, listq); } - PMAP_UNLOCK(pmap); } /* @@ -3193,7 +3344,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* @@ -3226,7 +3377,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ mpte = PHYS_TO_VM_PAGE(*ptepa & PG_FRAME); mpte->wire_count++; } else { - mpte = _pmap_allocpte(pmap, ptepindex, + pa = VM_PAGE_TO_PHYS(m); + mpte = _pmap_allocpte(pmap, pa, ptepindex, M_NOWAIT); if (mpte == NULL) return (mpte); @@ -3312,7 +3464,8 @@ pmap_object_init_pt(pmap_t pmap, vm_offs { vm_offset_t va; vm_page_t p, pdpg; - + vm_paddr_t pa; + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); KASSERT(object->type == OBJT_DEVICE, ("pmap_object_init_pt: non-device object")); @@ -3337,14 +3490,16 @@ retry: m[0] = p; if (vm_pager_get_pages(object, m, 1, 0) != VM_PAGER_OK) { - vm_page_lock_queues(); + vm_page_lock(p); vm_page_free(p); - vm_page_unlock_queues(); + vm_page_unlock(p); return; } p = vm_page_lookup(object, pindex); + vm_page_lock(p); vm_page_wakeup(p); + vm_page_unlock(p); } ptepa = VM_PAGE_TO_PHYS(p); @@ -3355,14 +3510,19 @@ retry: PMAP_LOCK(pmap); for (va = addr; va < addr + size; va += NBPDR) { + pa = VM_PAGE_TO_PHYS(p); while ((pdpg = - pmap_allocpde(pmap, va, M_NOWAIT)) == NULL) { + pmap_allocpde(pmap, pa, va, M_NOWAIT)) == NULL) { PMAP_UNLOCK(pmap); + vm_page_lock(p); vm_page_busy(p); + vm_page_unlock(p); VM_OBJECT_UNLOCK(object); VM_WAIT; VM_OBJECT_LOCK(object); + vm_page_lock(p); vm_page_wakeup(p); + vm_page_unlock(p); PMAP_LOCK(pmap); } pde = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pdpg)); @@ -3398,27 +3558,20 @@ pmap_change_wiring(pmap_t pmap, vm_offse { pd_entry_t *pde; pt_entry_t *pte; - boolean_t are_queues_locked; - - are_queues_locked = FALSE; + vm_paddr_t pa; /* * Wiring is not a hardware characteristic so there is no need to * invalidate TLB. */ -retry: + pa = 0; PMAP_LOCK(pmap); +retry: pde = pmap_pde(pmap, va); if ((*pde & PG_PS) != 0) { if (!wired != ((*pde & PG_W) == 0)) { - if (!are_queues_locked) { - are_queues_locked = TRUE; - if (!mtx_trylock(&vm_page_queue_mtx)) { - PMAP_UNLOCK(pmap); - vm_page_lock_queues(); - goto retry; - } - } + if (pa_tryrelock(pmap, *pde & PG_FRAME, &pa)) + goto retry; if (!pmap_demote_pde(pmap, pde, va)) panic("pmap_change_wiring: demotion failed"); } else @@ -3433,8 +3586,8 @@ retry: atomic_clear_long(pte, PG_W); } out: - if (are_queues_locked) - vm_page_unlock_queues(); + if (pa) + PA_UNLOCK(pa); PMAP_UNLOCK(pmap); } @@ -3456,6 +3609,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm vm_offset_t addr; vm_offset_t end_addr = src_addr + len; vm_offset_t va_next; + vm_paddr_t pa; if (dst_addr != src_addr) return; @@ -3463,7 +3617,6 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm if (!pmap_is_current(src_pmap)) return; - vm_page_lock_queues(); if (dst_pmap < src_pmap) { PMAP_LOCK(dst_pmap); PMAP_LOCK(src_pmap); @@ -3507,20 +3660,23 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm continue; if (srcptepaddr & PG_PS) { - dstmpde = pmap_allocpde(dst_pmap, addr, M_NOWAIT); + pa = srcptepaddr & PG_PS_FRAME; + if (PA_TRYLOCK(pa) == 0) + continue; + dstmpde = pmap_allocpde(dst_pmap, pa, addr, M_NOWAIT); if (dstmpde == NULL) break; pde = (pd_entry_t *) PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpde)); pde = &pde[pmap_pde_index(addr)]; if (*pde == 0 && ((srcptepaddr & PG_MANAGED) == 0 || - pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr & - PG_PS_FRAME))) { + pmap_pv_insert_pde(dst_pmap, addr, pa))) { *pde = srcptepaddr & ~PG_W; dst_pmap->pm_stats.resident_count += NBPDR / PAGE_SIZE; } else dstmpde->wire_count--; + PA_UNLOCK(pa); continue; } @@ -3539,7 +3695,13 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm * we only virtual copy managed pages */ if ((ptetemp & PG_MANAGED) != 0) { - dstmpte = pmap_allocpte(dst_pmap, addr, + vm_page_t p; + + pa = ptetemp & PG_FRAME; + if (PA_TRYLOCK(pa) == 0) + break; + p = PHYS_TO_VM_PAGE(pa); + dstmpte = pmap_allocpte(dst_pmap, pa, addr, M_NOWAIT); if (dstmpte == NULL) break; @@ -3548,7 +3710,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm dst_pte = &dst_pte[pmap_pte_index(addr)]; if (*dst_pte == 0 && pmap_try_insert_pv_entry(dst_pmap, addr, - PHYS_TO_VM_PAGE(ptetemp & PG_FRAME))) { + p)) { /* * Clear the wired, modified, and * accessed (referenced) bits @@ -3566,6 +3728,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm pmap_free_zero_pages(free); } } + PA_UNLOCK(pa); if (dstmpte->wire_count >= srcmpte->wire_count) break; } @@ -3573,7 +3736,6 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm src_pte++; } } - vm_page_unlock_queues(); PMAP_UNLOCK(src_pmap); PMAP_UNLOCK(dst_pmap); } @@ -3653,7 +3815,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p if (m->flags & PG_FICTITIOUS) return FALSE; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { if (PV_PMAP(pv) == pmap) { return TRUE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue May 26 07:19:46 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AFAD1065678; Tue, 26 May 2009 07:19:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 286928FC20; Tue, 26 May 2009 07:19:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q7JkdD049855; Tue, 26 May 2009 07:19:46 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q7Jk6G049854; Tue, 26 May 2009 07:19:46 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905260719.n4Q7Jk6G049854@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 07:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192796 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 07:19:46 -0000 Author: kmacy Date: Tue May 26 07:19:45 2009 New Revision: 192796 URL: http://svn.freebsd.org/changeset/base/192796 Log: remove assert that doesn't apply to freebsd Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue May 26 06:24:50 2009 (r192795) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue May 26 07:19:45 2009 (r192796) @@ -561,7 +561,6 @@ zfs_rmnode(znode_t *zp) vfslocked = VFS_LOCK_GIANT(zfsvfs->z_vfs); - ASSERT(ZTOV(zp)->v_count == 0); ASSERT(zp->z_phys->zp_links == 0); /* From owner-svn-src-user@FreeBSD.ORG Tue May 26 08:39:45 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 475D21065670; Tue, 26 May 2009 08:39:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3612F8FC20; Tue, 26 May 2009 08:39:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q8djZD051667; Tue, 26 May 2009 08:39:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q8djUZ051665; Tue, 26 May 2009 08:39:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905260839.n4Q8djUZ051665@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 08:39:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192801 - user/kmacy/releng_7_2_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 08:39:45 -0000 Author: kmacy Date: Tue May 26 08:39:44 2009 New Revision: 192801 URL: http://svn.freebsd.org/changeset/base/192801 Log: simplify vm_pageout_clean by having it always drop the vm page lock - add asserts to help track down a missing unlock Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Tue May 26 08:21:59 2009 (r192800) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Tue May 26 08:39:44 2009 (r192801) @@ -1284,6 +1284,7 @@ vm_pageq_remove_locked(vm_page_t m) void vm_pageq_remove(vm_page_t m) { + mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); vm_page_lock_queues(); vm_pageq_remove_locked(m); vm_page_unlock_queues(); Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 08:21:59 2009 (r192800) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 08:39:44 2009 (r192801) @@ -303,6 +303,7 @@ vm_pageout_clean(m) */ if ((m->hold_count != 0) || ((m->busy != 0) || (m->oflags & VPO_BUSY))) { + vm_page_unlock(m); return 0; } vm_page_io_start(m); @@ -784,6 +785,7 @@ rescan0: addl_page_shortage++; continue; } + if (vm_page_trylock(m) == 0) { VM_OBJECT_UNLOCK(object); addl_page_shortage++; @@ -1040,8 +1042,7 @@ rescan0: if (vm_pageout_clean(m) != 0) { --page_shortage; --maxlaunder; - } else - vm_page_unlock(m); + } vm_page_lock_queues(); unlock_and_continue: VM_OBJECT_UNLOCK(object); @@ -1338,6 +1339,7 @@ vm_pageout_page_stats() m = next; continue; } + vm_page_lock_assert(m, MA_NOTOWNED); if (vm_page_trylock(m) == 0) { VM_OBJECT_UNLOCK(object); m = next; From owner-svn-src-user@FreeBSD.ORG Tue May 26 14:59:07 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58305106566C; Tue, 26 May 2009 14:59:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 27E388FC0C; Tue, 26 May 2009 14:59:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id CD16B46B91; Tue, 26 May 2009 10:59:06 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id AAA968A029; Tue, 26 May 2009 10:59:05 -0400 (EDT) From: John Baldwin To: Kip Macy Date: Tue, 26 May 2009 08:30:36 -0400 User-Agent: KMail/1.9.7 References: <200905222145.n4MLjhm3019802@svn.freebsd.org> In-Reply-To: <200905222145.n4MLjhm3019802@svn.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200905260830.36831.jhb@freebsd.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 26 May 2009 10:59:05 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 14:59:07 -0000 On Friday 22 May 2009 5:45:43 pm Kip Macy wrote: > Author: kmacy > Date: Fri May 22 21:45:43 2009 > New Revision: 192604 > URL: http://svn.freebsd.org/changeset/base/192604 > > Log: > - remove pmc_kthread_mtx > - replace sleep/wakeup on kthread with a condvar If you do not sleep on the kthread/kproc when waiting for a kthread to exit, then you open up a race window. Usually this matters more for any kthreads that live in a module since the race allows the module to be unmapped before the thread is finished executing code from the module resulting in a fatal page fault in the kernel. -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Tue May 26 18:18:03 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13DC910656B0; Tue, 26 May 2009 18:18:03 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by mx1.freebsd.org (Postfix) with ESMTP id 42D068FC1A; Tue, 26 May 2009 18:18:01 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by ey-out-2122.google.com with SMTP id 9so840490eyd.7 for ; Tue, 26 May 2009 11:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=2n9oirohm9R9qTPcAdXkFbwejmL9DkWzmB5ZUYNO/kM=; b=GGSpPSI8AmAu0LUJH5gplIP12QWmoVo7OnFFnzKgQXlpKYmIN56IjRX+Y/2gDeF0sp 4Wm/MjmMP1iw6dKVwMAYA4XNdo9qiFA2AFuOkiNQNcQh0SaPOH2iQbnf6FlC05adUiqw PW/+eQTA8y3Nx9hLaR2nTxVyseRZz9JFuHJ0c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=NEKegYjjd/ORTam79uX3ZW1zwFDeuVyhQFCxaHej6VhkaWkrhwXdmdTioKtAObNJ8K GDC/PBusU9bEeoBSZIucsGdszZjRLAJ2Chc3356D0Q/mdlHhu9qw3dXt0PeqwP8SD54t JhsvLRyYsCTx5Tbafg99Bi+OSjOgY96P67p+s= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.216.35.204 with SMTP id u54mr3315504wea.182.1243361880582; Tue, 26 May 2009 11:18:00 -0700 (PDT) In-Reply-To: <200905260830.36831.jhb@freebsd.org> References: <200905222145.n4MLjhm3019802@svn.freebsd.org> <200905260830.36831.jhb@freebsd.org> Date: Tue, 26 May 2009 11:18:00 -0700 X-Google-Sender-Auth: 355de525109af718 Message-ID: <3c1674c90905261118y282d9b0fn7d54630f507d8363@mail.gmail.com> From: Kip Macy To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 18:18:03 -0000 On Tue, May 26, 2009 at 5:30 AM, John Baldwin wrote: > On Friday 22 May 2009 5:45:43 pm Kip Macy wrote: >> Author: kmacy >> Date: Fri May 22 21:45:43 2009 >> New Revision: 192604 >> URL: http://svn.freebsd.org/changeset/base/192604 >> >> Log: >> =A0 - remove pmc_kthread_mtx >> =A0 - replace sleep/wakeup on kthread with a condvar > > If you do not sleep on the kthread/kproc when waiting for a kthread to > exit, then you open up a race window. =A0Usually this matters more for > any kthreads that live in a module since the race allows the module to > be unmapped before the thread is finished executing code from the module > resulting in a fatal page fault in the kernel. Yes, that is why the kthread explicitly calls cv_signal after clearing the kthread pointer. Thanks, Kip From owner-svn-src-user@FreeBSD.ORG Tue May 26 18:26:33 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4224F106564A; Tue, 26 May 2009 18:26:33 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by mx1.freebsd.org (Postfix) with ESMTP id 726B08FC19; Tue, 26 May 2009 18:26:32 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by ey-out-2122.google.com with SMTP id 9so841708eyd.7 for ; Tue, 26 May 2009 11:26:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=HDg1/o5VSDqIyqiF6qBAGq+wBk3Rf5x0R8W1HfYgVlA=; b=mHO1yqt1dG21/VAWtfTNvHXuRqErNvgrzDbD34KW3lnGOZ4njqQlYp6eAX/YNPF6ng lSYhQzk9mMJmpwF/gcZIolPhkwGCUtP/wr1K6ahta6/P6UnazFeeZTBL1pOQDUX9See8 Zf475k2D56FP9Sr5rFAK8vVsTaL+mw2YIIZFA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=mceLpMBRSrIQgAi1RP7ngCmaTppASP1FmVcYki6eJdw7bSlNc1QGYgfYGUp1PdEu03 LfJ9OmgW8U7XsdrbToLToo5Iplr0vy7L1OIPgYIA1gX4rdBZlx8VpOT+jJrNFlQlp0jk eCSZ9SMTG6DdsEvp7l6A47B5vVY+lWbKA5Cho= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.216.54.194 with SMTP id i44mr3276332wec.93.1243362391139; Tue, 26 May 2009 11:26:31 -0700 (PDT) In-Reply-To: <3bbf2fe10905261124s3fccfe7brb881ece5f8fe339d@mail.gmail.com> References: <200905222145.n4MLjhm3019802@svn.freebsd.org> <3bbf2fe10905261124s3fccfe7brb881ece5f8fe339d@mail.gmail.com> Date: Tue, 26 May 2009 11:26:31 -0700 X-Google-Sender-Auth: 5b1a2a0a4d35f4e0 Message-ID: <3c1674c90905261126g665af4e4j7f89ac92899bb08b@mail.gmail.com> From: Kip Macy To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 18:26:33 -0000 On Tue, May 26, 2009 at 11:24 AM, Attilio Rao wrote: > 2009/5/22 Kip Macy : >> Author: kmacy >> Date: Fri May 22 21:45:43 2009 >> New Revision: 192604 >> URL: http://svn.freebsd.org/changeset/base/192604 >> >> Log: >> =A0- remove pmc_kthread_mtx >> =A0- replace sleep/wakeup on kthread with a condvar > >> @@ -341,14 +335,12 @@ pmclog_loop(void *arg) >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mtx_lock_spin(&pmc_bufferlist_mtx); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TAILQ_INSERT_HEAD(&pmc_bufferlist, lb, pl= b_next); >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock_spin(&pmc_bufferlist_mtx); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0lb =3D NULL; >> =A0 =A0 =A0 =A0} > > Is this mtx_unlock_spin() removal intended to happen? > If not, it does introduce a LO between pmc_bufferlist_mtx and po_mtx. > >> @@ -591,10 +582,10 @@ pmclog_configure_log(struct pmc_mdep *md >> >> =A0error: >> =A0 =A0 =A0 =A0/* shutdown the thread */ >> - =A0 =A0 =A0 mtx_lock(&pmc_kthread_mtx); >> + =A0 =A0 =A0 mtx_lock_spin(&po->po_mtx); >> =A0 =A0 =A0 =A0if (po->po_kthread) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pmclog_stop_kthread(po); >> - =A0 =A0 =A0 mtx_unlock(&pmc_kthread_mtx); >> + =A0 =A0 =A0 mtx_lock_spin(&po->po_mtx); > > Shouldn't this be mtx_unlock_spin() ? > Oh wow :( Thanks, Kip From owner-svn-src-user@FreeBSD.ORG Tue May 26 18:30:18 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45E851065686; Tue, 26 May 2009 18:30:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 353A18FC21; Tue, 26 May 2009 18:30:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QIUIAN068309; Tue, 26 May 2009 18:30:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QIUIXK068308; Tue, 26 May 2009 18:30:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905261830.n4QIUIXK068308@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 18:30:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192826 - user/kmacy/releng_7_2_fcs/sys/dev/hwpmc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 18:30:18 -0000 Author: kmacy Date: Tue May 26 18:30:17 2009 New Revision: 192826 URL: http://svn.freebsd.org/changeset/base/192826 Log: fix inconsistent locking state (partly) pointed out by: attilio@ Modified: user/kmacy/releng_7_2_fcs/sys/dev/hwpmc/hwpmc_logging.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/hwpmc/hwpmc_logging.c Tue May 26 17:57:37 2009 (r192825) +++ user/kmacy/releng_7_2_fcs/sys/dev/hwpmc/hwpmc_logging.c Tue May 26 18:30:17 2009 (r192826) @@ -269,10 +269,8 @@ pmclog_loop(void *arg) mtx_lock_spin(&po->po_mtx); for (;;) { /* check if we've been asked to exit */ - if ((po->po_flags & PMC_PO_OWNS_LOGFILE) == 0) { - mtx_unlock_spin(&po->po_mtx); + if ((po->po_flags & PMC_PO_OWNS_LOGFILE) == 0) break; - } if (lb == NULL) { /* look for a fresh buffer to write */ if ((lb = TAILQ_FIRST(&po->po_logbuffers)) == NULL) { @@ -324,7 +322,7 @@ pmclog_loop(void *arg) po->po_error = error; /* save for flush log */ PMCDBG(LOG,WRI,2, "po=%p error=%d", po, error); - + mtx_lock_spin(&po->po_mtx); break; } @@ -337,7 +335,6 @@ pmclog_loop(void *arg) lb = NULL; mtx_lock_spin(&po->po_mtx); } - mtx_lock_spin(&po->po_mtx); po->po_kthread = NULL; cv_signal(&po->po_kthread_cv); mtx_unlock_spin(&po->po_mtx); @@ -585,7 +582,7 @@ pmclog_configure_log(struct pmc_mdep *md mtx_lock_spin(&po->po_mtx); if (po->po_kthread) pmclog_stop_kthread(po); - mtx_lock_spin(&po->po_mtx); + mtx_unlock_spin(&po->po_mtx); KASSERT(po->po_kthread == NULL, ("[pmc,%d] po=%p kthread not stopped", __LINE__, po)); From owner-svn-src-user@FreeBSD.ORG Tue May 26 18:38:08 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DD6B106567A; Tue, 26 May 2009 18:38:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4C28FC1B; Tue, 26 May 2009 18:38:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 13D5546B82; Tue, 26 May 2009 14:38:08 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id E45FA8A02B; Tue, 26 May 2009 14:38:06 -0400 (EDT) From: John Baldwin To: Kip Macy Date: Tue, 26 May 2009 14:37:48 -0400 User-Agent: KMail/1.9.7 References: <200905222145.n4MLjhm3019802@svn.freebsd.org> <200905260830.36831.jhb@freebsd.org> <3c1674c90905261118y282d9b0fn7d54630f507d8363@mail.gmail.com> In-Reply-To: <3c1674c90905261118y282d9b0fn7d54630f507d8363@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200905261437.49148.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 26 May 2009 14:38:06 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 18:38:09 -0000 On Tuesday 26 May 2009 2:18:00 pm Kip Macy wrote: > On Tue, May 26, 2009 at 5:30 AM, John Baldwin wrote: > > On Friday 22 May 2009 5:45:43 pm Kip Macy wrote: > >> Author: kmacy > >> Date: Fri May 22 21:45:43 2009 > >> New Revision: 192604 > >> URL: http://svn.freebsd.org/changeset/base/192604 > >> > >> Log: > >> =A0 - remove pmc_kthread_mtx > >> =A0 - replace sleep/wakeup on kthread with a condvar > > > > If you do not sleep on the kthread/kproc when waiting for a kthread to > > exit, then you open up a race window. =A0Usually this matters more for > > any kthreads that live in a module since the race allows the module to > > be unmapped before the thread is finished executing code from the module > > resulting in a fatal page fault in the kernel. >=20 >=20 > Yes, that is why the kthread explicitly calls cv_signal after clearing > the kthread pointer. Umm, that doesn't help. Your kthread's main routine is "physically" locate= d=20 in your kld. It needs to get into the text of kthread_exit() before it is= =20 safe for your module to unload, and so you have to sleep on the kthread/kpr= oc=20 pointer to wait for the wakeup in kthread_exit() to fire. You could have=20 easily used msleep_spin() for this w/o hacking up condvar's to support spin= =20 locks too, FWIW. =2D-=20 John Baldwin From owner-svn-src-user@FreeBSD.ORG Tue May 26 18:41:05 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF0581065687; Tue, 26 May 2009 18:41:05 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.25]) by mx1.freebsd.org (Postfix) with ESMTP id 0A0808FC1A; Tue, 26 May 2009 18:41:04 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by ey-out-2122.google.com with SMTP id 9so843622eyd.7 for ; Tue, 26 May 2009 11:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=octLtWgQFkhmpCfZHYZ+KGj8Xi/bZZZ6H9c/0reGKfk=; b=dn4cgpUPraxmMFIR0R/r80DeZSm8d8fupSG2jNsidFvkrv2+EHBfIyI6eMLiFJlk8e iQ3IHIVSQLjNCwAo/MLaxqzV+koLywS2MjR1JoOXKWbLQWklmsc/2tXQVbt2jSrV/A67 SRqzdFDOG3wIy7s2hiZktKEO/UvkUzkAB5tUg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=qNk9e/XcngFDnT4rDTmn6G9yVzprihDAhlNNyNVxdsk4XCwcTiO9FZousiozjq0ZMG Uv/31Z8JPSe10iown4QBYfgmTUW1uAndjqSvNZ45+/B8gTLTG3YssH5qzrLXEIFZIXDO 1sjxKDL4iV1LVZUlscwK42UnqtcI6956YB5Fs= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.216.9.66 with SMTP id 44mr3225917wes.73.1243363263915; Tue, 26 May 2009 11:41:03 -0700 (PDT) In-Reply-To: <200905261437.49148.jhb@freebsd.org> References: <200905222145.n4MLjhm3019802@svn.freebsd.org> <200905260830.36831.jhb@freebsd.org> <3c1674c90905261118y282d9b0fn7d54630f507d8363@mail.gmail.com> <200905261437.49148.jhb@freebsd.org> Date: Tue, 26 May 2009 11:41:03 -0700 X-Google-Sender-Auth: b215c9230f108ef7 Message-ID: <3c1674c90905261141n44bc7c24h5b82a2e25b84f1eb@mail.gmail.com> From: Kip Macy To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 18:41:06 -0000 ter. > > Umm, that doesn't help. =A0Your kthread's main routine is "physically" lo= cated > in your kld. =A0It needs to get into the text of kthread_exit() before it= is > safe for your module to unload, and so you have to sleep on the kthread/k= proc > pointer to wait for the wakeup in kthread_exit() to fire. =A0You could ha= ve > easily used msleep_spin() for this w/o hacking up condvar's to support sp= in > locks too, FWIW. > Good point. Which gets to my next question. Why is condvar preferred to msleep / wakeup for everything BUT spin locks? This seems a bit hackish. Thanks, Kip From owner-svn-src-user@FreeBSD.ORG Tue May 26 18:45:40 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B2D91065716 for ; Tue, 26 May 2009 18:45:40 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f168.google.com (mail-fx0-f168.google.com [209.85.220.168]) by mx1.freebsd.org (Postfix) with ESMTP id 2AC378FC1D for ; Tue, 26 May 2009 18:45:40 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by fxm12 with SMTP id 12so4162500fxm.43 for ; Tue, 26 May 2009 11:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=bYyOj/cGnN7arB8bEWFQLFqY/d9Rj4XL9JsPR38opOk=; b=tskItpHDPtEK9CwdroyvSNPsOwv72dSgA57UDzdCjoqVRiAm/HcZirHIVcxTAyM8lW tw5jyIw/GDHgT28pCVnY18ww8s0ZNLaVapE1TdATnmv2XhqNb05dNCNAUW3FLRdrf+Tc /gRXSxGlCIGGQdJWarHI770cgJIDTXYBCh2KI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=T+mM3Ozrg/p7hPZTmuWtouYGcniLvAHibgRt9GSJpb2ro4uKhAQZUaK4t7mr02U1xq UvS4IVnyJm6SS4aBgIOJYJLaoYFwdzHxzoEzSRUsvLgOaSI4UplcirXEH6Rhzi6eHTvC 2w7mp9IXhtJO6Q7A4XWzTaaW4duDJm0PEhJR0= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.103.207 with SMTP id l15mr4686327fao.2.1243362242952; Tue, 26 May 2009 11:24:02 -0700 (PDT) In-Reply-To: <200905222145.n4MLjhm3019802@svn.freebsd.org> References: <200905222145.n4MLjhm3019802@svn.freebsd.org> Date: Tue, 26 May 2009 20:24:02 +0200 X-Google-Sender-Auth: 39966acf4aa273e5 Message-ID: <3bbf2fe10905261124s3fccfe7brb881ece5f8fe339d@mail.gmail.com> From: Attilio Rao To: Kip Macy Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 18:45:41 -0000 2009/5/22 Kip Macy : > Author: kmacy > Date: Fri May 22 21:45:43 2009 > New Revision: 192604 > URL: http://svn.freebsd.org/changeset/base/192604 > > Log: > - remove pmc_kthread_mtx > - replace sleep/wakeup on kthread with a condvar > @@ -341,14 +335,12 @@ pmclog_loop(void *arg) > > mtx_lock_spin(&pmc_bufferlist_mtx); > TAILQ_INSERT_HEAD(&pmc_bufferlist, lb, plb_next); > - mtx_unlock_spin(&pmc_bufferlist_mtx); > > lb = NULL; > } Is this mtx_unlock_spin() removal intended to happen? If not, it does introduce a LO between pmc_bufferlist_mtx and po_mtx. > @@ -591,10 +582,10 @@ pmclog_configure_log(struct pmc_mdep *md > > error: > /* shutdown the thread */ > - mtx_lock(&pmc_kthread_mtx); > + mtx_lock_spin(&po->po_mtx); > if (po->po_kthread) > pmclog_stop_kthread(po); > - mtx_unlock(&pmc_kthread_mtx); > + mtx_lock_spin(&po->po_mtx); Shouldn't this be mtx_unlock_spin() ? The other part looks good. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-user@FreeBSD.ORG Tue May 26 18:52:11 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB8E61065673; Tue, 26 May 2009 18:52:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id BDF0B8FC15; Tue, 26 May 2009 18:52:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 734AB46B46; Tue, 26 May 2009 14:52:11 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 55D998A028; Tue, 26 May 2009 14:52:10 -0400 (EDT) From: John Baldwin To: Kip Macy Date: Tue, 26 May 2009 14:49:51 -0400 User-Agent: KMail/1.9.7 References: <200905222145.n4MLjhm3019802@svn.freebsd.org> <200905261437.49148.jhb@freebsd.org> <3c1674c90905261141n44bc7c24h5b82a2e25b84f1eb@mail.gmail.com> In-Reply-To: <3c1674c90905261141n44bc7c24h5b82a2e25b84f1eb@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200905261449.52153.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 26 May 2009 14:52:10 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 18:52:12 -0000 On Tuesday 26 May 2009 2:41:03 pm Kip Macy wrote: > ter. > > > > Umm, that doesn't help. =A0Your kthread's main routine is "physically"= =20 located > > in your kld. =A0It needs to get into the text of kthread_exit() before = it is > > safe for your module to unload, and so you have to sleep on the=20 kthread/kproc > > pointer to wait for the wakeup in kthread_exit() to fire. =A0You could = have > > easily used msleep_spin() for this w/o hacking up condvar's to support= =20 spin > > locks too, FWIW. > > >=20 > Good point. >=20 > Which gets to my next question. Why is condvar preferred to msleep / > wakeup for everything BUT spin locks? This seems a bit hackish. Because too many people use spin locks. :) They are really only suitable f= or=20 a limited set of problems, and many of those are for scheduler internals th= at=20 don't use higher level primitives like sleep and wakeup. I can buy that pm= c=20 might be low-level enough to warrant use of a spin lock if you are=20 interfacing with the NMI handler, but in that case I think msleep_spin() is= =20 probably sufficient for what you need. =2D-=20 John Baldwin From owner-svn-src-user@FreeBSD.ORG Tue May 26 19:02:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E894C1065716; Tue, 26 May 2009 19:02:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D89F68FC26; Tue, 26 May 2009 19:02:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QJ2Kh7069969; Tue, 26 May 2009 19:02:20 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QJ2Kdt069968; Tue, 26 May 2009 19:02:20 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905261902.n4QJ2Kdt069968@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 19:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192842 - user/kmacy/releng_7_2_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 19:02:21 -0000 Author: kmacy Date: Tue May 26 19:02:20 2009 New Revision: 192842 URL: http://svn.freebsd.org/changeset/base/192842 Log: we don't need to hold the page lock while calling vm_page_busy (just the object lock) Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_object.c Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_object.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_object.c Tue May 26 19:01:31 2009 (r192841) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_object.c Tue May 26 19:02:20 2009 (r192842) @@ -1416,8 +1416,8 @@ retry: } vm_page_rename(m, new_object, idx); /* page automatically made dirty by rename and cache handled */ - vm_page_busy(m); vm_page_unlock(m); + vm_page_busy(m); } if (orig_object->type == OBJT_SWAP) { /* From owner-svn-src-user@FreeBSD.ORG Tue May 26 19:03:01 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 655BC10656AD; Tue, 26 May 2009 19:03:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 524678FC13; Tue, 26 May 2009 19:03:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QJ318E070107; Tue, 26 May 2009 19:03:01 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QJ31B0070106; Tue, 26 May 2009 19:03:01 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905261903.n4QJ31B0070106@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 19:03:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192845 - user/kmacy/releng_7_2_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 19:03:03 -0000 Author: kmacy Date: Tue May 26 19:03:01 2009 New Revision: 192845 URL: http://svn.freebsd.org/changeset/base/192845 Log: call vm_pageq_remove_locked as we know we're already holding the pageq lock Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Tue May 26 19:02:51 2009 (r192844) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Tue May 26 19:03:01 2009 (r192845) @@ -1334,7 +1334,7 @@ vm_page_activate_locked(vm_page_t m) vm_page_lock_assert(m, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED); if (VM_PAGE_GETKNOWNQUEUE2(m) != PQ_ACTIVE) { - vm_pageq_remove(m); + vm_pageq_remove_locked(m); if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) { if (m->act_count < ACT_INIT) m->act_count = ACT_INIT; From owner-svn-src-user@FreeBSD.ORG Tue May 26 19:39:10 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3461010656BF; Tue, 26 May 2009 19:39:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07CD78FC20; Tue, 26 May 2009 19:39:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QJd9Ah071369; Tue, 26 May 2009 19:39:09 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QJd93H071365; Tue, 26 May 2009 19:39:09 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905261939.n4QJd93H071365@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 19:39:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192847 - user/kmacy/releng_7_2_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 19:39:12 -0000 Author: kmacy Date: Tue May 26 19:39:09 2009 New Revision: 192847 URL: http://svn.freebsd.org/changeset/base/192847 Log: add vm_page_cache_locked interface to avoid recursive acquisition of the page queue mutex Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Tue May 26 19:06:56 2009 (r192846) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Tue May 26 19:39:09 2009 (r192847) @@ -1660,8 +1660,8 @@ vm_page_try_to_free(vm_page_t m) * * This routine may not block. */ -void -vm_page_cache(vm_page_t m) +static void +_vm_page_cache(vm_page_t m, int locked) { vm_object_t object; vm_page_t root; @@ -1694,8 +1694,10 @@ vm_page_cache(vm_page_t m) /* * Remove the page from the paging queues. */ - vm_pageq_remove(m); - + if (locked) + vm_pageq_remove_locked(m); + else + vm_pageq_remove(m); /* * Remove the page from the object's collection of resident * pages. @@ -1764,6 +1766,20 @@ vm_page_cache(vm_page_t m) } } +void +vm_page_cache(vm_page_t m) +{ + + _vm_page_cache(m, 0); +} + +void +vm_page_cache_locked(vm_page_t m) +{ + + _vm_page_cache(m, 1); +} + /* * vm_page_dontneed * Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h Tue May 26 19:06:56 2009 (r192846) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h Tue May 26 19:39:09 2009 (r192847) @@ -325,6 +325,7 @@ void vm_page_activate_locked (vm_page_t) vm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); void vm_page_cache (register vm_page_t); +void vm_page_cache_locked (register vm_page_t); void vm_page_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t); void vm_page_cache_remove(vm_page_t); void vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t); Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 19:06:56 2009 (r192846) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 19:39:09 2009 (r192847) @@ -878,7 +878,7 @@ rescan0: * Clean pages can be placed onto the cache queue. * This effectively frees them. */ - vm_page_cache(m); + vm_page_cache_locked(m); --page_shortage; } else if ((m->flags & PG_WINATCFLS) == 0 && pass == 0) { /* @@ -1157,7 +1157,7 @@ unlock_and_continue: if (object->ref_count == 0) { pmap_remove_all(m); if (m->dirty == 0) - vm_page_cache(m); + vm_page_cache_locked(m); else vm_page_deactivate_locked(m); } else { From owner-svn-src-user@FreeBSD.ORG Tue May 26 20:14:53 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AB3E106564A; Tue, 26 May 2009 20:14:53 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F4778FC14; Tue, 26 May 2009 20:14:53 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QKEqgQ072386; Tue, 26 May 2009 20:14:52 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QKEqiC072383; Tue, 26 May 2009 20:14:52 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905262014.n4QKEqiC072383@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 20:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192851 - user/kmacy/releng_7_2_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:14:53 -0000 Author: kmacy Date: Tue May 26 20:14:52 2009 New Revision: 192851 URL: http://svn.freebsd.org/changeset/base/192851 Log: further addition of _locked routines to avoid recursion on the page queue mutex Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Tue May 26 20:13:17 2009 (r192850) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Tue May 26 20:14:52 2009 (r192851) @@ -148,7 +148,9 @@ TUNABLE_INT("vm.boot_pages", &boot_pages SYSCTL_INT(_vm, OID_AUTO, boot_pages, CTLFLAG_RD, &boot_pages, 0, "number of pages allocated for bootstrapping the VM system"); -static void vm_page_enqueue(int queue, vm_page_t m); +static void _vm_page_enqueue(int queue, vm_page_t m, int locked); +static void _vm_page_free_toq(vm_page_t m, int locked); +static void _vm_pageq_remove(vm_page_t m, int locked); /* * vm_set_page_size: @@ -517,6 +519,14 @@ vm_page_free(vm_page_t m) vm_page_free_toq(m); } +void +vm_page_free_locked(vm_page_t m) +{ + + m->flags &= ~PG_ZERO; + _vm_page_free_toq(m, 1); +} + /* * vm_page_free_zero: * @@ -530,6 +540,14 @@ vm_page_free_zero(vm_page_t m) vm_page_free_toq(m); } +void +vm_page_free_zero_locked(vm_page_t m) +{ + + m->flags |= PG_ZERO; + _vm_page_free_toq(m, 1); +} + /* * vm_page_sleep: * @@ -1266,13 +1284,15 @@ vm_page_requeue(vm_page_t m) * The queue containing the given page must be locked. * This routine may not block. */ -void -vm_pageq_remove_locked(vm_page_t m) +static __inline void +_vm_pageq_remove(vm_page_t m, int locked) { int queue; struct vpgqueues *pq; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if (locked == 0) + vm_page_lock_queues(); + queue = VM_PAGE_GETQUEUE(m); if (queue != PQ_NONE) { VM_PAGE_SETQUEUE2(m, PQ_NONE); @@ -1280,14 +1300,23 @@ vm_pageq_remove_locked(vm_page_t m) TAILQ_REMOVE(&pq->pl, m, pageq); (*pq->cnt)--; } + if (locked == 0) + vm_page_unlock_queues(); } + +void +vm_pageq_remove_locked(vm_page_t m) +{ + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + _vm_pageq_remove(m, 1); +} + void vm_pageq_remove(vm_page_t m) { mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); - vm_page_lock_queues(); - vm_pageq_remove_locked(m); - vm_page_unlock_queues(); + _vm_pageq_remove(m, 0); } /* @@ -1298,23 +1327,26 @@ vm_pageq_remove(vm_page_t m) * The page queues must be locked. */ static void -vm_page_enqueue_locked(int queue, vm_page_t m) +_vm_page_enqueue(int queue, vm_page_t m, int locked) { struct vpgqueues *vpq; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if (locked == 0) { + mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); + vm_page_lock_queues(); + } +#ifdef INVARIANTS + /* avoid dangling else */ + else + mtx_assert(&vm_page_queue_mtx, MA_OWNED); +#endif + vpq = &vm_page_queues[queue]; VM_PAGE_SETQUEUE2(m, queue); TAILQ_INSERT_TAIL(&vpq->pl, m, pageq); ++*vpq->cnt; -} - -static void -vm_page_enqueue(int queue, vm_page_t m) -{ - vm_page_lock_queues(); - vm_page_enqueue_locked(queue, m); - vm_page_unlock_queues(); + if (locked == 0) + vm_page_unlock_queues(); } /* @@ -1338,7 +1370,7 @@ vm_page_activate_locked(vm_page_t m) if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) { if (m->act_count < ACT_INIT) m->act_count = ACT_INIT; - vm_page_enqueue(PQ_ACTIVE, m); + _vm_page_enqueue(PQ_ACTIVE, m, 1); } } else { if (m->act_count < ACT_INIT) @@ -1399,8 +1431,8 @@ vm_page_free_wakeup(void) * This routine may not block. */ -void -vm_page_free_toq(vm_page_t m) +static void +_vm_page_free_toq(vm_page_t m, int locked) { PCPU_INC(cnt.v_tfree); @@ -1440,7 +1472,7 @@ vm_page_free_toq(vm_page_t m) * return, otherwise delay object association removal. */ if ((m->flags & PG_FICTITIOUS) != 0) { - vm_pageq_remove(m); + _vm_pageq_remove(m, locked); return; } @@ -1449,12 +1481,10 @@ vm_page_free_toq(vm_page_t m) if (m->hold_count != 0) { m->flags &= ~PG_ZERO; - vm_page_lock_queues(); - vm_pageq_remove_locked(m); - vm_page_enqueue_locked(PQ_HOLD, m); - vm_page_unlock_queues(); + _vm_pageq_remove(m, locked); + _vm_page_enqueue(PQ_HOLD, m, locked); } else { - vm_pageq_remove(m); + _vm_pageq_remove(m, locked); mtx_lock(&vm_page_queue_free_mtx); m->flags |= PG_FREE; cnt.v_free_count++; @@ -1473,6 +1503,20 @@ vm_page_free_toq(vm_page_t m) } } +void +vm_page_free_toq(vm_page_t m) +{ + + _vm_page_free_toq(m, 0); +} + +void +vm_page_free_toq_locked(vm_page_t m) +{ + + _vm_page_free_toq(m, 1); +} + /* * vm_page_wire: * @@ -1546,10 +1590,10 @@ vm_page_unwire(vm_page_t m, int activate if (m->flags & PG_UNMANAGED) { ; } else if (activate) - vm_page_enqueue(PQ_ACTIVE, m); + _vm_page_enqueue(PQ_ACTIVE, m, 0); else { vm_page_flag_clear(m, PG_WINATCFLS); - vm_page_enqueue(PQ_INACTIVE, m); + _vm_page_enqueue(PQ_INACTIVE, m, 0); } } } else { @@ -1694,10 +1738,7 @@ _vm_page_cache(vm_page_t m, int locked) /* * Remove the page from the paging queues. */ - if (locked) - vm_pageq_remove_locked(m); - else - vm_pageq_remove(m); + _vm_pageq_remove(m, locked); /* * Remove the page from the object's collection of resident * pages. Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h Tue May 26 20:13:17 2009 (r192850) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_page.h Tue May 26 20:14:52 2009 (r192851) @@ -314,6 +314,8 @@ void vm_page_hold(vm_page_t mem); void vm_page_unhold(vm_page_t mem); void vm_page_free(vm_page_t m); void vm_page_free_zero(vm_page_t m); +void vm_page_free_locked(vm_page_t m); +void vm_page_free_zero_locked(vm_page_t m); void vm_page_dirty(vm_page_t m); void vm_page_wakeup(vm_page_t m); @@ -353,6 +355,7 @@ void vm_page_test_dirty (vm_page_t); int vm_page_bits (int, int); void vm_page_zero_invalid(vm_page_t m, boolean_t setvalid); void vm_page_free_toq(vm_page_t m); +void vm_page_free_toq_locked(vm_page_t m); void vm_page_zero_idle_wakeup(void); void vm_page_cowfault (vm_page_t); int vm_page_cowsetup(vm_page_t); Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 20:13:17 2009 (r192850) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 20:14:52 2009 (r192851) @@ -870,7 +870,7 @@ rescan0: /* * Invalid pages can be easily freed */ - vm_page_free(m); + vm_page_free_locked(m); cnt.v_dfree++; --page_shortage; } else if (m->dirty == 0) { From owner-svn-src-user@FreeBSD.ORG Tue May 26 20:41:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 785C91065670; Tue, 26 May 2009 20:41:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67E8C8FC1D; Tue, 26 May 2009 20:41:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QKfbDZ073089; Tue, 26 May 2009 20:41:37 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QKfbuT073088; Tue, 26 May 2009 20:41:37 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905262041.n4QKfbuT073088@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 20:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192854 - user/kmacy/releng_7_2_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:41:38 -0000 Author: kmacy Date: Tue May 26 20:41:37 2009 New Revision: 192854 URL: http://svn.freebsd.org/changeset/base/192854 Log: - add addition page lock not owned asserts - fix misconversion of page queue lock to page lock in vm_pageout_scan Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 20:28:22 2009 (r192853) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 20:41:37 2009 (r192854) @@ -785,7 +785,7 @@ rescan0: addl_page_shortage++; continue; } - + vm_page_lock_assert(m, MA_NOTOWNED); if (vm_page_trylock(m) == 0) { VM_OBJECT_UNLOCK(object); addl_page_shortage++; @@ -1043,16 +1043,18 @@ rescan0: --page_shortage; --maxlaunder; } + vm_page_lock_assert(m, MA_NOTOWNED); vm_page_lock_queues(); unlock_and_continue: VM_OBJECT_UNLOCK(object); if (mp != NULL) { + vm_page_unlock_queues(); if (vp != NULL) vput(vp); VFS_UNLOCK_GIANT(vfslocked); vm_object_deallocate(object); vn_finished_write(mp); - vm_page_lock(m); + vm_page_lock_queues(); } next = TAILQ_NEXT(&marker, pageq); TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl, From owner-svn-src-user@FreeBSD.ORG Tue May 26 21:34:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA63D10656BA; Tue, 26 May 2009 21:34:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA02F8FC12; Tue, 26 May 2009 21:34:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QLYhuV074389; Tue, 26 May 2009 21:34:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QLYhbc074388; Tue, 26 May 2009 21:34:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905262134.n4QLYhbc074388@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 21:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192858 - user/kmacy/releng_7_2_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 21:34:44 -0000 Author: kmacy Date: Tue May 26 21:34:43 2009 New Revision: 192858 URL: http://svn.freebsd.org/changeset/base/192858 Log: - remove write and start I/O on the current page - move assert down below goto target Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 21:20:42 2009 (r192857) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 21:34:43 2009 (r192858) @@ -304,7 +304,7 @@ vm_pageout_clean(m) if ((m->hold_count != 0) || ((m->busy != 0) || (m->oflags & VPO_BUSY))) { vm_page_unlock(m); - return 0; + return (0); } vm_page_io_start(m); pmap_remove_write(m); @@ -362,8 +362,8 @@ more: vm_page_unlock(p); break; } - vm_page_io_start(m); - pmap_remove_write(m); + vm_page_io_start(p); + pmap_remove_write(p); vm_page_unlock(p); mc[--page_base] = p; ++pageout_count; @@ -394,8 +394,8 @@ more: vm_page_unlock(p); break; } - vm_page_io_start(m); - pmap_remove_write(m); + vm_page_io_start(p); + pmap_remove_write(p); vm_page_unlock(p); mc[page_base + pageout_count] = p; ++pageout_count; @@ -987,8 +987,8 @@ rescan0: goto unlock_and_continue; } VM_OBJECT_LOCK(object); - vm_page_lock(m); vm_page_lock_queues(); + vm_page_lock(m); /* * The page might have been moved to another * queue during potential blocking in vget() @@ -1043,9 +1043,9 @@ rescan0: --page_shortage; --maxlaunder; } - vm_page_lock_assert(m, MA_NOTOWNED); vm_page_lock_queues(); unlock_and_continue: + vm_page_lock_assert(m, MA_NOTOWNED); VM_OBJECT_UNLOCK(object); if (mp != NULL) { vm_page_unlock_queues(); From owner-svn-src-user@FreeBSD.ORG Tue May 26 22:34:13 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C677106567B; Tue, 26 May 2009 22:34:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AE9A8FC0A; Tue, 26 May 2009 22:34:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QMYDo0075958; Tue, 26 May 2009 22:34:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QMYDGR075957; Tue, 26 May 2009 22:34:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905262234.n4QMYDGR075957@svn.freebsd.org> From: Kip Macy Date: Tue, 26 May 2009 22:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192863 - user/kmacy/releng_7_2_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 22:34:13 -0000 Author: kmacy Date: Tue May 26 22:34:13 2009 New Revision: 192863 URL: http://svn.freebsd.org/changeset/base/192863 Log: - drop the more heavily contended queue mutex first - assert that the page lock is not held at the end of the loop when maxlaunder > 0 - drop the page lock before moving to the next page if none of the condition are met Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 22:33:10 2009 (r192862) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_pageout.c Tue May 26 22:34:13 2009 (r192863) @@ -961,8 +961,8 @@ rescan0: * of time. */ if (object->type == OBJT_VNODE) { - vm_page_unlock(m); vm_page_unlock_queues(); + vm_page_unlock(m); vp = object->handle; if (vp->v_type == VREG && vn_start_write(vp, &mp, V_NOWAIT) != 0) { @@ -1059,8 +1059,10 @@ unlock_and_continue: next = TAILQ_NEXT(&marker, pageq); TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl, &marker, pageq); + vm_page_lock_assert(m, MA_NOTOWNED); continue; } + vm_page_unlock(m); VM_OBJECT_UNLOCK(object); } From owner-svn-src-user@FreeBSD.ORG Wed May 27 00:24:54 2009 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 327CC106566B; Wed, 27 May 2009 00:24:54 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id E3DA48FC20; Wed, 27 May 2009 00:24:53 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4R0MVcw088429; Tue, 26 May 2009 18:22:31 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 26 May 2009 18:22:51 -0600 (MDT) Message-Id: <20090526.182251.-409398290.imp@bsdimp.com> To: kmacy@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <3c1674c90905261118y282d9b0fn7d54630f507d8363@mail.gmail.com> References: <200905222145.n4MLjhm3019802@svn.freebsd.org> <200905260830.36831.jhb@freebsd.org> <3c1674c90905261118y282d9b0fn7d54630f507d8363@mail.gmail.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 00:24:54 -0000 In message: <3c1674c90905261118y282d9b0fn7d54630f507d8363@mail.gmail.co= m> Kip Macy writes: : On Tue, May 26, 2009 at 5:30 AM, John Baldwin wrote= : : > On Friday 22 May 2009 5:45:43 pm Kip Macy wrote: : >> Author: kmacy : >> Date: Fri May 22 21:45:43 2009 : >> New Revision: 192604 : >> URL: http://svn.freebsd.org/changeset/base/192604 : >> : >> Log: : >> =A0 - remove pmc_kthread_mtx : >> =A0 - replace sleep/wakeup on kthread with a condvar : > : > If you do not sleep on the kthread/kproc when waiting for a kthread= to : > exit, then you open up a race window. =A0Usually this matters more = for : > any kthreads that live in a module since the race allows the module= to : > be unmapped before the thread is finished executing code from the m= odule : > resulting in a fatal page fault in the kernel. : = : = : Yes, that is why the kthread explicitly calls cv_signal after clearin= g : the kthread pointer. The race here is that any kthread is still executing code after the module is unloaded. This fix doesn't solve that race, since the only way to solve it is to have the scheduler tell you when the thread is gone, which is what the sleep/wakup on the kthread does. Warner From owner-svn-src-user@FreeBSD.ORG Wed May 27 05:18:14 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5934F1065678; Wed, 27 May 2009 05:18:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 484A38FC1C; Wed, 27 May 2009 05:18:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R5ID3t084545; Wed, 27 May 2009 05:18:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R5IDbA084544; Wed, 27 May 2009 05:18:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905270518.n4R5IDbA084544@svn.freebsd.org> From: Kip Macy Date: Wed, 27 May 2009 05:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192874 - user/kmacy/releng_7_2_fcs/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 05:18:14 -0000 Author: kmacy Date: Wed May 27 05:18:13 2009 New Revision: 192874 URL: http://svn.freebsd.org/changeset/base/192874 Log: remove gratuitous includes Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/genassym.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/genassym.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/amd64/genassym.c Wed May 27 03:57:38 2009 (r192873) +++ user/kmacy/releng_7_2_fcs/sys/amd64/amd64/genassym.c Wed May 27 05:18:13 2009 (r192874) @@ -63,12 +63,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include -#include #include #include #include From owner-svn-src-user@FreeBSD.ORG Wed May 27 06:05:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C65DC1065676; Wed, 27 May 2009 06:05:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8F148FC23; Wed, 27 May 2009 06:05:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R65KM2085583; Wed, 27 May 2009 06:05:20 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R65K9i085577; Wed, 27 May 2009 06:05:20 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905270605.n4R65K9i085577@svn.freebsd.org> From: Kip Macy Date: Wed, 27 May 2009 06:05:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192877 - in user/kmacy/releng_7_2_fcs/sys: cddl/contrib/opensolaris/uts/common/fs conf kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 06:05:27 -0000 Author: kmacy Date: Wed May 27 06:05:20 2009 New Revision: 192877 URL: http://svn.freebsd.org/changeset/base/192877 Log: - add option to link ZFS support in to the kernel for cases where having a single binary is simpler (profiling etc.) - this is still handicapped by an incompatibility between opensolaris' xdr and freebsd's xdr Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c user/kmacy/releng_7_2_fcs/sys/conf/files user/kmacy/releng_7_2_fcs/sys/conf/files.amd64 user/kmacy/releng_7_2_fcs/sys/conf/kern.pre.mk user/kmacy/releng_7_2_fcs/sys/conf/options user/kmacy/releng_7_2_fcs/sys/kern/vfs_syscalls.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Wed May 27 06:04:38 2009 (r192876) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Wed May 27 06:05:20 2009 (r192877) @@ -209,5 +209,5 @@ static struct kproc_desc up_kp = { vn_rele_async_cleaner, &vn_rele_async_proc }; -SYSINIT(vaclean, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, &up_kp); -SYSINIT(vn_rele_async_setup, SI_SUB_VFS, SI_ORDER_FIRST, vn_rele_async_init, NULL); +SYSINIT(vaclean, SI_SUB_KTHREAD_UPDATE, SI_ORDER_ANY, kproc_start, &up_kp); +SYSINIT(vn_rele_async_setup, SI_SUB_DRIVERS, SI_ORDER_ANY, vn_rele_async_init, NULL); Modified: user/kmacy/releng_7_2_fcs/sys/conf/files ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/files Wed May 27 06:04:38 2009 (r192876) +++ user/kmacy/releng_7_2_fcs/sys/conf/files Wed May 27 06:05:20 2009 (r192877) @@ -2395,3 +2395,235 @@ gnu/fs/xfs/xfs_iomap.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/xfs_behavior.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" + + +cddl/compat/opensolaris/kern/opensolaris.c optional opensolaris \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_CFLAGS}" +cddl/compat/opensolaris/kern/opensolaris_cmn_err.c optional opensolaris \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_CFLAGS}" +cddl/compat/opensolaris/kern/opensolaris_kmem.c optional opensolaris \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_CFLAGS}" +cddl/compat/opensolaris/kern/opensolaris_misc.c optional opensolaris \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" + + +cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/common/avl/avl.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/common/nvpair/nvpair.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" + +cddl/contrib/opensolaris/common/unicode/u8_textprep.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" + +cddl/compat/opensolaris/kern/opensolaris_kmem.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" +cddl/compat/opensolaris/kern/opensolaris_kobj.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" +cddl/compat/opensolaris/kern/opensolaris_kstat.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" +cddl/compat/opensolaris/kern/opensolaris_lookup.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" +cddl/compat/opensolaris/kern/opensolaris_policy.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" +cddl/compat/opensolaris/kern/opensolaris_string.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" +cddl/compat/opensolaris/kern/opensolaris_vfs.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" +cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" + + +cddl/contrib/opensolaris/uts/common/fs/gfs.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/vnode.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + + +cddl/contrib/opensolaris/uts/common/os/callb.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/os/list.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/os/nvpair_alloc_system.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/os/taskq.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + + +cddl/contrib/opensolaris/uts/common/zmod/adler32.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/deflate.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/inffast.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/inflate.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/inftrees.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/trees.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + + + + + +cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/fletcher.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/uberblock.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/unique.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + +cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/common/zfs/zfs_deleg.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/common/zfs/zfs_prop.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/common/zfs/zfs_comutil.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/common/zfs/zpool_prop.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/common/zfs/zprop_common.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + + +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + + +cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" Modified: user/kmacy/releng_7_2_fcs/sys/conf/files.amd64 ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/files.amd64 Wed May 27 06:04:38 2009 (r192876) +++ user/kmacy/releng_7_2_fcs/sys/conf/files.amd64 Wed May 27 06:05:20 2009 (r192877) @@ -268,3 +268,7 @@ i386/cpufreq/est.c optional cpufreq i386/cpufreq/p4tcc.c optional cpufreq # libkern/memset.c standard + +cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" + Modified: user/kmacy/releng_7_2_fcs/sys/conf/kern.pre.mk ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/kern.pre.mk Wed May 27 06:04:38 2009 (r192876) +++ user/kmacy/releng_7_2_fcs/sys/conf/kern.pre.mk Wed May 27 06:05:20 2009 (r192877) @@ -51,7 +51,44 @@ C_DIALECT= -std=c99 NOSTDINC= -nostdinc .endif +.if defined(OPENSOLARIS) +SUNW=$S/cddl/contrib/opensolaris +OPENSOLARIS_INC= +OPENSOLARIS_INC+=-I$S/cddl/compat/opensolaris +OPENSOLARIS_INC+=-I${SUNW}/uts/common +OPENSOLARIS_INC+=-I${SUNW}/uts/common/fs/zfs +OPENSOLARIS_INC+=-I${SUNW}/uts/common/zmod +OPENSOLARIS_INC+=-I$S +OPENSOLARIS_INC+=-I${SUNW}/common/zfs +OPENSOLARIS_INC+=-I${SUNW}/common +OPENSOLARIS_INC+=-I$S/../include +OPENSOLARIS_INC+=-I. +OPENSOLARIS_INC+=-I@ +CWARNFLAGS+=-Wno-unknown-pragmas +.endif + + +ZFS_C_DIALECT=-std=iso9899:1999 +ZFS_CWARNFLAGS=-Wno-missing-prototypes +ZFS_CWARNFLAGS+=-Wno-pointer-sign +ZFS_CWARNFLAGS+=-Wno-undef +ZFS_CWARNFLAGS+=-Wno-strict-prototypes +ZFS_CWARNFLAGS+=-Wno-cast-qual +ZFS_CWARNFLAGS+=-Wno-parentheses +ZFS_CWARNFLAGS+=-Wno-redundant-decls +ZFS_CWARNFLAGS+=-Wno-missing-braces +ZFS_CWARNFLAGS+=-Wno-uninitialized +ZFS_CWARNFLAGS+=-Wno-unused +ZFS_CWARNFLAGS+=-Wno-inline +ZFS_CWARNFLAGS+=-Wno-switch + +ZFS_INC= + +.if make(depend) || make(kernel-depend) +INCLUDES= ${OPENSOLARIS_INC} ${ZFS_INC} ${NOSTDINC} ${INCLMAGIC} -I. -I$S +.else INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. -I$S +.endif # This hack lets us use the OpenBSD altq code without spamming a new # include path into contrib'ed source files. @@ -80,17 +117,26 @@ INCLUDES+= -I$S/dev/cxgb # ... and XFS INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs -# ... and OpenSolaris -INCLUDES+= -I$S/contrib/opensolaris/compat .endif CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS} CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h + +ZFS_CFLAGS= -DFREEBSD_NAMECACHE -DBUILDING_ZFS -D_KERNEL +ZFS_CFLAGS+=-DHAVE_KERNEL_OPTION_HEADERS -nostdinc +ZFS_CFLAGS+=-mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding +ZFS_CFLAGS+=${COPTFLAGS} ${ZFS_C_DIALECT} ${DEBUG} ${CWARNFLAGS} +ZFS_CFLAGS+=${ZFS_CWARNFLAGS} -include opt_global.h -I${.CURDIR} + .if ${CC} != "icc" CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} CFLAGS+= --param inline-unit-growth=100 CFLAGS+= --param large-function-growth=1000 +ZFS_CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} +ZFS_CFLAGS+= --param inline-unit-growth=100 +ZFS_CFLAGS+= --param large-function-growth=1000 + .if ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" || \ ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "powerpc" || \ ${MACHINE_ARCH} == "sparc64" @@ -123,6 +169,7 @@ CFLAGS+= ${CONF_CFLAGS} LINTFLAGS= ${LINTOBJKERNFLAGS} NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} +ZFS_C= ${CC} -c -DBUILDING_ZFS -D_KERNEL ${WERROR} ${PROF} ${.IMPSRC} NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC} NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} Modified: user/kmacy/releng_7_2_fcs/sys/conf/options ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/options Wed May 27 06:04:38 2009 (r192876) +++ user/kmacy/releng_7_2_fcs/sys/conf/options Wed May 27 06:05:20 2009 (r192877) @@ -771,6 +771,10 @@ XBOX opt_xbox.h # XFS XFS +# ZFS +OPENSOLARIS +ZFS + # Interrupt filtering INTR_FILTER opt_global.h Modified: user/kmacy/releng_7_2_fcs/sys/kern/vfs_syscalls.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/vfs_syscalls.c Wed May 27 06:04:38 2009 (r192876) +++ user/kmacy/releng_7_2_fcs/sys/kern/vfs_syscalls.c Wed May 27 06:05:20 2009 (r192877) @@ -1399,7 +1399,7 @@ link(td, uap) return (error); } -static int hardlink_check_uid = 0; +int hardlink_check_uid = 0; SYSCTL_INT(_security_bsd, OID_AUTO, hardlink_check_uid, CTLFLAG_RW, &hardlink_check_uid, 0, "Unprivileged processes cannot create hard links to files owned by other " From owner-svn-src-user@FreeBSD.ORG Wed May 27 06:23:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BCA51065674; Wed, 27 May 2009 06:23:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19B8D8FC24; Wed, 27 May 2009 06:23:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R6NaUA085963; Wed, 27 May 2009 06:23:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R6NacK085958; Wed, 27 May 2009 06:23:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905270623.n4R6NacK085958@svn.freebsd.org> From: Kip Macy Date: Wed, 27 May 2009 06:23:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192878 - in user/kmacy/releng_7_2_fcs/sys: rpc xdr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 06:23:37 -0000 Author: kmacy Date: Wed May 27 06:23:36 2009 New Revision: 192878 URL: http://svn.freebsd.org/changeset/base/192878 Log: be explicit about the use of 32-bit types where appropriate Modified: user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h user/kmacy/releng_7_2_fcs/sys/xdr/xdr.c user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mbuf.c user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mem.c user/kmacy/releng_7_2_fcs/sys/xdr/xdr_sizeof.c Modified: user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h Wed May 27 06:05:20 2009 (r192877) +++ user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h Wed May 27 06:23:36 2009 (r192878) @@ -101,9 +101,9 @@ typedef struct __rpc_xdr { enum xdr_op x_op; /* operation; fast additional param */ const struct xdr_ops { /* get a long from underlying stream */ - bool_t (*x_getlong)(struct __rpc_xdr *, long *); + bool_t (*x_getint32)(struct __rpc_xdr *, int32_t *); /* put a long to " */ - bool_t (*x_putlong)(struct __rpc_xdr *, const long *); + bool_t (*x_putint32)(struct __rpc_xdr *, const int32_t *); /* get some bytes from " */ bool_t (*x_getbytes)(struct __rpc_xdr *, char *, u_int); /* put some bytes to " */ @@ -145,43 +145,43 @@ typedef bool_t (*xdrproc_t)(XDR *, ...); * Operations defined on a XDR handle * * XDR *xdrs; - * long *longp; + * int32_t *int32p; * char * addr; * u_int len; * u_int pos; */ -#define XDR_GETLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) -#define xdr_getlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) - -#define XDR_PUTLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) -#define xdr_putlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) +#define XDR_GETINT32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) +#define xdr_getint32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) + +#define XDR_PUTINT32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) +#define xdr_putint32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) static __inline int -xdr_getint32(XDR *xdrs, int32_t *ip) +xdr_getlong(XDR *xdrs, long *lp) { - long l; + int32_t i; - if (!xdr_getlong(xdrs, &l)) + if (!xdr_getint32(xdrs, &i)) return (FALSE); - *ip = (int32_t)l; + *lp = (long) i; return (TRUE); } static __inline int -xdr_putint32(XDR *xdrs, int32_t *ip) +xdr_putlong(XDR *xdrs, long *lp) { - long l; + int32_t i; - l = (long)*ip; - return xdr_putlong(xdrs, &l); + i = (int32_t) *lp; + return xdr_putint32(xdrs, &i); } -#define XDR_GETINT32(xdrs, int32p) xdr_getint32(xdrs, int32p) -#define XDR_PUTINT32(xdrs, int32p) xdr_putint32(xdrs, int32p) +#define XDR_GETLONG(xdrs, longp) xdr_getlong(xdrs, longp) +#define XDR_PUTLONG(xdrs, longp) xdr_putlong(xdrs, longp) #define XDR_GETBYTES(xdrs, addr, len) \ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) Modified: user/kmacy/releng_7_2_fcs/sys/xdr/xdr.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/xdr/xdr.c Wed May 27 06:05:20 2009 (r192877) +++ user/kmacy/releng_7_2_fcs/sys/xdr/xdr.c Wed May 27 06:23:36 2009 (r192878) @@ -99,19 +99,19 @@ xdr_void(void) bool_t xdr_int(XDR *xdrs, int *ip) { - long l; + int32_t i32; switch (xdrs->x_op) { case XDR_ENCODE: - l = (long) *ip; - return (XDR_PUTLONG(xdrs, &l)); + i32 = (int32_t) *ip; + return (XDR_PUTINT32(xdrs, &i32)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { + if (!XDR_GETINT32(xdrs, &i32)) { return (FALSE); } - *ip = (int) l; + *ip = (int) i32; return (TRUE); case XDR_FREE: @@ -127,19 +127,19 @@ xdr_int(XDR *xdrs, int *ip) bool_t xdr_u_int(XDR *xdrs, u_int *up) { - u_long l; + uint32_t u32; switch (xdrs->x_op) { case XDR_ENCODE: - l = (u_long) *up; - return (XDR_PUTLONG(xdrs, (long *)&l)); + u32 = (uint32_t) *up; + return (XDR_PUTINT32(xdrs, (int32_t *)&u32)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, (long *)&l)) { + if (!XDR_GETINT32(xdrs, (int32_t *)&u32)) { return (FALSE); } - *up = (u_int) l; + *up = (u_int) u32; return (TRUE); case XDR_FREE: @@ -194,23 +194,15 @@ xdr_u_long(XDR *xdrs, u_long *ulp) * same as xdr_uint32_t - open coded to save a proc call! */ bool_t -xdr_int32_t(XDR *xdrs, int32_t *int32_p) +xdr_int32_t(XDR *xdrs, int32_t *i32p) { - long l; switch (xdrs->x_op) { case XDR_ENCODE: - l = (long) *int32_p; - return (XDR_PUTLONG(xdrs, &l)); - + return (XDR_PUTINT32(xdrs, i32p)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { - return (FALSE); - } - *int32_p = (int32_t) l; - return (TRUE); - + return (XDR_GETINT32(xdrs, i32p)); case XDR_FREE: return (TRUE); } @@ -223,23 +215,14 @@ xdr_int32_t(XDR *xdrs, int32_t *int32_p) * same as xdr_int32_t - open coded to save a proc call! */ bool_t -xdr_uint32_t(XDR *xdrs, uint32_t *uint32_p) +xdr_uint32_t(XDR *xdrs, uint32_t *u32p) { - u_long l; - switch (xdrs->x_op) { case XDR_ENCODE: - l = (u_long) *uint32_p; - return (XDR_PUTLONG(xdrs, (long *)&l)); - + return (XDR_PUTINT32(xdrs, (const int32_t *) u32p)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, (long *)&l)) { - return (FALSE); - } - *uint32_p = (uint32_t) l; - return (TRUE); - + return (XDR_GETINT32(xdrs, (int32_t *) u32p)); case XDR_FREE: return (TRUE); } @@ -254,19 +237,19 @@ xdr_uint32_t(XDR *xdrs, uint32_t *uint32 bool_t xdr_short(XDR *xdrs, short *sp) { - long l; + int32_t i; switch (xdrs->x_op) { case XDR_ENCODE: - l = (long) *sp; - return (XDR_PUTLONG(xdrs, &l)); + i = (int32_t) *sp; + return (XDR_PUTINT32(xdrs, &i)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { + if (!XDR_GETINT32(xdrs, &i)) { return (FALSE); } - *sp = (short) l; + *sp = (short) i; return (TRUE); case XDR_FREE: @@ -282,19 +265,19 @@ xdr_short(XDR *xdrs, short *sp) bool_t xdr_u_short(XDR *xdrs, u_short *usp) { - u_long l; + uint32_t u; switch (xdrs->x_op) { case XDR_ENCODE: - l = (u_long) *usp; - return (XDR_PUTLONG(xdrs, (long *)&l)); + u = (uint32_t) *usp; + return (XDR_PUTINT32(xdrs, (const int32_t *)&u)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, (long *)&l)) { + if (!XDR_GETINT32(xdrs, (int32_t *)&u)) { return (FALSE); } - *usp = (u_short) l; + *usp = (u_short) u; return (TRUE); case XDR_FREE: @@ -309,21 +292,21 @@ xdr_u_short(XDR *xdrs, u_short *usp) * XDR 16-bit integers */ bool_t -xdr_int16_t(XDR *xdrs, int16_t *int16_p) +xdr_int16_t(XDR *xdrs, int16_t *i16p) { - long l; + int32_t i; switch (xdrs->x_op) { case XDR_ENCODE: - l = (long) *int16_p; - return (XDR_PUTLONG(xdrs, &l)); + i = (int32_t) *i16p; + return (XDR_PUTINT32(xdrs, &i)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { + if (!XDR_GETINT32(xdrs, &i)) { return (FALSE); } - *int16_p = (int16_t) l; + *i16p = (int16_t) i; return (TRUE); case XDR_FREE: @@ -337,21 +320,21 @@ xdr_int16_t(XDR *xdrs, int16_t *int16_p) * XDR unsigned 16-bit integers */ bool_t -xdr_uint16_t(XDR *xdrs, uint16_t *uint16_p) +xdr_uint16_t(XDR *xdrs, uint16_t *u16p) { - u_long l; + uint32_t u; switch (xdrs->x_op) { case XDR_ENCODE: - l = (u_long) *uint16_p; - return (XDR_PUTLONG(xdrs, (long *)&l)); + u = (uint32_t) *u16p; + return (XDR_PUTINT32(xdrs, &u)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, (long *)&l)) { + if (!XDR_GETINT32(xdrs, &u)) { return (FALSE); } - *uint16_p = (uint16_t) l; + *u16p = (uint16_t) u; return (TRUE); case XDR_FREE: @@ -400,19 +383,19 @@ xdr_u_char(XDR *xdrs, u_char *cp) bool_t xdr_bool(XDR *xdrs, bool_t *bp) { - long lb; + int32_t ib; switch (xdrs->x_op) { case XDR_ENCODE: - lb = *bp ? XDR_TRUE : XDR_FALSE; - return (XDR_PUTLONG(xdrs, &lb)); + ib = *bp ? XDR_TRUE : XDR_FALSE; + return (XDR_PUTINT32(xdrs, &ib)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &lb)) { + if (!XDR_GETINT32(xdrs, &ib)) { return (FALSE); } - *bp = (lb == XDR_FALSE) ? FALSE : TRUE; + *bp = (ib == XDR_FALSE) ? FALSE : TRUE; return (TRUE); case XDR_FREE: @@ -700,22 +683,22 @@ xdr_wrapstring(XDR *xdrs, char **cpp) bool_t xdr_int64_t(XDR *xdrs, int64_t *llp) { - u_long ul[2]; + uint32_t u32[2]; switch (xdrs->x_op) { case XDR_ENCODE: - ul[0] = (u_long)((uint64_t)*llp >> 32) & 0xffffffff; - ul[1] = (u_long)((uint64_t)*llp) & 0xffffffff; - if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE) + u32[0] = (uint32_t)((uint64_t)*llp >> 32) & 0xffffffff; + u32[1] = (uint32_t)((uint64_t)*llp) & 0xffffffff; + if (XDR_PUTINT32(xdrs, (int32_t *)&u32[0]) == FALSE) return (FALSE); - return (XDR_PUTLONG(xdrs, (long *)&ul[1])); + return (XDR_PUTINT32(xdrs, (int32_t *)&u32[1])); case XDR_DECODE: - if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE) + if (XDR_GETINT32(xdrs, (int32_t *)&u32[0]) == FALSE) return (FALSE); - if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE) + if (XDR_GETINT32(xdrs, (int32_t *)&u32[1]) == FALSE) return (FALSE); *llp = (int64_t) - (((uint64_t)ul[0] << 32) | ((uint64_t)ul[1])); + (((uint64_t)u32[0] << 32) | ((uint64_t)u32[1])); return (TRUE); case XDR_FREE: return (TRUE); @@ -731,22 +714,22 @@ xdr_int64_t(XDR *xdrs, int64_t *llp) bool_t xdr_uint64_t(XDR *xdrs, uint64_t *ullp) { - u_long ul[2]; + uint32_t u32[2]; switch (xdrs->x_op) { case XDR_ENCODE: - ul[0] = (u_long)(*ullp >> 32) & 0xffffffff; - ul[1] = (u_long)(*ullp) & 0xffffffff; - if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE) + u32[0] = (uint32_t)(*ullp >> 32) & 0xffffffff; + u32[1] = (uint32_t)(*ullp) & 0xffffffff; + if (XDR_PUTINT32(xdrs, (int32_t *)&u32[0]) == FALSE) return (FALSE); - return (XDR_PUTLONG(xdrs, (long *)&ul[1])); + return (XDR_PUTINT32(xdrs, (int32_t *)&u32[1])); case XDR_DECODE: - if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE) + if (XDR_GETINT32(xdrs, (int32_t *)&u32[0]) == FALSE) return (FALSE); - if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE) + if (XDR_GETINT32(xdrs, (int32_t *)&u32[1]) == FALSE) return (FALSE); *ullp = (uint64_t) - (((uint64_t)ul[0] << 32) | ((uint64_t)ul[1])); + (((uint64_t)u32[0] << 32) | ((uint64_t)u32[1])); return (TRUE); case XDR_FREE: return (TRUE); Modified: user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mbuf.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mbuf.c Wed May 27 06:05:20 2009 (r192877) +++ user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mbuf.c Wed May 27 06:23:36 2009 (r192878) @@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$"); #include static void xdrmbuf_destroy(XDR *); -static bool_t xdrmbuf_getlong(XDR *, long *); -static bool_t xdrmbuf_putlong(XDR *, const long *); +static bool_t xdrmbuf_getint32(XDR *, int32_t *); +static bool_t xdrmbuf_putint32(XDR *, const int32_t *); static bool_t xdrmbuf_getbytes(XDR *, char *, u_int); static bool_t xdrmbuf_putbytes(XDR *, const char *, u_int); /* XXX: w/64-bit pointers, u_int not enough! */ @@ -47,8 +47,8 @@ static bool_t xdrmbuf_setpos(XDR *, u_in static int32_t *xdrmbuf_inline(XDR *, u_int); static const struct xdr_ops xdrmbuf_ops = { - xdrmbuf_getlong, - xdrmbuf_putlong, + xdrmbuf_getint32, + xdrmbuf_putint32, xdrmbuf_getbytes, xdrmbuf_putbytes, xdrmbuf_getpos, @@ -90,7 +90,7 @@ xdrmbuf_destroy(XDR *xdrs) } static bool_t -xdrmbuf_getlong(XDR *xdrs, long *lp) +xdrmbuf_getint32(XDR *xdrs, int32_t *lp) { int32_t t; @@ -100,9 +100,7 @@ xdrmbuf_getlong(XDR *xdrs, long *lp) } static bool_t -xdrmbuf_putlong(xdrs, lp) - XDR *xdrs; - const long *lp; +xdrmbuf_putint32(XDR *xdrs, const int32_t *lp) { int32_t t = htonl(*lp); Modified: user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mem.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mem.c Wed May 27 06:05:20 2009 (r192877) +++ user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mem.c Wed May 27 06:23:36 2009 (r192878) @@ -57,10 +57,10 @@ __FBSDID("$FreeBSD$"); #define memmove(dst, src, len) bcopy(src, dst, len) static void xdrmem_destroy(XDR *); -static bool_t xdrmem_getlong_aligned(XDR *, long *); -static bool_t xdrmem_putlong_aligned(XDR *, const long *); -static bool_t xdrmem_getlong_unaligned(XDR *, long *); -static bool_t xdrmem_putlong_unaligned(XDR *, const long *); +static bool_t xdrmem_getint32_aligned(XDR *, int32_t *); +static bool_t xdrmem_putint32_aligned(XDR *, const int32_t *); +static bool_t xdrmem_getint32_unaligned(XDR *, int32_t *); +static bool_t xdrmem_putint32_unaligned(XDR *, const int32_t *); static bool_t xdrmem_getbytes(XDR *, char *, u_int); static bool_t xdrmem_putbytes(XDR *, const char *, u_int); /* XXX: w/64-bit pointers, u_int not enough! */ @@ -70,8 +70,8 @@ static int32_t *xdrmem_inline_aligned(XD static int32_t *xdrmem_inline_unaligned(XDR *, u_int); static const struct xdr_ops xdrmem_ops_aligned = { - xdrmem_getlong_aligned, - xdrmem_putlong_aligned, + xdrmem_getint32_aligned, + xdrmem_putint32_aligned, xdrmem_getbytes, xdrmem_putbytes, xdrmem_getpos, @@ -81,8 +81,8 @@ static const struct xdr_ops xdrmem_ops_a }; static const struct xdr_ops xdrmem_ops_unaligned = { - xdrmem_getlong_unaligned, - xdrmem_putlong_unaligned, + xdrmem_getint32_unaligned, + xdrmem_putint32_unaligned, xdrmem_getbytes, xdrmem_putbytes, xdrmem_getpos, @@ -100,7 +100,7 @@ xdrmem_create(XDR *xdrs, char *addr, u_i { xdrs->x_op = op; - xdrs->x_ops = ((unsigned long)addr & (sizeof(int32_t) - 1)) + xdrs->x_ops = ((uintptr_t)addr & (sizeof(int32_t) - 1)) ? &xdrmem_ops_unaligned : &xdrmem_ops_aligned; xdrs->x_private = xdrs->x_base = addr; xdrs->x_handy = size; @@ -114,7 +114,7 @@ xdrmem_destroy(XDR *xdrs) } static bool_t -xdrmem_getlong_aligned(XDR *xdrs, long *lp) +xdrmem_getint32_aligned(XDR *xdrs, int32_t *lp) { if (xdrs->x_handy < sizeof(int32_t)) @@ -126,7 +126,7 @@ xdrmem_getlong_aligned(XDR *xdrs, long * } static bool_t -xdrmem_putlong_aligned(XDR *xdrs, const long *lp) +xdrmem_putint32_aligned(XDR *xdrs, const int32_t *lp) { if (xdrs->x_handy < sizeof(int32_t)) @@ -138,7 +138,7 @@ xdrmem_putlong_aligned(XDR *xdrs, const } static bool_t -xdrmem_getlong_unaligned(XDR *xdrs, long *lp) +xdrmem_getint32_unaligned(XDR *xdrs, int32_t *lp) { u_int32_t l; @@ -152,7 +152,7 @@ xdrmem_getlong_unaligned(XDR *xdrs, long } static bool_t -xdrmem_putlong_unaligned(XDR *xdrs, const long *lp) +xdrmem_putint32_unaligned(XDR *xdrs, const int32_t *lp) { u_int32_t l; Modified: user/kmacy/releng_7_2_fcs/sys/xdr/xdr_sizeof.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/xdr/xdr_sizeof.c Wed May 27 06:05:20 2009 (r192877) +++ user/kmacy/releng_7_2_fcs/sys/xdr/xdr_sizeof.c Wed May 27 06:23:36 2009 (r192878) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); /* ARGSUSED */ static bool_t -x_putlong(XDR *xdrs, const long *longp) +x_putint32(XDR *xdrs, const int32_t *longp) { xdrs->x_handy += BYTES_PER_XDR_UNIT; @@ -135,10 +135,10 @@ xdr_sizeof(xdrproc_t func, void *data) struct xdr_ops ops; bool_t stat; /* to stop ANSI-C compiler from complaining */ - typedef bool_t (* dummyfunc1)(XDR *, long *); + typedef bool_t (* dummyfunc1)(XDR *, int32_t *); typedef bool_t (* dummyfunc2)(XDR *, caddr_t, u_int); - ops.x_putlong = x_putlong; + ops.x_putint32 = x_putint32; ops.x_putbytes = x_putbytes; ops.x_inline = x_inline; ops.x_getpostn = x_getpostn; @@ -146,7 +146,7 @@ xdr_sizeof(xdrproc_t func, void *data) ops.x_destroy = x_destroy; /* the other harmless ones */ - ops.x_getlong = (dummyfunc1) harmless; + ops.x_getint32 = (dummyfunc1) harmless; ops.x_getbytes = (dummyfunc2) harmless; x.x_op = XDR_ENCODE; From owner-svn-src-user@FreeBSD.ORG Thu May 28 00:44:44 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6594106564A; Thu, 28 May 2009 00:44:44 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B346A8FC16; Thu, 28 May 2009 00:44:44 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S0iioK017234; Thu, 28 May 2009 00:44:44 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S0ii5r017230; Thu, 28 May 2009 00:44:44 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905280044.n4S0ii5r017230@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 00:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192944 - in user/kmacy/releng_7_2_fcs/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs rpc xdr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 00:44:45 -0000 Author: kmacy Date: Thu May 28 00:44:44 2009 New Revision: 192944 URL: http://svn.freebsd.org/changeset/base/192944 Log: - add FreeBSD implementation of xdrmem_control needed by zfs - have zfs define xdr_ops using FreeBSD's definition - remove solaris xdr files from zfs compile Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mem.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h Thu May 28 00:38:24 2009 (r192943) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h Thu May 28 00:44:44 2009 (r192944) @@ -121,6 +121,7 @@ typedef struct XDR { * Changes must be reviewed by Solaris File Sharing * Changes must be communicated to contract-2003-523@sun.com */ +#ifndef __FreeBSD__ struct xdr_ops { #ifdef __STDC__ #if !defined(_KERNEL) @@ -168,6 +169,28 @@ struct xdr_ops { #endif }; +#else /* FreeBSD */ +struct xdr_ops { + /* get a long from underlying stream */ + bool_t (*x_getint32)(struct XDR *, int32_t *); + /* put a long to " */ + bool_t (*x_putint32)(struct XDR *, const int32_t *); + /* get some bytes from " */ + bool_t (*x_getbytes)(struct XDR *, char *, u_int); + /* put some bytes to " */ + bool_t (*x_putbytes)(struct XDR *, const char *, u_int); + /* returns bytes off from beginning */ + u_int (*x_getpostn)(struct XDR *); + /* lets you reposition the stream */ + bool_t (*x_setpostn)(struct XDR *, u_int); + /* buf quick ptr to buffered data */ + int32_t *(*x_inline)(struct XDR *, u_int); + /* free privates of this xdr_stream */ + void (*x_destroy)(struct XDR *); + bool_t (*x_control)(struct XDR *, int, void *); +}; +#endif + /* * Operations defined on a XDR handle * Modified: user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile Thu May 28 00:38:24 2009 (r192943) +++ user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile Thu May 28 00:44:44 2009 (r192944) @@ -43,10 +43,10 @@ SRCS+= list.c SRCS+= nvpair_alloc_system.c SRCS+= taskq.c -.PATH: ${SUNW}/uts/common/rpc -SRCS+= opensolaris_xdr.c -SRCS+= opensolaris_xdr_array.c -SRCS+= opensolaris_xdr_mem.c +#.PATH: ${SUNW}/uts/common/rpc +#SRCS+= opensolaris_xdr.c +#SRCS+= opensolaris_xdr_array.c +#SRCS+= opensolaris_xdr_mem.c .PATH: ${SUNW}/uts/common/zmod SRCS+= adler32.c Modified: user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h Thu May 28 00:38:24 2009 (r192943) +++ user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h Thu May 28 00:44:44 2009 (r192944) @@ -338,6 +338,22 @@ typedef struct netobj netobj; extern bool_t xdr_netobj(XDR *, struct netobj *); /* + * These are XDR control operators + */ + +#define XDR_GET_BYTES_AVAIL 1 +#define XDR_PEEK 2 +#define XDR_SKIPBYTES 3 + +struct xdr_bytesrec { + bool_t xc_is_last_record; + size_t xc_num_avail; +}; + +typedef struct xdr_bytesrec xdr_bytesrec; + + +/* * These are the public routines for the various implementations of * xdr streams. */ Modified: user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mem.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mem.c Thu May 28 00:38:24 2009 (r192943) +++ user/kmacy/releng_7_2_fcs/sys/xdr/xdr_mem.c Thu May 28 00:44:44 2009 (r192944) @@ -68,7 +68,8 @@ static u_int xdrmem_getpos(XDR *); static bool_t xdrmem_setpos(XDR *, u_int); static int32_t *xdrmem_inline_aligned(XDR *, u_int); static int32_t *xdrmem_inline_unaligned(XDR *, u_int); - +static bool_t xdrmem_control(XDR *xdrs, int request, void *info); + static const struct xdr_ops xdrmem_ops_aligned = { xdrmem_getint32_aligned, xdrmem_putint32_aligned, @@ -77,7 +78,8 @@ static const struct xdr_ops xdrmem_ops_a xdrmem_getpos, xdrmem_setpos, xdrmem_inline_aligned, - xdrmem_destroy + xdrmem_destroy, + xdrmem_control }; static const struct xdr_ops xdrmem_ops_unaligned = { @@ -88,7 +90,8 @@ static const struct xdr_ops xdrmem_ops_u xdrmem_getpos, xdrmem_setpos, xdrmem_inline_unaligned, - xdrmem_destroy + xdrmem_destroy, + xdrmem_control }; /* @@ -230,3 +233,45 @@ xdrmem_inline_unaligned(XDR *xdrs, u_int return (0); } + +static bool_t +xdrmem_control(XDR *xdrs, int request, void *info) +{ + xdr_bytesrec *xptr; + int32_t *l; + int len; + + switch (request) { + + case XDR_GET_BYTES_AVAIL: + xptr = (xdr_bytesrec *)info; + xptr->xc_is_last_record = TRUE; + xptr->xc_num_avail = xdrs->x_handy; + return (TRUE); + + case XDR_PEEK: + /* + * Return the next 4 byte unit in the XDR stream. + */ + if (xdrs->x_handy < sizeof (int32_t)) + return (FALSE); + l = (int32_t *)info; + *l = (int32_t)ntohl((uint32_t) + (*((int32_t *)(xdrs->x_private)))); + return (TRUE); + + case XDR_SKIPBYTES: + /* + * Skip the next N bytes in the XDR stream. + */ + l = (int32_t *)info; + len = RNDUP((int)(*l)); + if (xdrs->x_handy < len) + return (FALSE); + xdrs->x_handy -= len; + xdrs->x_private = (char *)xdrs->x_private + len; + return (TRUE); + + } + return (FALSE); +} From owner-svn-src-user@FreeBSD.ORG Thu May 28 00:47:32 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7778106567B; Thu, 28 May 2009 00:47:32 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B47118FC1A; Thu, 28 May 2009 00:47:32 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S0lWKt017356; Thu, 28 May 2009 00:47:32 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S0lWdx017355; Thu, 28 May 2009 00:47:32 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905280047.n4S0lWdx017355@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 00:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192945 - in user/kmacy/releng_7_2_fcs/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 00:47:33 -0000 Author: kmacy Date: Thu May 28 00:47:32 2009 New Revision: 192945 URL: http://svn.freebsd.org/changeset/base/192945 Log: permanently remove solaris xdr files Deleted: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c Modified: user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile Modified: user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile Thu May 28 00:44:44 2009 (r192944) +++ user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile Thu May 28 00:47:32 2009 (r192945) @@ -43,11 +43,6 @@ SRCS+= list.c SRCS+= nvpair_alloc_system.c SRCS+= taskq.c -#.PATH: ${SUNW}/uts/common/rpc -#SRCS+= opensolaris_xdr.c -#SRCS+= opensolaris_xdr_array.c -#SRCS+= opensolaris_xdr_mem.c - .PATH: ${SUNW}/uts/common/zmod SRCS+= adler32.c SRCS+= opensolaris_crc32.c From owner-svn-src-user@FreeBSD.ORG Thu May 28 00:52:09 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 802351065743; Thu, 28 May 2009 00:52:09 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E6998FC16; Thu, 28 May 2009 00:52:09 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S0q9Sk017520; Thu, 28 May 2009 00:52:09 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S0q9hO017518; Thu, 28 May 2009 00:52:09 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905280052.n4S0q9hO017518@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 00:52:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192947 - user/kmacy/releng_7_2_fcs/sys/amd64/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 00:52:09 -0000 Author: kmacy Date: Thu May 28 00:52:09 2009 New Revision: 192947 URL: http://svn.freebsd.org/changeset/base/192947 Log: add ZFS to stock compile add HWPMC_HOOKS to debug Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Thu May 28 00:47:50 2009 (r192946) +++ user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Thu May 28 00:52:09 2009 (r192947) @@ -27,6 +27,10 @@ ident GENERIC makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions MODULES_OVERRIDE="mxge zlib geom opensolaris zfs cxgb fxp nfe hwpmc linux linprocfs" +makeoptions OPENSOLARIS +options OPENSOLARIS +options ZFS + options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS Thu May 28 00:47:50 2009 (r192946) +++ user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS Thu May 28 00:52:09 2009 (r192947) @@ -27,6 +27,10 @@ ident GENERIC makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions MODULES_OVERRIDE="opensolaris zfs zlib mxge geom hwpmc linux linprocfs" +makeoptions OPENSOLARIS +options OPENSOLARIS +options ZFS + options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking @@ -78,6 +82,7 @@ options DEBUG options KDB options DDB options ALT_BREAK_TO_DEBUGGER +options HWPMC_HOOKS # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel From owner-svn-src-user@FreeBSD.ORG Thu May 28 04:30:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5029F1065670; Thu, 28 May 2009 04:30:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3330E8FC13; Thu, 28 May 2009 04:30:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S4UUUk022686; Thu, 28 May 2009 04:30:30 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S4UUAr022684; Thu, 28 May 2009 04:30:30 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905280430.n4S4UUAr022684@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 04:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192955 - in user/kmacy/releng_7_2_fcs/sys: conf net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 04:30:30 -0000 Author: kmacy Date: Thu May 28 04:30:29 2009 New Revision: 192955 URL: http://svn.freebsd.org/changeset/base/192955 Log: switch to freebsd zlib compression routines where possible Modified: user/kmacy/releng_7_2_fcs/sys/conf/files user/kmacy/releng_7_2_fcs/sys/net/zlib.c Modified: user/kmacy/releng_7_2_fcs/sys/conf/files ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/files Thu May 28 04:25:38 2009 (r192954) +++ user/kmacy/releng_7_2_fcs/sys/conf/files Thu May 28 04:30:29 2009 (r192955) @@ -1853,8 +1853,8 @@ net/rtsock.c standard net/slcompress.c optional netgraph_vjc | ppp | sl | sppp | \ netgraph_sppp net/zlib.c optional crypto | geom_uzip | ipsec | \ - mxge | ppp_deflate | netgraph_deflate | \ - ddb_ctf + mxge | ppp_deflate | zfs | \ + netgraph_deflate | ddb_ctf net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan_acl net80211/ieee80211_amrr.c optional wlan_amrr @@ -2449,30 +2449,16 @@ cddl/contrib/opensolaris/uts/common/os/n compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" cddl/contrib/opensolaris/uts/common/os/taskq.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" - - -cddl/contrib/opensolaris/uts/common/zmod/adler32.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/deflate.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/inffast.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" cddl/contrib/opensolaris/uts/common/zmod/inflate.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" cddl/contrib/opensolaris/uts/common/zmod/inftrees.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/trees.c optional zfs \ +cddl/contrib/opensolaris/uts/common/zmod/adler32.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs \ +cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" - - @@ -2627,3 +2613,21 @@ cddl/contrib/opensolaris/uts/common/fs/z cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + +/* + * Compression routines conflicting with ZFS + * + */ + +#cddl/contrib/opensolaris/uts/common/zmod/deflate.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/inffast.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/trees.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + + Modified: user/kmacy/releng_7_2_fcs/sys/net/zlib.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/zlib.c Thu May 28 04:25:38 2009 (r192954) +++ user/kmacy/releng_7_2_fcs/sys/net/zlib.c Thu May 28 04:30:29 2009 (r192955) @@ -5405,3 +5405,97 @@ static moduledata_t zlib_mod = { DECLARE_MODULE(zlib, zlib_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(zlib, 1); #endif /* _KERNEL */ + +/**********************************************************************/ +/**********************************************************************/ +/**********************************************************************/ + +/* + * + * Compression utility routines + * + */ + + +/* + * Uncompress the buffer 'src' into the buffer 'dst'. The caller must store + * the expected decompressed data size externally so it can be passed in. + * The resulting decompressed size is then returned through dstlen. This + * function return Z_OK on success, or another error code on failure. + */ +int +z_uncompress(void *dst, size_t *dstlen, const void *src, size_t srclen) +{ + z_stream zs; + int err; + + bzero(&zs, sizeof (zs)); + zs.next_in = (u_char *)src; + zs.avail_in = srclen; + zs.next_out = dst; + zs.avail_out = *dstlen; + + /* + * Call inflateInit2() specifying a window size of DEF_WBITS + * with the 6th bit set to indicate that the compression format + * type (zlib or gzip) should be automatically detected. + */ + if ((err = inflateInit2(&zs, DEF_WBITS | 0x20)) != Z_OK) + return (err); + + if ((err = inflate(&zs, Z_FINISH)) != Z_STREAM_END) { + (void) inflateEnd(&zs); + return (err == Z_OK ? Z_BUF_ERROR : err); + } + + *dstlen = zs.total_out; + return (inflateEnd(&zs)); +} + +int +z_compress_level(void *dst, size_t *dstlen, const void *src, size_t srclen, + int level) +{ + + z_stream zs; + int err; + + bzero(&zs, sizeof (zs)); + zs.next_in = (u_char *)src; + zs.avail_in = srclen; + zs.next_out = dst; + zs.avail_out = *dstlen; + + if ((err = deflateInit(&zs, level)) != Z_OK) + return (err); + + if ((err = deflate(&zs, Z_FINISH)) != Z_STREAM_END) { + (void) deflateEnd(&zs); + return (err == Z_OK ? Z_BUF_ERROR : err); + } + + *dstlen = zs.total_out; + return (deflateEnd(&zs)); +} + +int +z_compress(void *dst, size_t *dstlen, const void *src, size_t srclen) +{ + return (z_compress_level(dst, dstlen, src, srclen, + Z_DEFAULT_COMPRESSION)); +} + +/* + * Convert a zlib error code into a string error message. + */ +const char * +z_strerror(int err) +{ + int i = Z_NEED_DICT - err; + + if (i < 0 || i > Z_NEED_DICT - Z_VERSION_ERROR) + return ("unknown error"); + + return (ERR_MSG(err)); +} + From owner-svn-src-user@FreeBSD.ORG Thu May 28 04:32:08 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4B8B106566B; Thu, 28 May 2009 04:32:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A97CC8FC0C; Thu, 28 May 2009 04:32:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S4W8Rb022757; Thu, 28 May 2009 04:32:08 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S4W80f022756; Thu, 28 May 2009 04:32:08 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905280432.n4S4W80f022756@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 04:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192956 - user/kmacy/releng_7_2_fcs/sys/amd64/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 04:32:09 -0000 Author: kmacy Date: Thu May 28 04:32:08 2009 New Revision: 192956 URL: http://svn.freebsd.org/changeset/base/192956 Log: add mxge to kerne config Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Thu May 28 04:30:29 2009 (r192955) +++ user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Thu May 28 04:32:08 2009 (r192956) @@ -237,4 +237,4 @@ options KDB options ALT_BREAK_TO_DEBUGGER options HWPMC_HOOKS options LOCK_PROFILING - +device mxge From owner-svn-src-user@FreeBSD.ORG Thu May 28 04:35:09 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EE94106566B; Thu, 28 May 2009 04:35:09 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E02A8FC08; Thu, 28 May 2009 04:35:09 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S4Z9AV022861; Thu, 28 May 2009 04:35:09 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S4Z9Mp022860; Thu, 28 May 2009 04:35:09 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905280435.n4S4Z9Mp022860@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 04:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192957 - user/kmacy/releng_7_2_fcs/sys/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 04:35:09 -0000 Author: kmacy Date: Thu May 28 04:35:09 2009 New Revision: 192957 URL: http://svn.freebsd.org/changeset/base/192957 Log: fix comment Modified: user/kmacy/releng_7_2_fcs/sys/conf/files Modified: user/kmacy/releng_7_2_fcs/sys/conf/files ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/files Thu May 28 04:32:08 2009 (r192956) +++ user/kmacy/releng_7_2_fcs/sys/conf/files Thu May 28 04:35:09 2009 (r192957) @@ -2614,10 +2614,8 @@ cddl/contrib/opensolaris/uts/common/fs/z cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -/* - * Compression routines conflicting with ZFS - * - */ + +# Compression routines conflicting with ZFS #cddl/contrib/opensolaris/uts/common/zmod/deflate.c optional zfs \ # compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" From owner-svn-src-user@FreeBSD.ORG Thu May 28 18:46:15 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F7971065670; Thu, 28 May 2009 18:46:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 746408FC15; Thu, 28 May 2009 18:46:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SIkFnJ046509; Thu, 28 May 2009 18:46:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SIkFUM046508; Thu, 28 May 2009 18:46:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905281846.n4SIkFUM046508@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 18:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192988 - user/kmacy/releng_7_2_fast_net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 18:46:15 -0000 Author: kmacy Date: Thu May 28 18:46:15 2009 New Revision: 192988 URL: http://svn.freebsd.org/changeset/base/192988 Log: create 7.2 branch with performance optimizations but no ZFS changes Added: user/kmacy/releng_7_2_fast_net/ - copied from r192987, releng/7.2/ From owner-svn-src-user@FreeBSD.ORG Thu May 28 18:46:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82335106564A; Thu, 28 May 2009 18:46:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 575228FC0C; Thu, 28 May 2009 18:46:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SIkhIg046553; Thu, 28 May 2009 18:46:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SIkhf4046552; Thu, 28 May 2009 18:46:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905281846.n4SIkhf4046552@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 18:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192989 - user/kmacy/releng_7_2_xen X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 18:46:43 -0000 Author: kmacy Date: Thu May 28 18:46:43 2009 New Revision: 192989 URL: http://svn.freebsd.org/changeset/base/192989 Log: create a 7.2 branch for updated xen backport Added: user/kmacy/releng_7_2_xen/ - copied from r192988, releng/7.2/ From owner-svn-src-user@FreeBSD.ORG Thu May 28 19:05:27 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A14E010656E5; Thu, 28 May 2009 19:05:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A8E18FC0A; Thu, 28 May 2009 19:05:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SJ5RhP046991; Thu, 28 May 2009 19:05:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SJ5RBT046990; Thu, 28 May 2009 19:05:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905281905.n4SJ5RBT046990@svn.freebsd.org> From: Kip Macy Date: Thu, 28 May 2009 19:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192990 - in user/kmacy/releng_7_2_xen/sys: conf dev/xen dev/xen/balloon dev/xen/blkback dev/xen/blkfront dev/xen/console dev/xen/evtchn dev/xen/netback dev/xen/netfront dev/xen/pcifron... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 19:05:28 -0000 Author: kmacy Date: Thu May 28 19:05:26 2009 New Revision: 192990 URL: http://svn.freebsd.org/changeset/base/192990 Log: apply releng_7_xen changes Added: user/kmacy/releng_7_2_xen/sys/dev/xen/ user/kmacy/releng_7_2_xen/sys/dev/xen/balloon/ user/kmacy/releng_7_2_xen/sys/dev/xen/balloon/balloon.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/blkback/ user/kmacy/releng_7_2_xen/sys/dev/xen/blkback/blkback.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/blkfront/ user/kmacy/releng_7_2_xen/sys/dev/xen/blkfront/blkfront.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/blkfront/block.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/console/ user/kmacy/releng_7_2_xen/sys/dev/xen/console/console.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/console/xencons_ring.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/console/xencons_ring.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/evtchn/ user/kmacy/releng_7_2_xen/sys/dev/xen/evtchn/evtchn_dev.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/netback/ user/kmacy/releng_7_2_xen/sys/dev/xen/netback/netback.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/ user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/mbufq.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/netfront/netfront.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/dev/xen/pcifront/ user/kmacy/releng_7_2_xen/sys/dev/xen/pcifront/pcifront.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/include/xen/ user/kmacy/releng_7_2_xen/sys/i386/include/xen/features.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/include/xen/hypercall.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/include/xen/synch_bitops.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/include/xen/xen-os.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/include/xen/xenfunc.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/include/xen/xenpmap.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/include/xen/xenstored.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/include/xen/xenvar.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/xen/ user/kmacy/releng_7_2_xen/sys/i386/xen/clock.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/xen/exception.s (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/xen/locore.s (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/xen/mp_machdep.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/xen/mptable.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/xen/pmap.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/i386/xen/xen_machdep.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/libkern/strcspn.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/ user/kmacy/releng_7_2_xen/sys/xen/evtchn/ user/kmacy/releng_7_2_xen/sys/xen/evtchn.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/evtchn/evtchn.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/evtchn/evtchn_dev.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/features.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/gnttab.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/gnttab.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/hypervisor.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/ user/kmacy/releng_7_2_xen/sys/xen/interface/COPYING user/kmacy/releng_7_2_xen/sys/xen/interface/acm.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/acm_ops.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-ia64.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-powerpc.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86/ user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86/cpuid.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86/hvm/ user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86/hvm/save.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86/xen-mca.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86/xen-x86_32.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86/xen-x86_64.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86/xen.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86_32.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/arch-x86_64.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/callback.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/dom0_ops.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/domctl.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/elfnote.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/elfstructs.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/event_channel.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/features.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/foreign/ user/kmacy/releng_7_2_xen/sys/xen/interface/foreign/Makefile (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/foreign/mkchecker.py (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/foreign/mkheader.py (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/foreign/reference.size user/kmacy/releng_7_2_xen/sys/xen/interface/foreign/structs.py (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/grant_table.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/hvm/ user/kmacy/releng_7_2_xen/sys/xen/interface/hvm/e820.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/hvm/hvm_info_table.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/hvm/hvm_op.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/hvm/ioreq.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/hvm/params.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/hvm/save.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/hvm/vmx_assist.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/ user/kmacy/releng_7_2_xen/sys/xen/interface/io/blkif.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/console.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/fbif.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/kbdif.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/netif.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/pciif.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/protocols.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/ring.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/tpmif.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/xenbus.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/io/xs_wire.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/kexec.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/libelf.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/memory.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/nmi.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/physdev.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/platform.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/sched.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/sysctl.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/trace.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/vcpu.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/version.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/xen-compat.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/xen.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/xencomm.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/interface/xenoprof.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xen_intr.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/ user/kmacy/releng_7_2_xen/sys/xen/xenbus/init.txt (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_client.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_comms.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_comms.h (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_dev.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_if.m user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_probe.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_probe_backend.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbus_xs.c (contents, props changed) user/kmacy/releng_7_2_xen/sys/xen/xenbus/xenbusvar.h (contents, props changed) Modified: user/kmacy/releng_7_2_xen/sys/conf/files user/kmacy/releng_7_2_xen/sys/conf/files.i386 user/kmacy/releng_7_2_xen/sys/conf/options.i386 user/kmacy/releng_7_2_xen/sys/i386/conf/DEFAULTS user/kmacy/releng_7_2_xen/sys/i386/i386/apic_vector.s user/kmacy/releng_7_2_xen/sys/i386/i386/genassym.c user/kmacy/releng_7_2_xen/sys/i386/i386/intr_machdep.c user/kmacy/releng_7_2_xen/sys/i386/i386/local_apic.c user/kmacy/releng_7_2_xen/sys/i386/i386/machdep.c user/kmacy/releng_7_2_xen/sys/i386/i386/support.s user/kmacy/releng_7_2_xen/sys/i386/i386/swtch.s user/kmacy/releng_7_2_xen/sys/i386/i386/sys_machdep.c user/kmacy/releng_7_2_xen/sys/i386/i386/vm_machdep.c user/kmacy/releng_7_2_xen/sys/i386/include/apicvar.h user/kmacy/releng_7_2_xen/sys/i386/include/asmacros.h user/kmacy/releng_7_2_xen/sys/i386/include/cpufunc.h user/kmacy/releng_7_2_xen/sys/i386/include/param.h user/kmacy/releng_7_2_xen/sys/i386/include/pcpu.h user/kmacy/releng_7_2_xen/sys/i386/include/pmap.h user/kmacy/releng_7_2_xen/sys/i386/include/segments.h user/kmacy/releng_7_2_xen/sys/i386/include/smp.h user/kmacy/releng_7_2_xen/sys/i386/include/vmparam.h user/kmacy/releng_7_2_xen/sys/i386/isa/npx.c user/kmacy/releng_7_2_xen/sys/i386/pci/pci_cfgreg.c user/kmacy/releng_7_2_xen/sys/i386/pci/pci_pir.c user/kmacy/releng_7_2_xen/sys/kern/kern_fork.c user/kmacy/releng_7_2_xen/sys/kern/kern_synch.c user/kmacy/releng_7_2_xen/sys/kern/subr_trap.c user/kmacy/releng_7_2_xen/sys/modules/Makefile user/kmacy/releng_7_2_xen/sys/sys/libkern.h user/kmacy/releng_7_2_xen/sys/vm/vm_page.c Modified: user/kmacy/releng_7_2_xen/sys/conf/files ============================================================================== --- user/kmacy/releng_7_2_xen/sys/conf/files Thu May 28 18:46:43 2009 (r192989) +++ user/kmacy/releng_7_2_xen/sys/conf/files Thu May 28 19:05:26 2009 (r192990) @@ -1764,6 +1764,7 @@ libkern/strcasecmp.c standard libkern/strcat.c standard libkern/strcmp.c standard libkern/strcpy.c standard +libkern/strcspn.c standard libkern/strdup.c standard libkern/strlcat.c standard libkern/strlcpy.c standard @@ -2369,3 +2370,23 @@ gnu/fs/xfs/xfs_iomap.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/xfs_behavior.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" + + +xen/gnttab.c optional xen +xen/features.c optional xen +xen/evtchn/evtchn.c optional xen +xen/evtchn/evtchn_dev.c optional xen +xen/xenbus/xenbus_client.c optional xen +xen/xenbus/xenbus_comms.c optional xen +xen/xenbus/xenbus_dev.c optional xen +xen/xenbus/xenbus_if.m optional xen +xen/xenbus/xenbus_probe.c optional xen +#xen/xenbus/xenbus_probe_backend.c optional xen +xen/xenbus/xenbus_xs.c optional xen +dev/xen/console/console.c optional xen +dev/xen/console/xencons_ring.c optional xen +dev/xen/blkfront/blkfront.c optional xen +dev/xen/netfront/netfront.c optional xen +#dev/xen/xenpci/xenpci.c optional xen +#xen/xenbus/xenbus_newbus.c optional xenhvm + Modified: user/kmacy/releng_7_2_xen/sys/conf/files.i386 ============================================================================== --- user/kmacy/releng_7_2_xen/sys/conf/files.i386 Thu May 28 18:46:43 2009 (r192989) +++ user/kmacy/releng_7_2_xen/sys/conf/files.i386 Thu May 28 19:05:26 2009 (r192990) @@ -252,8 +252,8 @@ i386/cpufreq/smist.c optional cpufreq i386/i386/atomic.c standard \ compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}" i386/i386/autoconf.c standard -i386/i386/bios.c standard -i386/i386/bioscall.s standard +i386/i386/bios.c optional native +i386/i386/bioscall.s optional native i386/i386/bpf_jit_machdep.c optional bpf_jitter i386/i386/busdma_machdep.c standard i386/i386/db_disasm.c optional ddb @@ -262,7 +262,8 @@ i386/i386/db_trace.c optional ddb i386/i386/dump_machdep.c standard i386/i386/elan-mmcr.c optional cpu_elan | cpu_soekris i386/i386/elf_machdep.c standard -i386/i386/exception.s standard +i386/i386/exception.s optional native +i386/xen/exception.s optional xen i386/i386/gdb_machdep.c optional gdb i386/i386/geode.c optional cpu_geode i386/i386/i686_mem.c optional mem @@ -273,23 +274,28 @@ i386/i386/intr_machdep.c standard i386/i386/io.c optional io i386/i386/io_apic.c optional apic i386/i386/k6_mem.c optional mem -i386/i386/legacy.c standard +i386/i386/legacy.c optional native i386/i386/local_apic.c optional apic -i386/i386/locore.s standard no-obj +i386/i386/locore.s optional native no-obj +i386/xen/locore.s optional xen no-obj i386/i386/longrun.c optional cpu_enable_longrun i386/i386/machdep.c standard +i386/xen/xen_machdep.c optional xen i386/i386/mem.c optional mem i386/i386/minidump_machdep.c standard i386/i386/mp_clock.c optional smp -i386/i386/mp_machdep.c optional smp +i386/i386/mp_machdep.c optional native smp +i386/xen/mp_machdep.c optional xen smp i386/i386/mp_watchdog.c optional mp_watchdog smp -i386/i386/mpboot.s optional smp -i386/i386/mptable.c optional apic +i386/i386/mpboot.s optional smp native +i386/i386/mptable.c optional apic native +i386/xen/mptable.c optional apic xen i386/i386/mptable_pci.c optional apic pci i386/i386/msi.c optional apic pci i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon -i386/i386/pmap.c standard +i386/i386/pmap.c optional native +i386/xen/pmap.c optional xen i386/i386/ptrace_machdep.c standard i386/i386/stack_machdep.c optional ddb | stack i386/i386/support.s standard @@ -319,9 +325,10 @@ i386/ibcs2/ibcs2_util.c optional ibcs2 i386/ibcs2/ibcs2_xenix.c optional ibcs2 i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 -i386/isa/atpic.c standard +i386/isa/atpic.c optional atpic #i386/isa/atpic_vector.s standard -i386/isa/clock.c standard +i386/isa/clock.c optional native +i386/xen/clock.c optional xen i386/isa/dpms.c optional dpms i386/isa/elcr.c standard i386/isa/elink.c optional ep | ie Modified: user/kmacy/releng_7_2_xen/sys/conf/options.i386 ============================================================================== --- user/kmacy/releng_7_2_xen/sys/conf/options.i386 Thu May 28 18:46:43 2009 (r192989) +++ user/kmacy/releng_7_2_xen/sys/conf/options.i386 Thu May 28 19:05:26 2009 (r192990) @@ -150,3 +150,6 @@ STOP_NMI opt_cpu.h # BPF just-in-time compiler BPF_JITTER opt_bpf.h + +NATIVE opt_global.h +XEN opt_global.h Added: user/kmacy/releng_7_2_xen/sys/dev/xen/balloon/balloon.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_xen/sys/dev/xen/balloon/balloon.c Thu May 28 19:05:26 2009 (r192990) @@ -0,0 +1,446 @@ +/****************************************************************************** + * balloon.c + * + * Xen balloon driver - enables returning/claiming memory to/from Xen. + * + * Copyright (c) 2003, B Dragovic + * Copyright (c) 2003-2004, M Williamson, K Fraser + * Copyright (c) 2005 Dan M. Smith, IBM Corporation + * + * This file may be distributed separately from the Linux kernel, or + * incorporated into other software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include + +/* + * Protects atomic reservation decrease/increase against concurrent increases. + * Also protects non-atomic updates of current_pages and driver_pages, and + * balloon lists. + */ +struct mtx balloon_lock; +#ifdef notyet + +/* We aim for 'current allocation' == 'target allocation'. */ +static unsigned long current_pages; +static unsigned long target_pages; + +/* VM /proc information for memory */ +extern unsigned long totalram_pages; + +/* We may hit the hard limit in Xen. If we do then we remember it. */ +static unsigned long hard_limit; + +/* + * Drivers may alter the memory reservation independently, but they must + * inform the balloon driver so that we can avoid hitting the hard limit. + */ +static unsigned long driver_pages; + +struct balloon_entry { + vm_page_t page; + STAILQ_ENTRY(balloon_entry) list; +}; + +/* List of ballooned pages, threaded through the mem_map array. */ +static STAILQ_HEAD(,balloon_entry) ballooned_pages; + +static unsigned long balloon_low, balloon_high; + + +/* Main work function, always executed in process context. */ +static void balloon_process(void *unused); + +#define IPRINTK(fmt, args...) \ + printk(KERN_INFO "xen_mem: " fmt, ##args) +#define WPRINTK(fmt, args...) \ + printk(KERN_WARNING "xen_mem: " fmt, ##args) + +/* balloon_append: add the given page to the balloon. */ +static void +balloon_append(vm_page_t page) +{ + struct balloon_entry *entry; + + entry = malloc(sizeof(struct balloon_entry), M_WAITOK); + + STAILQ_INSERT_HEAD(&ballooned_pages, entry, list); + balloon_low++; +} + +/* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ +static vm_page_t +balloon_retrieve(void) +{ + vm_page_t page; + struct balloon_entry *entry; + + if (STAILQ_EMPTY(&ballooned_pages)) + return NULL; + + entry = STAILQ_FIRST(&ballooned_pages); + STAILQ_REMOVE_HEAD(&ballooned_pages, list); + + page = entry->page; + free(entry, M_DEVBUF); + + balloon_low--; + + return page; +} + +static void +balloon_alarm(unsigned long unused) +{ + wakeup(balloon_process); +} + +static unsigned long +current_target(void) +{ + unsigned long target = min(target_pages, hard_limit); + if (target > (current_pages + balloon_low + balloon_high)) + target = current_pages + balloon_low + balloon_high; + return target; +} + +static int +increase_reservation(unsigned long nr_pages) +{ + unsigned long *mfn_list, pfn, i, flags; + struct page *page; + long rc; + struct xen_memory_reservation reservation = { + .address_bits = 0, + .extent_order = 0, + .domid = DOMID_SELF + }; + + if (nr_pages > (PAGE_SIZE / sizeof(unsigned long))) + nr_pages = PAGE_SIZE / sizeof(unsigned long); + + mfn_list = (unsigned long *)malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT); + if (mfn_list == NULL) + return ENOMEM; + + + reservation.extent_start = mfn_list; + reservation.nr_extents = nr_pages; + rc = HYPERVISOR_memory_op( + XENMEM_increase_reservation, &reservation); + if (rc < nr_pages) { + int ret; + /* We hit the Xen hard limit: reprobe. */ + reservation.extent_start = mfn_list; + reservation.nr_extents = rc; + ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, + &reservation); + PANIC_IF(ret != rc); + hard_limit = current_pages + rc - driver_pages; + goto out; + } + + for (i = 0; i < nr_pages; i++) { + page = balloon_retrieve(); + PANIC_IF(page == NULL); + + pfn = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); + PANIC_IF(phys_to_machine_mapping_valid(pfn)); + + /* Update P->M and M->P tables. */ + PFNTOMFN(pfn) = mfn_list[i]; + xen_machphys_update(mfn_list[i], pfn); + + /* Relinquish the page back to the allocator. */ + ClearPageReserved(page); + set_page_count(page, 1); + vm_page_free(page); + } + + current_pages += nr_pages; + totalram_pages = current_pages; + + out: + balloon_unlock(flags); + + free((mfn_list); + + return 0; +} + +static int +decrease_reservation(unsigned long nr_pages) +{ + unsigned long *mfn_list, pfn, i, flags; + struct page *page; + void *v; + int need_sleep = 0; + int ret; + struct xen_memory_reservation reservation = { + .address_bits = 0, + .extent_order = 0, + .domid = DOMID_SELF + }; + + if (nr_pages > (PAGE_SIZE / sizeof(unsigned long))) + nr_pages = PAGE_SIZE / sizeof(unsigned long); + + mfn_list = (unsigned long *)malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT); + if (mfn_list == NULL) + return ENOMEM; + + for (i = 0; i < nr_pages; i++) { + int color = 0; + if ((page = vm_page_alloc(NULL, color++, + VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + nr_pages = i; + need_sleep = 1; + break; + } + pfn = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); + mfn_list[i] = PFNTOMFN(pfn); + } + + balloon_lock(flags); + + /* No more mappings: invalidate P2M and add to balloon. */ + for (i = 0; i < nr_pages; i++) { + pfn = MFNTOPFN(mfn_list[i]); + PFNTOMFN(pfn) = INVALID_P2M_ENTRY; + balloon_append(PHYS_TO_VM_PAGE(pfn << PAGE_SHIFT)); + } + + reservation.extent_start = mfn_list; + reservation.nr_extents = nr_pages; + ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); + PANIC_IF(ret != nr_pages); + + current_pages -= nr_pages; + totalram_pages = current_pages; + + balloon_unlock(flags); + + free(mfn_list, M_DEVBUF); + + return need_sleep; +} + +/* + * We avoid multiple worker processes conflicting via the balloon mutex. + * We may of course race updates of the target counts (which are protected + * by the balloon lock), or with changes to the Xen hard limit, but we will + * recover from these in time. + */ +static void +balloon_process(void *unused) +{ + int need_sleep = 0; + long credit; + + for (;;) { + do { + credit = current_target() - current_pages; + if (credit > 0) + need_sleep = (increase_reservation(credit) != 0); + if (credit < 0) + need_sleep = (decrease_reservation(-credit) != 0); + +#ifndef CONFIG_PREEMPT + if (need_resched()) + schedule(); +#endif + } while ((credit != 0) && !need_sleep); + + /* Schedule more work if there is some still to be done. */ + if (current_target() != current_pages) + timeout(balloon_alarm, NULL, ticks + HZ); + + msleep(balloon_process, balloon_lock, 0, "balloon", -1); + } + +} + +/* Resets the Xen limit, sets new target, and kicks off processing. */ +static void +set_new_target(unsigned long target) +{ + /* No need for lock. Not read-modify-write updates. */ + hard_limit = ~0UL; + target_pages = target; + wakeup(balloon_process); +} + +static struct xenbus_watch target_watch = +{ + .node = "memory/target" +}; + +/* React to a change in the target key */ +static void +watch_target(struct xenbus_watch *watch, + const char **vec, unsigned int len) +{ + unsigned long long new_target; + int err; + + err = xenbus_scanf(NULL, "memory", "target", "%llu", &new_target); + if (err != 1) { + /* This is ok (for domain0 at least) - so just return */ + return; + } + + /* The given memory/target value is in KiB, so it needs converting to + pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10. + */ + set_new_target(new_target >> (PAGE_SHIFT - 10)); + +} + +static void +balloon_init_watcher(void *) +{ + int err; + + err = register_xenbus_watch(&target_watch); + if (err) + printf("Failed to set balloon watcher\n"); + +} + +static void +balloon_init(void *) +{ + unsigned long pfn; + struct page *page; + + IPRINTK("Initialising balloon driver.\n"); + + if (xen_init() < 0) + return -1; + + current_pages = min(xen_start_info->nr_pages, max_pfn); + target_pages = current_pages; + balloon_low = 0; + balloon_high = 0; + driver_pages = 0UL; + hard_limit = ~0UL; + + init_timer(&balloon_timer); + balloon_timer.data = 0; + balloon_timer.function = balloon_alarm; + + /* Initialise the balloon with excess memory space. */ + for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) { + page = PHYS_TO_VM_PAGE(pfn << PAGE_SHIFT); + balloon_append(page); + } + + target_watch.callback = watch_target; + + return 0; +} + +void +balloon_update_driver_allowance(long delta) +{ + unsigned long flags; + + balloon_lock(flags); + driver_pages += delta; + balloon_unlock(flags); +} + +#if 0 +static int dealloc_pte_fn( + pte_t *pte, struct page *pte_page, unsigned long addr, void *data) +{ + unsigned long mfn = pte_mfn(*pte); + int ret; + struct xen_memory_reservation reservation = { + .extent_start = &mfn, + .nr_extents = 1, + .extent_order = 0, + .domid = DOMID_SELF + }; + set_pte_at(&init_mm, addr, pte, __pte_ma(0)); + set_phys_to_machine(__pa(addr) >> PAGE_SHIFT, INVALID_P2M_ENTRY); + ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); + PANIC_IF(ret != 1); + return 0; +} + +#endif +vm_page_t +balloon_alloc_empty_page_range(unsigned long nr_pages) +{ + unsigned long flags; + vm_page_t pages; + int i; + unsigned long *mfn_list; + struct xen_memory_reservation reservation = { + .address_bits = 0, + .extent_order = 0, + .domid = DOMID_SELF + }; + + pages = vm_page_alloc_contig(nr_pages, 0, -1, 4, 4) + if (pages == NULL) + return NULL; + + mfn_list = malloc(nr_pages*sizeof(unsigned long), M_DEVBUF, M_WAITOK); + + for (i = 0; i < nr_pages; i++) { + mfn_list[i] = PFNTOMFN(VM_PAGE_TO_PHYS(pages[i]) >> PAGE_SHIFT); + PFNTOMFN(i) = INVALID_P2M_ENTRY; + reservation.extent_start = mfn_list; + reservation.nr_extents = nr_pages; + PANIC_IF(HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation) != nr_pages); + } + + current_pages -= nr_pages; + + wakeup(balloon_process); + + return pages; +} + +void +balloon_dealloc_empty_page_range(vm_page_t page, unsigned long nr_pages) +{ + unsigned long i, flags; + + for (i = 0; i < nr_pages; i++) + balloon_append(page + i); + + wakeup(balloon_process); +} + +#endif Added: user/kmacy/releng_7_2_xen/sys/dev/xen/blkback/blkback.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_xen/sys/dev/xen/blkback/blkback.c Thu May 28 19:05:26 2009 (r192990) @@ -0,0 +1,1349 @@ +/* + * Copyright (c) 2006, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Cisco Systems, Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#if XEN_BLKBACK_DEBUG +#define DPRINTF(fmt, args...) \ + printf("blkback (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) +#else +#define DPRINTF(fmt, args...) ((void)0) +#endif + +#define WPRINTF(fmt, args...) \ + printf("blkback (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) + +#define BLKBACK_INVALID_HANDLE (~0) + +struct ring_ref { + vm_offset_t va; + grant_handle_t handle; + uint64_t bus_addr; +}; + +typedef struct blkback_info { + + /* Schedule lists */ + STAILQ_ENTRY(blkback_info) next_req; + int on_req_sched_list; + + struct xenbus_device *xdev; + XenbusState frontend_state; + + domid_t domid; + + int state; + int ring_connected; + struct ring_ref rr; + blkif_back_ring_t ring; + evtchn_port_t evtchn; + int irq; + void *irq_cookie; + + int ref_cnt; + + int handle; + char *mode; + char *type; + char *dev_name; + + struct vnode *vn; + struct cdev *cdev; + struct cdevsw *csw; + u_int sector_size; + int sector_size_shift; + off_t media_size; + u_int media_num_sectors; + int major; + int minor; + int read_only; + + struct mtx blk_ring_lock; + + device_t ndev; + + /* Stats */ + int st_rd_req; + int st_wr_req; + int st_oo_req; + int st_err_req; +} blkif_t; + +/* + * These are rather arbitrary. They are fairly large because adjacent requests + * pulled from a communication ring are quite likely to end up being part of + * the same scatter/gather request at the disc. + * + * ** TRY INCREASING 'blkif_reqs' IF WRITE SPEEDS SEEM TOO LOW ** + * + * This will increase the chances of being able to write whole tracks. + * 64 should be enough to keep us competitive with Linux. + */ +static int blkif_reqs = 64; +TUNABLE_INT("xen.vbd.blkif_reqs", &blkif_reqs); + +static int mmap_pages; + +/* + * Each outstanding request that we've passed to the lower device layers has a + * 'pending_req' allocated to it. Each buffer_head that completes decrements + * the pendcnt towards zero. When it hits zero, the specified domain has a + * response queued for it, with the saved 'id' passed back. + */ +typedef struct pending_req { + blkif_t *blkif; + uint64_t id; + int nr_pages; + int pendcnt; + unsigned short operation; + int status; + STAILQ_ENTRY(pending_req) free_list; +} pending_req_t; + +static pending_req_t *pending_reqs; +static STAILQ_HEAD(pending_reqs_list, pending_req) pending_free = + STAILQ_HEAD_INITIALIZER(pending_free); +static struct mtx pending_free_lock; + +static STAILQ_HEAD(blkback_req_sched_list, blkback_info) req_sched_list = + STAILQ_HEAD_INITIALIZER(req_sched_list); +static struct mtx req_sched_list_lock; + +static unsigned long mmap_vstart; +static unsigned long *pending_vaddrs; +static grant_handle_t *pending_grant_handles; + +static struct task blk_req_task; + +/* Protos */ +static void disconnect_ring(blkif_t *blkif); +static int vbd_add_dev(struct xenbus_device *xdev); + +static inline int vaddr_pagenr(pending_req_t *req, int seg) +{ + return (req - pending_reqs) * BLKIF_MAX_SEGMENTS_PER_REQUEST + seg; +} + +static inline unsigned long vaddr(pending_req_t *req, int seg) +{ + return pending_vaddrs[vaddr_pagenr(req, seg)]; +} + +#define pending_handle(_req, _seg) \ + (pending_grant_handles[vaddr_pagenr(_req, _seg)]) + +static unsigned long +alloc_empty_page_range(unsigned long nr_pages) +{ + void *pages; + int i = 0, j = 0; + multicall_entry_t mcl[17]; + unsigned long mfn_list[16]; + struct xen_memory_reservation reservation = { + .extent_start = mfn_list, + .nr_extents = 0, + .address_bits = 0, + .extent_order = 0, + .domid = DOMID_SELF + }; + + pages = malloc(nr_pages*PAGE_SIZE, M_DEVBUF, M_NOWAIT); + if (pages == NULL) + return 0; + + memset(mcl, 0, sizeof(mcl)); + + while (i < nr_pages) { + unsigned long va = (unsigned long)pages + (i++ * PAGE_SIZE); + + mcl[j].op = __HYPERVISOR_update_va_mapping; + mcl[j].args[0] = va; + + mfn_list[j++] = vtomach(va) >> PAGE_SHIFT; + + xen_phys_machine[(vtophys(va) >> PAGE_SHIFT)] = INVALID_P2M_ENTRY; + + if (j == 16 || i == nr_pages) { + mcl[j-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_LOCAL; + + reservation.nr_extents = j; + + mcl[j].op = __HYPERVISOR_memory_op; + mcl[j].args[0] = XENMEM_decrease_reservation; + mcl[j].args[1] = (unsigned long)&reservation; + + (void)HYPERVISOR_multicall(mcl, j+1); + + mcl[j-1].args[MULTI_UVMFLAGS_INDEX] = 0; + j = 0; + } + } + + return (unsigned long)pages; +} + +static pending_req_t * +alloc_req(void) +{ + pending_req_t *req; + mtx_lock(&pending_free_lock); + if ((req = STAILQ_FIRST(&pending_free))) { + STAILQ_REMOVE(&pending_free, req, pending_req, free_list); + STAILQ_NEXT(req, free_list) = NULL; + } + mtx_unlock(&pending_free_lock); + return req; +} + +static void +free_req(pending_req_t *req) +{ + int was_empty; + + mtx_lock(&pending_free_lock); + was_empty = STAILQ_EMPTY(&pending_free); + STAILQ_INSERT_TAIL(&pending_free, req, free_list); + mtx_unlock(&pending_free_lock); + if (was_empty) + taskqueue_enqueue(taskqueue_swi, &blk_req_task); +} + +static void +fast_flush_area(pending_req_t *req) +{ + struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + unsigned int i, invcount = 0; + grant_handle_t handle; + int ret; + + for (i = 0; i < req->nr_pages; i++) { + handle = pending_handle(req, i); + if (handle == BLKBACK_INVALID_HANDLE) + continue; + unmap[invcount].host_addr = vaddr(req, i); + unmap[invcount].dev_bus_addr = 0; + unmap[invcount].handle = handle; + pending_handle(req, i) = BLKBACK_INVALID_HANDLE; + invcount++; + } + + ret = HYPERVISOR_grant_table_op( + GNTTABOP_unmap_grant_ref, unmap, invcount); + PANIC_IF(ret); +} + +static void +blkif_get(blkif_t *blkif) +{ + atomic_add_int(&blkif->ref_cnt, 1); +} + +static void +blkif_put(blkif_t *blkif) +{ + if (atomic_fetchadd_int(&blkif->ref_cnt, -1) == 1) { + DPRINTF("Removing %x\n", (unsigned int)blkif); + disconnect_ring(blkif); + if (blkif->mode) + free(blkif->mode, M_DEVBUF); + if (blkif->type) + free(blkif->type, M_DEVBUF); + if (blkif->dev_name) + free(blkif->dev_name, M_DEVBUF); + free(blkif, M_DEVBUF); + } +} + +static int +blkif_create(struct xenbus_device *xdev, long handle, char *mode, char *type, char *params) +{ + blkif_t *blkif; + + blkif = (blkif_t *)malloc(sizeof(*blkif), M_DEVBUF, M_NOWAIT | M_ZERO); + if (!blkif) + return ENOMEM; + + DPRINTF("Created %x\n", (unsigned int)blkif); + + blkif->ref_cnt = 1; + blkif->domid = xdev->otherend_id; + blkif->handle = handle; + blkif->mode = mode; + blkif->type = type; + blkif->dev_name = params; + blkif->xdev = xdev; + xdev->data = blkif; + + mtx_init(&blkif->blk_ring_lock, "blk_ring_ock", "blkback ring lock", MTX_DEF); + + if (strcmp(mode, "w")) + blkif->read_only = 1; + + return 0; +} + +static void +add_to_req_schedule_list_tail(blkif_t *blkif) +{ + if (!blkif->on_req_sched_list) { + mtx_lock(&req_sched_list_lock); + if (!blkif->on_req_sched_list && (blkif->state == XenbusStateConnected)) { + blkif_get(blkif); + STAILQ_INSERT_TAIL(&req_sched_list, blkif, next_req); + blkif->on_req_sched_list = 1; + taskqueue_enqueue(taskqueue_swi, &blk_req_task); + } + mtx_unlock(&req_sched_list_lock); + } +} + +/* This routine does not call blkif_get(), does not schedule the blk_req_task to run, + and assumes that the state is connected */ +static void +add_to_req_schedule_list_tail2(blkif_t *blkif) +{ + mtx_lock(&req_sched_list_lock); + if (!blkif->on_req_sched_list) { + STAILQ_INSERT_TAIL(&req_sched_list, blkif, next_req); + blkif->on_req_sched_list = 1; + } + mtx_unlock(&req_sched_list_lock); +} + +/* Removes blkif from front of list and does not call blkif_put() (caller must) */ +static blkif_t * +remove_from_req_schedule_list(void) +{ + blkif_t *blkif; + + mtx_lock(&req_sched_list_lock); + + if ((blkif = STAILQ_FIRST(&req_sched_list))) { + STAILQ_REMOVE(&req_sched_list, blkif, blkback_info, next_req); + STAILQ_NEXT(blkif, next_req) = NULL; + blkif->on_req_sched_list = 0; + } + + mtx_unlock(&req_sched_list_lock); + + return blkif; +} + +static void +make_response(blkif_t *blkif, uint64_t id, + unsigned short op, int st) +{ + blkif_response_t *resp; + blkif_back_ring_t *blk_ring = &blkif->ring; + int more_to_do = 0; + int notify; + + mtx_lock(&blkif->blk_ring_lock); + + + /* Place on the response ring for the relevant domain. */ + resp = RING_GET_RESPONSE(blk_ring, blk_ring->rsp_prod_pvt); + resp->id = id; + resp->operation = op; + resp->status = st; + blk_ring->rsp_prod_pvt++; + RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(blk_ring, notify); + + if (blk_ring->rsp_prod_pvt == blk_ring->req_cons) { + /* + * Tail check for pending requests. Allows frontend to avoid + * notifications if requests are already in flight (lower + * overheads and promotes batching). + */ + RING_FINAL_CHECK_FOR_REQUESTS(blk_ring, more_to_do); + + } else if (RING_HAS_UNCONSUMED_REQUESTS(blk_ring)) + more_to_do = 1; + + mtx_unlock(&blkif->blk_ring_lock); + + if (more_to_do) + add_to_req_schedule_list_tail(blkif); + + if (notify) + notify_remote_via_irq(blkif->irq); +} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri May 29 01:31:18 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADCF2106566B; Fri, 29 May 2009 01:31:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BDBD8FC08; Fri, 29 May 2009 01:31:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T1VIEj055839; Fri, 29 May 2009 01:31:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T1VI1J055838; Fri, 29 May 2009 01:31:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905290131.n4T1VI1J055838@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 01:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193010 - user/kmacy/releng_7_2_fcs/cddl/contrib/opensolaris/cmd/ztest X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 01:31:18 -0000 Author: kmacy Date: Fri May 29 01:31:18 2009 New Revision: 193010 URL: http://svn.freebsd.org/changeset/base/193010 Log: update ztest for new zil_replay Modified: user/kmacy/releng_7_2_fcs/cddl/contrib/opensolaris/cmd/ztest/ztest.c Modified: user/kmacy/releng_7_2_fcs/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- user/kmacy/releng_7_2_fcs/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri May 29 00:14:59 2009 (r193009) +++ user/kmacy/releng_7_2_fcs/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri May 29 01:31:18 2009 (r193010) @@ -1305,7 +1305,7 @@ ztest_dmu_objset_create_destroy(ztest_ar if (ztest_random(2) == 0 && dmu_objset_open(name, DMU_OST_OTHER, DS_MODE_OWNER, &os) == 0) { zr.zr_os = os; - zil_replay(os, &zr, &zr.zr_assign, ztest_replay_vector, NULL); + zil_replay(os, &zr, ztest_replay_vector); dmu_objset_close(os); } @@ -3322,8 +3322,7 @@ ztest_run(char *pool) if (test_future) ztest_dmu_check_future_leak(&za[t]); zr.zr_os = za[d].za_os; - zil_replay(zr.zr_os, &zr, &zr.zr_assign, - ztest_replay_vector, NULL); + zil_replay(zr.zr_os, &zr, ztest_replay_vector); za[d].za_zilog = zil_open(za[d].za_os, NULL); } From owner-svn-src-user@FreeBSD.ORG Fri May 29 19:06:03 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26B211065676; Fri, 29 May 2009 19:06:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 136BD8FC1A; Fri, 29 May 2009 19:06:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TJ63kd083720; Fri, 29 May 2009 19:06:03 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TJ62gh083715; Fri, 29 May 2009 19:06:02 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905291906.n4TJ62gh083715@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 19:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193049 - user/kmacy/releng_7_2_fcs/sys/libkern/zlib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 19:06:03 -0000 Author: kmacy Date: Fri May 29 19:06:02 2009 New Revision: 193049 URL: http://svn.freebsd.org/changeset/base/193049 Log: import modern zlib 1.2.3 in to libkern Added: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/adler32.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/compress.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/crc32.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/crc32.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/deflate.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/deflate.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inffast.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inffast.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inffixed.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inflate.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inflate.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inftrees.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inftrees.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/trees.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/trees.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/uncompr.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zconf.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zl_crc32.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zlib.h (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c (contents, props changed) user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h (contents, props changed) Added: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/adler32.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/adler32.c Fri May 29 19:06:02 2009 (r193049) @@ -0,0 +1,149 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2004 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include + +#define BASE 65521UL /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +/* use NO_DIVIDE if your processor does not do division in hardware */ +#ifdef NO_DIVIDE +# define MOD(a) \ + do { \ + if (a >= (BASE << 16)) a -= (BASE << 16); \ + if (a >= (BASE << 15)) a -= (BASE << 15); \ + if (a >= (BASE << 14)) a -= (BASE << 14); \ + if (a >= (BASE << 13)) a -= (BASE << 13); \ + if (a >= (BASE << 12)) a -= (BASE << 12); \ + if (a >= (BASE << 11)) a -= (BASE << 11); \ + if (a >= (BASE << 10)) a -= (BASE << 10); \ + if (a >= (BASE << 9)) a -= (BASE << 9); \ + if (a >= (BASE << 8)) a -= (BASE << 8); \ + if (a >= (BASE << 7)) a -= (BASE << 7); \ + if (a >= (BASE << 6)) a -= (BASE << 6); \ + if (a >= (BASE << 5)) a -= (BASE << 5); \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +# define MOD4(a) \ + do { \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +#else +# define MOD(a) a %= BASE +# define MOD4(a) a %= BASE +#endif + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) { + adler += buf[0]; + if (adler >= BASE) + adler -= BASE; + sum2 += adler; + if (sum2 >= BASE) + sum2 -= BASE; + return adler | (sum2 << 16); + } + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (buf == Z_NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) { + while (len--) { + adler += *buf++; + sum2 += adler; + } + if (adler >= BASE) + adler -= BASE; + MOD4(sum2); /* only added so many BASE's */ + return adler | (sum2 << 16); + } + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; + n = NMAX / 16; /* NMAX is divisible by 16 */ + do { + DO16(buf); /* 16 sums unrolled */ + buf += 16; + } while (--n); + MOD(adler); + MOD(sum2); + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + if (len) { /* avoid modulos if none remaining */ + while (len >= 16) { + len -= 16; + DO16(buf); + buf += 16; + } + while (len--) { + adler += *buf++; + sum2 += adler; + } + MOD(adler); + MOD(sum2); + } + + /* return recombined sums */ + return adler | (sum2 << 16); +} + +/* ========================================================================= */ +uLong ZEXPORT adler32_combine(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off_t len2; +{ + unsigned long sum1; + unsigned long sum2; + unsigned rem; + + /* the derivation of this formula is left as an exercise for the reader */ + rem = (unsigned)(len2 % BASE); + sum1 = adler1 & 0xffff; + sum2 = rem * sum1; + MOD(sum2); + sum1 += (adler2 & 0xffff) + BASE - 1; + sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; + if (sum1 > BASE) sum1 -= BASE; + if (sum1 > BASE) sum1 -= BASE; + if (sum2 > (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 > BASE) sum2 -= BASE; + return sum1 | (sum2 << 16); +} Added: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/compress.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/compress.c Fri May 29 19:06:02 2009 (r193049) @@ -0,0 +1,80 @@ +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include +#include + +/* =========================================================================== + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; + int level; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)(uintptr_t)(const void *)source; + stream.avail_in = (uInt)sourceLen; +#ifdef MAXSEG_64K + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; +#endif + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; + + err = deflateInit(&stream, level); + if (err != Z_OK) return err; + + err = deflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + deflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = deflateEnd(&stream); + return err; +} + +/* =========================================================================== + */ +int ZEXPORT compress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); +} + +/* =========================================================================== + If the default memLevel or windowBits for deflateInit() is changed, then + this function needs to be updated. + */ +uLong ZEXPORT compressBound (sourceLen) + uLong sourceLen; +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; +} Added: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/crc32.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/crc32.c Fri May 29 19:06:02 2009 (r193049) @@ -0,0 +1,423 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Thanks to Rodney Brown for his contribution of faster + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing + * tables for updating the shift register in one step with three exclusive-ors + * instead of four steps with four exclusive-ors. This results in about a + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for STDC and FAR definitions */ + +#define local static + +/* Find a four-byte integer type for crc32_little() and crc32_big(). */ +#ifndef NOBYFOUR +# ifdef STDC /* need ANSI C limits.h to determine sizes */ +# include +# define BYFOUR +# if (UINT_MAX == 0xffffffffUL) + typedef unsigned int u4; +# else +# if (ULONG_MAX == 0xffffffffUL) + typedef unsigned long u4; +# else +# if (USHRT_MAX == 0xffffffffUL) + typedef unsigned short u4; +# else +# undef BYFOUR /* can't find a four-byte integer type! */ +# endif +# endif +# endif +# endif /* STDC */ +#endif /* !NOBYFOUR */ + +/* Definitions for doing the crc four data bytes at a time. */ +#ifdef BYFOUR +# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ + (((w)&0xff00)<<8)+(((w)&0xff)<<24)) + local unsigned long crc32_little OF((unsigned long, + const unsigned char FAR *, unsigned)); + local unsigned long crc32_big OF((unsigned long, + const unsigned char FAR *, unsigned)); +# define TBLS 8 +#else +# define TBLS 1 +#endif /* BYFOUR */ + +/* Local functions for crc concatenation */ +local unsigned long gf2_matrix_times OF((unsigned long *mat, + unsigned long vec)); +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); + +#ifdef DYNAMIC_CRC_TABLE + +local volatile int crc_table_empty = 1; +local unsigned long FAR crc_table[TBLS][256]; +local void make_crc_table OF((void)); +#ifdef MAKECRCH + local void write_table OF((FILE *, const unsigned long FAR *)); +#endif /* MAKECRCH */ +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The first table is simply the CRC of all possible eight bit values. This is + all the information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. The remaining tables + allow for word-at-a-time CRC calculation for both big-endian and little- + endian machines, where a word is four bytes. +*/ +local void make_crc_table() +{ + unsigned long c; + int n, k; + unsigned long poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static volatile int first = 1; /* flag to limit concurrent making */ + static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* See if another task is already doing this (not thread-safe, but better + than nothing -- significantly reduces duration of vulnerability in + case the advice about DYNAMIC_CRC_TABLE is ignored) */ + if (first) { + first = 0; + + /* make exclusive-or pattern from polynomial (0xedb88320UL) */ + poly = 0UL; + for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) + poly |= 1UL << (31 - p[n]); + + /* generate a crc for every 8-bit value */ + for (n = 0; n < 256; n++) { + c = (unsigned long)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[0][n] = c; + } + +#ifdef BYFOUR + /* generate crc for each value followed by one, two, and three zeros, + and then the byte reversal of those as well as the first table */ + for (n = 0; n < 256; n++) { + c = crc_table[0][n]; + crc_table[4][n] = REV(c); + for (k = 1; k < 4; k++) { + c = crc_table[0][c & 0xff] ^ (c >> 8); + crc_table[k][n] = c; + crc_table[k + 4][n] = REV(c); + } + } +#endif /* BYFOUR */ + + crc_table_empty = 0; + } + else { /* not first */ + /* wait for the other guy to finish (not efficient, but rare) */ + while (crc_table_empty) + ; + } + +#ifdef MAKECRCH + /* write out CRC tables to crc32.h */ + { + FILE *out; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); + fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); + fprintf(out, "local const unsigned long FAR "); + fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); + write_table(out, crc_table[0]); +# ifdef BYFOUR + fprintf(out, "#ifdef BYFOUR\n"); + for (k = 1; k < 8; k++) { + fprintf(out, " },\n {\n"); + write_table(out, crc_table[k]); + } + fprintf(out, "#endif\n"); +# endif /* BYFOUR */ + fprintf(out, " }\n};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH +local void write_table(out, table) + FILE *out; + const unsigned long FAR *table; +{ + int n; + + for (n = 0; n < 256; n++) + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); +} +#endif /* MAKECRCH */ + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const unsigned long FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + return (const unsigned long FAR *)crc_table; +} + +/* ========================================================================= */ +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + +/* ========================================================================= */ +unsigned long ZEXPORT zl_crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + if (buf == Z_NULL) return 0UL; + +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + +#ifdef BYFOUR + if (sizeof(void *) == sizeof(ptrdiff_t)) { + u4 endian; + + endian = 1; + if (*((unsigned char *)(&endian))) + return crc32_little(crc, buf, len); + else + return crc32_big(crc, buf, len); + } +#endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; + while (len >= 8) { + DO8; + len -= 8; + } + if (len) do { + DO1; + } while (--len); + return crc ^ 0xffffffffUL; +} + +#ifdef BYFOUR + +/* ========================================================================= */ +#define DOLIT4 c ^= *buf4++; \ + c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 + +/* ========================================================================= */ +local unsigned long crc32_little(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = (u4)crc; + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + while (len >= 32) { + DOLIT32; + len -= 32; + } + while (len >= 4) { + DOLIT4; + len -= 4; + } + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + } while (--len); + c = ~c; + return (unsigned long)c; +} + +/* ========================================================================= */ +#define DOBIG4 c ^= *++buf4; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + +/* ========================================================================= */ +local unsigned long crc32_big(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = REV((u4)crc); + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; + } + while (len >= 4) { + DOBIG4; + len -= 4; + } + buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + } while (--len); + c = ~c; + return (unsigned long)(REV(c)); +} + +#endif /* BYFOUR */ + +#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ + +/* ========================================================================= */ +local unsigned long gf2_matrix_times(mat, vec) + unsigned long *mat; + unsigned long vec; +{ + unsigned long sum; + + sum = 0; + while (vec) { + if (vec & 1) + sum ^= *mat; + vec >>= 1; + mat++; + } + return sum; +} + +/* ========================================================================= */ +local void gf2_matrix_square(square, mat) + unsigned long *square; + unsigned long *mat; +{ + int n; + + for (n = 0; n < GF2_DIM; n++) + square[n] = gf2_matrix_times(mat, mat[n]); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off_t len2; +{ + int n; + unsigned long row; + unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ + unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ + + /* degenerate case */ + if (len2 == 0) + return crc1; + + /* put operator for one zero bit in odd */ + odd[0] = 0xedb88320L; /* CRC-32 polynomial */ + row = 1; + for (n = 1; n < GF2_DIM; n++) { + odd[n] = row; + row <<= 1; + } + + /* put operator for two zero bits in even */ + gf2_matrix_square(even, odd); + + /* put operator for four zero bits in odd */ + gf2_matrix_square(odd, even); + + /* apply len2 zeros to crc1 (first square will put the operator for one + zero byte, eight zero bits, in even) */ + do { + /* apply zeros operator for this bit of len2 */ + gf2_matrix_square(even, odd); + if (len2 & 1) + crc1 = gf2_matrix_times(even, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + if (len2 == 0) + break; + + /* another iteration of the loop with odd and even swapped */ + gf2_matrix_square(odd, even); + if (len2 & 1) + crc1 = gf2_matrix_times(odd, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + } while (len2 != 0); + + /* return combined crc */ + crc1 ^= crc2; + return crc1; +} Added: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/crc32.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/crc32.h Fri May 29 19:06:02 2009 (r193049) @@ -0,0 +1,441 @@ +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const unsigned long FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri May 29 19:09:53 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D62D81065687; Fri, 29 May 2009 19:09:53 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1DC08FC19; Fri, 29 May 2009 19:09:53 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TJ9rUO083832; Fri, 29 May 2009 19:09:53 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TJ9rda083820; Fri, 29 May 2009 19:09:53 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905291909.n4TJ9rda083820@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 19:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193050 - in user/kmacy/releng_7_2_fcs/sys: cddl/contrib/opensolaris/uts/common/zmod conf dev/mxge geom/uzip kern modules/zlib net netgraph opencrypto X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 19:09:54 -0000 Author: kmacy Date: Fri May 29 19:09:53 2009 New Revision: 193050 URL: http://svn.freebsd.org/changeset/base/193050 Log: switch kernel over to pointing at zlib 1.2.3 Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c user/kmacy/releng_7_2_fcs/sys/conf/files user/kmacy/releng_7_2_fcs/sys/dev/mxge/if_mxge.c user/kmacy/releng_7_2_fcs/sys/geom/uzip/g_uzip.c user/kmacy/releng_7_2_fcs/sys/kern/link_elf.c user/kmacy/releng_7_2_fcs/sys/kern/link_elf_obj.c user/kmacy/releng_7_2_fcs/sys/modules/zlib/Makefile user/kmacy/releng_7_2_fcs/sys/net/ppp_deflate.c user/kmacy/releng_7_2_fcs/sys/netgraph/ng_deflate.c user/kmacy/releng_7_2_fcs/sys/opencrypto/deflate.c user/kmacy/releng_7_2_fcs/sys/opencrypto/deflate.h Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c Fri May 29 19:09:53 2009 (r193050) @@ -36,6 +36,7 @@ * The resulting decompressed size is then returned through dstlen. This * function return Z_OK on success, or another error code on failure. */ +#if 0 int z_uncompress(void *dst, size_t *dstlen, const void *src, size_t srclen) { @@ -64,6 +65,7 @@ z_uncompress(void *dst, size_t *dstlen, *dstlen = zs.total_out; return (inflateEnd(&zs)); } +#endif int z_compress_level(void *dst, size_t *dstlen, const void *src, size_t srclen, @@ -91,13 +93,6 @@ z_compress_level(void *dst, size_t *dstl return (deflateEnd(&zs)); } -int -z_compress(void *dst, size_t *dstlen, const void *src, size_t srclen) -{ - return (z_compress_level(dst, dstlen, src, srclen, - Z_DEFAULT_COMPRESSION)); -} - /* * Convert a zlib error code into a string error message. */ @@ -111,3 +106,12 @@ z_strerror(int err) return (zError(err)); } + +#if 0 +int +z_compress(void *dst, size_t *dstlen, const void *src, size_t srclen) +{ + return (z_compress_level(dst, dstlen, src, srclen, + Z_DEFAULT_COMPRESSION)); +} +#endif Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c Fri May 29 19:09:53 2009 (r193050) @@ -30,40 +30,7 @@ #include #include -struct zchdr { - uint_t zch_magic; - uint_t zch_size; -}; - -#define ZCH_MAGIC 0x3cc13cc1 - -/*ARGSUSED*/ -void * -zcalloc(void *opaque, uint_t items, uint_t size) -{ - size_t nbytes = sizeof (struct zchdr) + items * size; - struct zchdr *z = kobj_zalloc(nbytes, KM_NOWAIT|KM_TMP); - - if (z == NULL) - return (NULL); - - z->zch_magic = ZCH_MAGIC; - z->zch_size = nbytes; - - return (z + 1); -} - /*ARGSUSED*/ -void -zcfree(void *opaque, void *ptr) -{ - struct zchdr *z = ((struct zchdr *)ptr) - 1; - - if (z->zch_magic != ZCH_MAGIC) - panic("zcfree region corrupt: hdr=%p ptr=%p", (void *)z, ptr); - - kobj_free(z, z->zch_size); -} void zmemcpy(void *dest, const void *source, uint_t len) Modified: user/kmacy/releng_7_2_fcs/sys/conf/files ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/files Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/conf/files Fri May 29 19:09:53 2009 (r193050) @@ -1523,62 +1523,7 @@ gnu/fs/reiserfs/reiserfs_stree.c optiona gnu/fs/reiserfs/reiserfs_vfsops.c optional reiserfs gnu/fs/reiserfs/reiserfs_vnops.c optional reiserfs # -# isdn4bsd device drivers -# -i4b/driver/i4b_trace.c optional i4btrc -i4b/driver/i4b_rbch.c optional i4brbch -i4b/driver/i4b_tel.c optional i4btel -#XXXBZ#i4b/driver/i4b_ipr.c optional i4bipr -net/slcompress.c optional i4bipr | i4bisppp -i4b/driver/i4b_ctl.c optional i4bctl -#XXXBZ#i4b/driver/i4b_ing.c optional i4bing -#XXXBZ#i4b/driver/i4b_isppp.c optional i4bisppp -# -# isdn4bsd CAPI driver -# -i4b/capi/capi_l4if.c optional i4bcapi -i4b/capi/capi_llif.c optional i4bcapi -i4b/capi/capi_msgs.c optional i4bcapi -# -# isdn4bsd AVM B1/T1 CAPI driver -# -i4b/capi/iavc/iavc_pci.c optional iavc i4bcapi pci -i4b/capi/iavc/iavc_isa.c optional iavc i4bcapi isa -i4b/capi/iavc/iavc_lli.c optional iavc i4bcapi -i4b/capi/iavc/iavc_card.c optional iavc i4bcapi -# -# isdn4bsd support -# -i4b/layer2/i4b_mbuf.c optional i4btrc -# -# isdn4bsd Q.921 handler -# -i4b/layer2/i4b_l2.c optional i4bq921 -i4b/layer2/i4b_l2fsm.c optional i4bq921 -i4b/layer2/i4b_uframe.c optional i4bq921 -i4b/layer2/i4b_tei.c optional i4bq921 -i4b/layer2/i4b_sframe.c optional i4bq921 -i4b/layer2/i4b_iframe.c optional i4bq921 -i4b/layer2/i4b_l2timer.c optional i4bq921 -i4b/layer2/i4b_util.c optional i4bq921 -i4b/layer2/i4b_lme.c optional i4bq921 -# -# isdn4bsd Q.931 handler -# -i4b/layer3/i4b_q931.c optional i4bq931 -i4b/layer3/i4b_l3fsm.c optional i4bq931 -i4b/layer3/i4b_l3timer.c optional i4bq931 -i4b/layer3/i4b_l2if.c optional i4bq931 -i4b/layer3/i4b_l4if.c optional i4bq931 -i4b/layer3/i4b_q932fac.c optional i4bq931 -# -# isdn4bsd control device driver, interface to isdnd -# -i4b/layer4/i4b_i4bdrv.c optional i4b -i4b/layer4/i4b_l4.c optional i4b -i4b/layer4/i4b_l4mgmt.c optional i4b -i4b/layer4/i4b_l4timer.c optional i4b -# + isa/isa_if.m standard isa/isa_common.c optional isa isa/isahint.c optional isa @@ -1599,7 +1544,6 @@ kern/cpufreq_if.m standard kern/device_if.m standard kern/imgact_elf.c standard kern/imgact_shell.c standard -kern/inflate.c optional gzip kern/init_main.c standard kern/init_sysent.c standard kern/ksched.c optional _kposix_priority_scheduling @@ -1852,9 +1796,36 @@ net/route.c standard net/rtsock.c standard net/slcompress.c optional netgraph_vjc | ppp | sl | sppp | \ netgraph_sppp -net/zlib.c optional crypto | geom_uzip | ipsec | \ - mxge | ppp_deflate | zfs | \ - netgraph_deflate | ddb_ctf +libkern/zlib/adler32.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/compress.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/deflate.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/inflate.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/inffast.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/inftrees.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/trees.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/uncompr.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/zutil.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip +libkern/zlib/zl_crc32.c optional zfs | crypto | geom_uzip | ipsec | \ + mxge | ppp_deflate | \ + netgraph_deflate | ddb_ctf | gzip net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan_acl net80211/ieee80211_amrr.c optional wlan_amrr @@ -2449,19 +2420,6 @@ cddl/contrib/opensolaris/uts/common/os/n compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" cddl/contrib/opensolaris/uts/common/os/taskq.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/inflate.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/inftrees.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/adler32.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs \ - compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" - - - cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c optional zfs \ @@ -2623,9 +2581,22 @@ cddl/contrib/opensolaris/uts/common/fs/z # compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" #cddl/contrib/opensolaris/uts/common/zmod/trees.c optional zfs \ # compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" #cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs \ # compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/inflate.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/inftrees.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/adler32.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_IsNC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" +#cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs \ +# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + +cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs \ + compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" + + Modified: user/kmacy/releng_7_2_fcs/sys/dev/mxge/if_mxge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/mxge/if_mxge.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/dev/mxge/if_mxge.c Fri May 29 19:09:53 2009 (r193050) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: user/kmacy/releng_7_2_fcs/sys/geom/uzip/g_uzip.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/geom/uzip/g_uzip.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/geom/uzip/g_uzip.c Fri May 29 19:09:53 2009 (r193050) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #undef GEOM_UZIP_DEBUG #ifdef GEOM_UZIP_DEBUG Modified: user/kmacy/releng_7_2_fcs/sys/kern/link_elf.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/link_elf.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/kern/link_elf.c Fri May 29 19:09:53 2009 (r193050) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef DDB_CTF -#include +#include #endif #include "linker_if.h" Modified: user/kmacy/releng_7_2_fcs/sys/kern/link_elf_obj.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/link_elf_obj.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/kern/link_elf_obj.c Fri May 29 19:09:53 2009 (r193050) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef DDB_CTF -#include +#include #endif #include "linker_if.h" Modified: user/kmacy/releng_7_2_fcs/sys/modules/zlib/Makefile ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/modules/zlib/Makefile Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/modules/zlib/Makefile Fri May 29 19:09:53 2009 (r193050) @@ -1,8 +1,9 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../net +.PATH: ${.CURDIR}/../../libkern/zlib KMOD= zlib -SRCS= zlib.c +SRCS= adler32.c compress.c deflate.c inflate.c inffast.c inftrees.c +SRCS+= trees.c uncompr.c zutil.c zl_crc32.c .include Modified: user/kmacy/releng_7_2_fcs/sys/net/ppp_deflate.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/ppp_deflate.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/net/ppp_deflate.c Fri May 29 19:09:53 2009 (r193050) @@ -38,7 +38,7 @@ #include #include -#include +#include #define PACKETPTR struct mbuf * #include Modified: user/kmacy/releng_7_2_fcs/sys/netgraph/ng_deflate.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netgraph/ng_deflate.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/netgraph/ng_deflate.c Fri May 29 19:09:53 2009 (r193050) @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include Modified: user/kmacy/releng_7_2_fcs/sys/opencrypto/deflate.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/opencrypto/deflate.c Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/opencrypto/deflate.c Fri May 29 19:09:53 2009 (r193050) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: user/kmacy/releng_7_2_fcs/sys/opencrypto/deflate.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/opencrypto/deflate.h Fri May 29 19:06:02 2009 (r193049) +++ user/kmacy/releng_7_2_fcs/sys/opencrypto/deflate.h Fri May 29 19:09:53 2009 (r193050) @@ -36,7 +36,7 @@ #ifndef _CRYPTO_DEFLATE_H_ #define _CRYPTO_DEFLATE_H_ -#include +#include #define Z_METHOD 8 #define Z_MEMLEVEL 8 From owner-svn-src-user@FreeBSD.ORG Fri May 29 19:42:32 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B22DD106564A; Fri, 29 May 2009 19:42:32 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63EAB8FC22; Fri, 29 May 2009 19:42:32 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TJgWC1084648; Fri, 29 May 2009 19:42:32 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TJgWGC084647; Fri, 29 May 2009 19:42:32 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905291942.n4TJgWGC084647@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 19:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193054 - user/kmacy/releng_7_2_fcs/sys/amd64/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 19:42:32 -0000 Author: kmacy Date: Fri May 29 19:42:32 2009 New Revision: 193054 URL: http://svn.freebsd.org/changeset/base/193054 Log: update to include USB and drm for desktop Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Fri May 29 19:37:17 2009 (r193053) +++ user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Fri May 29 19:42:32 2009 (r193054) @@ -25,7 +25,7 @@ ident GENERIC #hints "GENERIC.hints" # Default places to look for devices. makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="mxge zlib geom opensolaris zfs cxgb fxp nfe hwpmc linux linprocfs" +makeoptions MODULES_OVERRIDE="geom opensolaris zfs cxgb fxp nfe hwpmc linux linprocfs drm" makeoptions OPENSOLARIS options OPENSOLARIS @@ -207,19 +207,19 @@ device firmware # firmware assist modul device bpf # Berkeley packet filter # USB support -#device uhci # UHCI PCI->USB interface -#device ohci # OHCI PCI->USB interface -#device ehci # EHCI PCI->USB interface (USB 2.0) -#device usb # USB Bus (required) -#device udbp # USB Double Bulk Pipe devices -#device ugen # Generic -#device uhid # "Human Interface Devices" -#device ukbd # Keyboard -#device ulpt # Printer -#device umass # Disks/Mass storage - Requires scbus and da -#device ums # Mouse +device uhci # UHCI PCI->USB interface +device ohci # OHCI PCI->USB interface +device ehci # EHCI PCI->USB interface (USB 2.0) +device usb # USB Bus (required) +device ugen # Generic +device uhid # "Human Interface Devices" +device ukbd # Keyboard +device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da +device ums # Mouse #device urio # Diamond Rio 500 MP3 player #device uscanner # Scanners +#device udbp # USB Double Bulk Pipe devices # USB Serial devices #device ucom # Generic com ttys #device uark # Technologies ARK3116 based serial adapters @@ -238,3 +238,4 @@ options ALT_BREAK_TO_DEBUGGER options HWPMC_HOOKS options LOCK_PROFILING device mxge + From owner-svn-src-user@FreeBSD.ORG Fri May 29 19:48:08 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C22B1065698; Fri, 29 May 2009 19:48:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 397BA8FC30; Fri, 29 May 2009 19:48:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TJm8vt084834; Fri, 29 May 2009 19:48:08 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TJm8bo084833; Fri, 29 May 2009 19:48:08 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905291948.n4TJm8bo084833@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 19:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193056 - user/kmacy/releng_7_2_fcs/sys/modules/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 19:48:09 -0000 Author: kmacy Date: Fri May 29 19:48:07 2009 New Revision: 193056 URL: http://svn.freebsd.org/changeset/base/193056 Log: remove functionality provided by zlib Modified: user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile Modified: user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile Fri May 29 19:45:39 2009 (r193055) +++ user/kmacy/releng_7_2_fcs/sys/modules/zfs/Makefile Fri May 29 19:48:07 2009 (r193056) @@ -44,16 +44,7 @@ SRCS+= nvpair_alloc_system.c SRCS+= taskq.c .PATH: ${SUNW}/uts/common/zmod -SRCS+= adler32.c -SRCS+= opensolaris_crc32.c -SRCS+= deflate.c -SRCS+= inffast.c -SRCS+= inflate.c -SRCS+= inftrees.c -SRCS+= trees.c SRCS+= zmod.c -SRCS+= zmod_subr.c -SRCS+= zutil.c .PATH: ${SUNW}/common/zfs .include "${SUNW}/uts/common/Makefile.files" From owner-svn-src-user@FreeBSD.ORG Fri May 29 19:49:34 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAF3A1065676; Fri, 29 May 2009 19:49:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F65F8FC18; Fri, 29 May 2009 19:49:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TJnYXf084903; Fri, 29 May 2009 19:49:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TJnYfS084902; Fri, 29 May 2009 19:49:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905291949.n4TJnYfS084902@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 19:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193057 - user/kmacy/releng_7_2_fcs/sys/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 19:49:35 -0000 Author: kmacy Date: Fri May 29 19:49:34 2009 New Revision: 193057 URL: http://svn.freebsd.org/changeset/base/193057 Log: remove reference to redundant zlib files Modified: user/kmacy/releng_7_2_fcs/sys/conf/files Modified: user/kmacy/releng_7_2_fcs/sys/conf/files ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/conf/files Fri May 29 19:48:07 2009 (r193056) +++ user/kmacy/releng_7_2_fcs/sys/conf/files Fri May 29 19:49:34 2009 (r193057) @@ -2572,31 +2572,6 @@ cddl/contrib/opensolaris/uts/common/fs/z cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" - -# Compression routines conflicting with ZFS - -#cddl/contrib/opensolaris/uts/common/zmod/deflate.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/inffast.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/trees.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/inflate.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/inftrees.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/adler32.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_IsNC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" -#cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs \ -# compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" - cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs \ compile-with "${ZFS_C} ${OPENSOLARIS_INC} ${ZFS_INC} ${ZFS_CFLAGS}" - - - From owner-svn-src-user@FreeBSD.ORG Fri May 29 19:50:04 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A39E1065673; Fri, 29 May 2009 19:50:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DDEA8FC24; Fri, 29 May 2009 19:50:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TJo4Ku084954; Fri, 29 May 2009 19:50:04 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TJo4X2084953; Fri, 29 May 2009 19:50:04 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905291950.n4TJo4X2084953@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 19:50:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193058 - in user/kmacy/releng_7_2_fcs/sys: cddl/contrib/opensolaris/uts/common/zmod kern net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 19:50:04 -0000 Author: kmacy Date: Fri May 29 19:50:03 2009 New Revision: 193058 URL: http://svn.freebsd.org/changeset/base/193058 Log: retire redundant compression functionality Deleted: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/adler32.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/deflate.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/inffast.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/inflate.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/inftrees.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/trees.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zutil.c user/kmacy/releng_7_2_fcs/sys/kern/inflate.c user/kmacy/releng_7_2_fcs/sys/net/zlib.c user/kmacy/releng_7_2_fcs/sys/net/zlib.h Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c Fri May 29 19:49:34 2009 (r193057) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c Fri May 29 19:50:03 2009 (r193058) @@ -30,43 +30,6 @@ #include "zlib.h" #include "zutil.h" -/* - * Uncompress the buffer 'src' into the buffer 'dst'. The caller must store - * the expected decompressed data size externally so it can be passed in. - * The resulting decompressed size is then returned through dstlen. This - * function return Z_OK on success, or another error code on failure. - */ -#if 0 -int -z_uncompress(void *dst, size_t *dstlen, const void *src, size_t srclen) -{ - z_stream zs; - int err; - - bzero(&zs, sizeof (zs)); - zs.next_in = (uchar_t *)src; - zs.avail_in = srclen; - zs.next_out = dst; - zs.avail_out = *dstlen; - - /* - * Call inflateInit2() specifying a window size of DEF_WBITS - * with the 6th bit set to indicate that the compression format - * type (zlib or gzip) should be automatically detected. - */ - if ((err = inflateInit2(&zs, DEF_WBITS | 0x20)) != Z_OK) - return (err); - - if ((err = inflate(&zs, Z_FINISH)) != Z_STREAM_END) { - (void) inflateEnd(&zs); - return (err == Z_OK ? Z_BUF_ERROR : err); - } - - *dstlen = zs.total_out; - return (inflateEnd(&zs)); -} -#endif - int z_compress_level(void *dst, size_t *dstlen, const void *src, size_t srclen, int level) @@ -106,12 +69,3 @@ z_strerror(int err) return (zError(err)); } - -#if 0 -int -z_compress(void *dst, size_t *dstlen, const void *src, size_t srclen) -{ - return (z_compress_level(dst, dstlen, src, srclen, - Z_DEFAULT_COMPRESSION)); -} -#endif From owner-svn-src-user@FreeBSD.ORG Fri May 29 20:41:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDE03106566B; Fri, 29 May 2009 20:41:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACC4F8FC12; Fri, 29 May 2009 20:41:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TKfUTq086216; Fri, 29 May 2009 20:41:30 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TKfUEr086215; Fri, 29 May 2009 20:41:30 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905292041.n4TKfUEr086215@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 20:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193062 - user/kmacy/releng_7_2_fcs/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 20:41:31 -0000 Author: kmacy Date: Fri May 29 20:41:30 2009 New Revision: 193062 URL: http://svn.freebsd.org/changeset/base/193062 Log: mark invalid on error Modified: user/kmacy/releng_7_2_fcs/sys/boot/i386/libi386/biosdisk.c Modified: user/kmacy/releng_7_2_fcs/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/boot/i386/libi386/biosdisk.c Fri May 29 20:25:03 2009 (r193061) +++ user/kmacy/releng_7_2_fcs/sys/boot/i386/libi386/biosdisk.c Fri May 29 20:41:30 2009 (r193062) @@ -996,8 +996,10 @@ bd_open_gpt(struct open_disk *od, struct od->od_boff = gp->gp_start; out: - if (error) + if (error) { free(od->od_partitions); + od->od_flags &= ~BD_GPTOK; + } return (error); } @@ -1088,7 +1090,7 @@ bd_realstrategy(void *devdata, int rw, d switch(rw){ case F_READ: - DEBUG("read %d from %d to %p", blks, dblk, buf); + DEBUG("read %d from %lld to %p", blks, dblk, buf); if (blks && bd_read(od, dblk, blks, buf)) { DEBUG("read error"); From owner-svn-src-user@FreeBSD.ORG Fri May 29 20:42:57 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6FB01065673; Fri, 29 May 2009 20:42:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A34BB8FC0C; Fri, 29 May 2009 20:42:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TKgvgN086276; Fri, 29 May 2009 20:42:57 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TKgvvE086273; Fri, 29 May 2009 20:42:57 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905292042.n4TKgvvE086273@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 20:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193063 - in user/kmacy/releng_7_2_fcs/sys/boot: i386/kgzldr pc98/kgzldr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 20:42:58 -0000 Author: kmacy Date: Fri May 29 20:42:57 2009 New Revision: 193063 URL: http://svn.freebsd.org/changeset/base/193063 Log: inflate.c is needed by kgzldr - move there Added: user/kmacy/releng_7_2_fcs/sys/boot/i386/kgzldr/inflate.c (contents, props changed) Modified: user/kmacy/releng_7_2_fcs/sys/boot/i386/kgzldr/Makefile user/kmacy/releng_7_2_fcs/sys/boot/pc98/kgzldr/Makefile Modified: user/kmacy/releng_7_2_fcs/sys/boot/i386/kgzldr/Makefile ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/boot/i386/kgzldr/Makefile Fri May 29 20:41:30 2009 (r193062) +++ user/kmacy/releng_7_2_fcs/sys/boot/i386/kgzldr/Makefile Fri May 29 20:42:57 2009 (r193063) @@ -11,7 +11,6 @@ CFLAGS= -Os CFLAGS+=-DKZIP NO_SHARED= LDFLAGS=-Wl,-r -.PATH: ${.CURDIR}/../../../kern BOOT_COMCONSOLE_PORT?= 0x3f8 AFLAGS+=--defsym SIO_PRT=${BOOT_COMCONSOLE_PORT} Added: user/kmacy/releng_7_2_fcs/sys/boot/i386/kgzldr/inflate.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/sys/boot/i386/kgzldr/inflate.c Fri May 29 20:42:57 2009 (r193063) @@ -0,0 +1,1077 @@ +/* + * Most parts of this file are not covered by: + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#ifdef _KERNEL +#include +#include +#endif +#include + +#ifdef _KERNEL +static MALLOC_DEFINE(M_GZIP, "gzip_trees", "Gzip trees"); +#endif + +/* needed to make inflate() work */ +#define uch u_char +#define ush u_short +#define ulg u_long + +/* Stuff to make inflate() work */ +#ifdef _KERNEL +#define memzero(dest,len) bzero(dest,len) +#endif +#define NOMEMCPY +#ifdef _KERNEL +#define FPRINTF printf +#else +extern void putstr (char *); +#define FPRINTF putstr +#endif + +#define FLUSH(x,y) { \ + int foo = (*x->gz_output)(x->gz_private,x->gz_slide,y); \ + if (foo) \ + return foo; \ + } + +static const int qflag = 0; + +#ifndef _KERNEL /* want to use this file in kzip also */ +extern unsigned char *kzipmalloc (int); +extern void kzipfree (void*); +#define malloc(x, y, z) kzipmalloc((x)) +#define free(x, y) kzipfree((x)) +#endif + +/* + * This came from unzip-5.12. I have changed it the flow to pass + * a structure pointer around, thus hopefully making it re-entrant. + * Poul-Henning + */ + +/* inflate.c -- put in the public domain by Mark Adler + version c14o, 23 August 1994 */ + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + a ~~ Feb 92 M. Adler used full (large, one-step) lookup table + b1 21 Mar 92 M. Adler first version with partial lookup tables + b2 21 Mar 92 M. Adler fixed bug in fixed-code blocks + b3 22 Mar 92 M. Adler sped up match copies, cleaned up some + b4 25 Mar 92 M. Adler added prototypes; removed window[] (now + is the responsibility of unzip.h--also + changed name to slide[]), so needs diffs + for unzip.c and unzip.h (this allows + compiling in the small model on MSDOS); + fixed cast of q in huft_build(); + b5 26 Mar 92 M. Adler got rid of unintended macro recursion. + b6 27 Mar 92 M. Adler got rid of nextbyte() routine. fixed + bug in inflate_fixed(). + c1 30 Mar 92 M. Adler removed lbits, dbits environment variables. + changed BMAX to 16 for explode. Removed + OUTB usage, and replaced it with flush()-- + this was a 20% speed improvement! Added + an explode.c (to replace unimplod.c) that + uses the huft routines here. Removed + register union. + c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. + c3 10 Apr 92 M. Adler reduced memory of code tables made by + huft_build significantly (factor of two to + three). + c4 15 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy(). + worked around a Turbo C optimization bug. + c5 21 Apr 92 M. Adler added the GZ_WSIZE #define to allow reducing + the 32K window size for specialized + applications. + c6 31 May 92 M. Adler added some typecasts to eliminate warnings + c7 27 Jun 92 G. Roelofs added some more typecasts (444: MSC bug). + c8 5 Oct 92 J-l. Gailly added ifdef'd code to deal with PKZIP bug. + c9 9 Oct 92 M. Adler removed a memory error message (~line 416). + c10 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch, + removed old inflate, renamed inflate_entry + to inflate, added Mark's fix to a comment. + c10.5 14 Dec 92 M. Adler fix up error messages for incomplete trees. + c11 2 Jan 93 M. Adler fixed bug in detection of incomplete + tables, and removed assumption that EOB is + the longest code (bad assumption). + c12 3 Jan 93 M. Adler make tables for fixed blocks only once. + c13 5 Jan 93 M. Adler allow all zero length codes (pkzip 2.04c + outputs one zero length code for an empty + distance tree). + c14 12 Mar 93 M. Adler made inflate.c standalone with the + introduction of inflate.h. + c14b 16 Jul 93 G. Roelofs added (unsigned) typecast to w at 470. + c14c 19 Jul 93 J. Bush changed v[N_MAX], l[288], ll[28x+3x] arrays + to static for Amiga. + c14d 13 Aug 93 J-l. Gailly de-complicatified Mark's c[*p++]++ thing. + c14e 8 Oct 93 G. Roelofs changed memset() to memzero(). + c14f 22 Oct 93 G. Roelofs renamed quietflg to qflag; made Trace() + conditional; added inflate_free(). + c14g 28 Oct 93 G. Roelofs changed l/(lx+1) macro to pointer (Cray bug) + c14h 7 Dec 93 C. Ghisler huft_build() optimizations. + c14i 9 Jan 94 A. Verheijen set fixed_t{d,l} to NULL after freeing; + G. Roelofs check NEXTBYTE macro for GZ_EOF. + c14j 23 Jan 94 G. Roelofs removed Ghisler "optimizations"; ifdef'd + GZ_EOF check. + c14k 27 Feb 94 G. Roelofs added some typecasts to avoid warnings. + c14l 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines + to avoid bug in Encore compiler. + c14m 7 Jul 94 P. Kienitz modified to allow assembler version of + inflate_codes() (define ASM_INFLATECODES) + c14n 22 Jul 94 G. Roelofs changed fprintf to FPRINTF for DLL versions + c14o 23 Aug 94 C. Spieler added a newline to a debug statement; + G. Roelofs added another typecast to avoid MSC warning + */ + + +/* + Inflate deflated (PKZIP's method 8 compressed) data. The compression + method searches for as much of the current string of bytes (up to a + length of 258) in the previous 32K bytes. If it doesn't find any + matches (of at least length 3), it codes the next byte. Otherwise, it + codes the length of the matched string and its distance backwards from + the current position. There is a single Huffman code that codes both + single bytes (called "literals") and match lengths. A second Huffman + code codes the distance information, which follows a length code. Each + length or distance code actually represents a base value and a number + of "extra" (sometimes zero) bits to get to add to the base value. At + the end of each deflated block is a special end-of-block (EOB) literal/ + length code. The decoding process is basically: get a literal/length + code; if EOB then done; if a literal, emit the decoded byte; if a + length then get the distance and emit the referred-to bytes from the + sliding window of previously emitted data. + + There are (currently) three kinds of inflate blocks: stored, fixed, and + dynamic. The compressor outputs a chunk of data at a time and decides + which method to use on a chunk-by-chunk basis. A chunk might typically + be 32K to 64K, uncompressed. If the chunk is uncompressible, then the + "stored" method is used. In this case, the bytes are simply stored as + is, eight bits per byte, with none of the above coding. The bytes are + preceded by a count, since there is no longer an EOB code. + + If the data is compressible, then either the fixed or dynamic methods + are used. In the dynamic method, the compressed data is preceded by + an encoding of the literal/length and distance Huffman codes that are + to be used to decode this block. The representation is itself Huffman + coded, and so is preceded by a description of that code. These code + descriptions take up a little space, and so for small blocks, there is + a predefined set of codes, called the fixed codes. The fixed method is + used if the block ends up smaller that way (usually for quite small + chunks); otherwise the dynamic method is used. In the latter case, the + codes are customized to the probabilities in the current block and so + can code it much better than the pre-determined fixed codes can. + + The Huffman codes themselves are decoded using a mutli-level table + lookup, in order to maximize the speed of decoding plus the speed of + building the decoding tables. See the comments below that precede the + lbits and dbits tuning parameters. + */ + + +/* + Notes beyond the 1.93a appnote.txt: + + 1. Distance pointers never point before the beginning of the output + stream. + 2. Distance pointers can point back across blocks, up to 32k away. + 3. There is an implied maximum of 7 bits for the bit length table and + 15 bits for the actual data. + 4. If only one code exists, then it is encoded using one bit. (Zero + would be more efficient, but perhaps a little confusing.) If two + codes exist, they are coded using one bit each (0 and 1). + 5. There is no way of sending zero distance codes--a dummy must be + sent if there are none. (History: a pre 2.0 version of PKZIP would + store blocks with no distance codes, but this was discovered to be + too harsh a criterion.) Valid only for 1.93a. 2.04c does allow + zero distance codes, which is sent as one code of zero bits in + length. + 6. There are up to 286 literal/length codes. Code 256 represents the + end-of-block. Note however that the static length tree defines + 288 codes just to fill out the Huffman codes. Codes 286 and 287 + cannot be used though, since there is no length base or extra bits + defined for them. Similarily, there are up to 30 distance codes. + However, static trees define 32 codes (all 5 bits) to fill out the + Huffman codes, but the last two had better not show up in the data. + 7. Unzip can check dynamic Huffman blocks for complete code sets. + The exception is that a single code would not be complete (see #4). + 8. The five bits following the block type is really the number of + literal codes sent minus 257. + 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits + (1+6+6). Therefore, to output three times the length, you output + three codes (1+1+1), whereas to output four times the same length, + you only need two codes (1+3). Hmm. + 10. In the tree reconstruction algorithm, Code = Code + Increment + only if BitLength(i) is not zero. (Pretty obvious.) + 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) + 12. Note: length code 284 can represent 227-258, but length code 285 + really is 258. The last length deserves its own, short code + since it gets used a lot in very redundant files. The length + 258 is special since 258 - 3 (the min match length) is 255. + 13. The literal/length and distance code bit lengths are read as a + single stream of lengths. It is possible (and advantageous) for + a repeat code (16, 17, or 18) to go across the boundary between + the two sets of lengths. + */ + + +#define PKZIP_BUG_WORKAROUND /* PKZIP 1.93a problem--live with it */ + +/* + inflate.h must supply the uch slide[GZ_WSIZE] array and the NEXTBYTE, + FLUSH() and memzero macros. If the window size is not 32K, it + should also define GZ_WSIZE. If INFMOD is defined, it can include + compiled functions to support the NEXTBYTE and/or FLUSH() macros. + There are defaults for NEXTBYTE and FLUSH() below for use as + examples of what those functions need to do. Normally, you would + also want FLUSH() to compute a crc on the data. inflate.h also + needs to provide these typedefs: + + typedef unsigned char uch; + typedef unsigned short ush; + typedef unsigned long ulg; + + This module uses the external functions malloc() and free() (and + probably memset() or bzero() in the memzero() macro). Their + prototypes are normally found in and . + */ +#define INFMOD /* tell inflate.h to include code to be + * compiled */ + +/* Huffman code lookup table entry--this entry is four bytes for machines + that have 16-bit pointers (e.g. PC's in the small or medium model). + Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 + means that v is a literal, 16 < e < 32 means that v is a pointer to + the next table, which codes e - 16 bits, and lastly e == 99 indicates + an unused code. If a code with e == 99 is looked up, this implies an + error in the data. */ +struct huft { + uch e; /* number of extra bits or operation */ + uch b; /* number of bits in this code or subcode */ + union { + ush n; /* literal, length base, or distance + * base */ + struct huft *t; /* pointer to next level of table */ + } v; +}; + + +/* Function prototypes */ +static int huft_build(struct inflate *, unsigned *, unsigned, unsigned, const ush *, const ush *, struct huft **, int *); +static int huft_free(struct inflate *, struct huft *); +static int inflate_codes(struct inflate *, struct huft *, struct huft *, int, int); +static int inflate_stored(struct inflate *); +static int xinflate(struct inflate *); +static int inflate_fixed(struct inflate *); +static int inflate_dynamic(struct inflate *); +static int inflate_block(struct inflate *, int *); + +/* The inflate algorithm uses a sliding 32K byte window on the uncompressed + stream to find repeated byte strings. This is implemented here as a + circular buffer. The index is updated simply by incrementing and then + and'ing with 0x7fff (32K-1). */ +/* It is left to other modules to supply the 32K area. It is assumed + to be usable as if it were declared "uch slide[32768];" or as just + "uch *slide;" and then malloc'ed in the latter case. The definition + must be in unzip.h, included above. */ + + +/* Tables for deflate from PKZIP's appnote.txt. */ + +/* Order of the bit length code lengths */ +static const unsigned border[] = { + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + +static const ush cplens[] = { /* Copy lengths for literal codes 257..285 */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + /* note: see note #13 above about the 258 in this list. */ + +static const ush cplext[] = { /* Extra bits for literal codes 257..285 */ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ + +static const ush cpdist[] = { /* Copy offsets for distance codes 0..29 */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577}; + +static const ush cpdext[] = { /* Extra bits for distance codes */ + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13}; + +/* And'ing with mask[n] masks the lower n bits */ +static const ush mask[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(glbl,j) + x = b & mask[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed, and are initialized at the begining of a + routine that uses these macros from a global bit buffer and count. + + In order to not ask for more bits than there are in the compressed + stream, the Huffman tables are constructed to only ask for just + enough bits to make up the end-of-block code (value 256). Then no + bytes need to be "returned" to the buffer at the end of the last + block. See the huft_build() routine. + */ + +/* + * The following 2 were global variables. + * They are now fields of the inflate structure. + */ + +#define NEEDBITS(glbl,n) { \ + while(k<(n)) { \ + int c=(*glbl->gz_input)(glbl->gz_private); \ + if(c==GZ_EOF) \ + return 1; \ + b|=((ulg)c)<>=(n);k-=(n);} + +/* + Huffman code decoding is performed using a multi-level table lookup. + The fastest way to decode is to simply build a lookup table whose + size is determined by the longest code. However, the time it takes + to build this table can also be a factor if the data being decoded + is not very long. The most common codes are necessarily the + shortest codes, so those codes dominate the decoding time, and hence + the speed. The idea is you can have a shorter table that decodes the + shorter, more probable codes, and then point to subsidiary tables for + the longer codes. The time it costs to decode the longer codes is + then traded against the time it takes to make longer tables. + + This results of this trade are in the variables lbits and dbits + below. lbits is the number of bits the first level table for literal/ + length codes can decode in one step, and dbits is the same thing for + the distance codes. Subsequent tables are also less than or equal to + those sizes. These values may be adjusted either when all of the + codes are shorter than that, in which case the longest code length in + bits is used, or when the shortest code is *longer* than the requested + table size, in which case the length of the shortest code in bits is + used. + + There are two different values for the two tables, since they code a + different number of possibilities each. The literal/length table + codes 286 possible values, or in a flat code, a little over eight + bits. The distance table codes 30 possible values, or a little less + than five bits, flat. The optimum values for speed end up being + about one bit more than those, so lbits is 8+1 and dbits is 5+1. + The optimum values may differ though from machine to machine, and + possibly even between compilers. Your mileage may vary. + */ + +static const int lbits = 9; /* bits in base literal/length lookup table */ +static const int dbits = 6; /* bits in base distance lookup table */ + + +/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +#define BMAX 16 /* maximum bit length of any code (16 for + * explode) */ +#define N_MAX 288 /* maximum number of codes in any set */ + +/* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if + the given code set is incomplete (the tables are still built in this + case), two if the input is invalid (all zero length codes or an + oversubscribed set of lengths), and three if not enough memory. + The code with value 256 is special, and the tables are constructed + so that no bits beyond that code are fetched when that code is + decoded. */ +static int +huft_build(glbl, b, n, s, d, e, t, m) + struct inflate *glbl; + unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ + unsigned n; /* number of codes (assumed <= N_MAX) */ + unsigned s; /* number of simple-valued codes (0..s-1) */ + const ush *d; /* list of base values for non-simple codes */ + const ush *e; /* list of extra bits for non-simple codes */ + struct huft **t; /* result: starting table */ + int *m; /* maximum lookup bits, returns actual */ +{ + unsigned a; /* counter for codes of length k */ + unsigned c[BMAX + 1]; /* bit length count table */ + unsigned el; /* length of EOB code (value 256) */ + unsigned f; /* i repeats in table every f entries */ + int g; /* maximum code length */ + int h; /* table level */ + register unsigned i; /* counter, current code */ + register unsigned j; /* counter */ + register int k; /* number of bits in current code */ + int lx[BMAX + 1]; /* memory for l[-1..BMAX-1] */ + int *l = lx + 1; /* stack of bits per table */ + register unsigned *p; /* pointer into c[], b[], or v[] */ + register struct huft *q;/* points to current table */ + struct huft r; /* table entry for structure assignment */ + struct huft *u[BMAX];/* table stack */ + unsigned v[N_MAX]; /* values in order of bit length */ + register int w; /* bits before this table == (l * h) */ + unsigned x[BMAX + 1]; /* bit offsets, then code stack */ + unsigned *xp; /* pointer into x */ + int y; /* number of dummy codes added */ + unsigned z; /* number of entries in current table */ + + /* Generate counts for each bit length */ + el = n > 256 ? b[256] : BMAX; /* set length of EOB code, if any */ +#ifdef _KERNEL + memzero((char *) c, sizeof(c)); +#else + for (i = 0; i < BMAX+1; i++) + c [i] = 0; +#endif + p = b; + i = n; + do { + c[*p]++; + p++; /* assume all entries <= BMAX */ + } while (--i); + if (c[0] == n) { /* null input--all zero length codes */ + *t = (struct huft *) NULL; + *m = 0; + return 0; + } + /* Find minimum and maximum length, bound *m by those */ + for (j = 1; j <= BMAX; j++) + if (c[j]) + break; + k = j; /* minimum code length */ + if ((unsigned) *m < j) + *m = j; + for (i = BMAX; i; i--) + if (c[i]) + break; + g = i; /* maximum code length */ + if ((unsigned) *m > i) + *m = i; + + /* Adjust last length count to fill out codes, if needed */ + for (y = 1 << j; j < i; j++, y <<= 1) + if ((y -= c[j]) < 0) + return 2; /* bad input: more codes than bits */ + if ((y -= c[i]) < 0) + return 2; + c[i] += y; + + /* Generate starting offsets into the value table for each length */ + x[1] = j = 0; + p = c + 1; + xp = x + 2; + while (--i) { /* note that i == g from above */ + *xp++ = (j += *p++); + } + + /* Make a table of values in order of bit lengths */ + p = b; + i = 0; + do { + if ((j = *p++) != 0) + v[x[j]++] = i; + } while (++i < n); + + /* Generate the Huffman codes and for each, make the table entries */ + x[0] = i = 0; /* first Huffman code is zero */ + p = v; /* grab values in bit order */ + h = -1; /* no tables yet--level -1 */ + w = l[-1] = 0; /* no bits decoded yet */ + u[0] = (struct huft *) NULL; /* just to keep compilers happy */ + q = (struct huft *) NULL; /* ditto */ + z = 0; /* ditto */ + + /* go through the bit lengths (k already is bits in shortest code) */ + for (; k <= g; k++) { + a = c[k]; + while (a--) { + /* + * here i is the Huffman code of length k bits for + * value *p + */ + /* make tables up to required level */ + while (k > w + l[h]) { + w += l[h++]; /* add bits already decoded */ + + /* + * compute minimum size table less than or + * equal to *m bits + */ + z = (z = g - w) > (unsigned) *m ? *m : z; /* upper limit */ + if ((f = 1 << (j = k - w)) > a + 1) { /* try a k-w bit table *//* t + * oo few codes for k-w + * bit table */ + f -= a + 1; /* deduct codes from + * patterns left */ + xp = c + k; + while (++j < z) { /* try smaller tables up + * to z bits */ + if ((f <<= 1) <= *++xp) + break; /* enough codes to use + * up j bits */ + f -= *xp; /* else deduct codes + * from patterns */ + } + } + if ((unsigned) w + j > el && (unsigned) w < el) + j = el - w; /* make EOB code end at + * table */ + z = 1 << j; /* table entries for j-bit + * table */ + l[h] = j; /* set table size in stack */ + + /* allocate and link in new table */ + if ((q = (struct huft *) malloc((z + 1) * sizeof(struct huft), M_GZIP, M_WAITOK)) == + (struct huft *) NULL) { + if (h) + huft_free(glbl, u[0]); + return 3; /* not enough memory */ + } + glbl->gz_hufts += z + 1; /* track memory usage */ + *t = q + 1; /* link to list for + * huft_free() */ + *(t = &(q->v.t)) = (struct huft *) NULL; + u[h] = ++q; /* table starts after link */ + + /* connect to last table, if there is one */ + if (h) { + x[h] = i; /* save pattern for + * backing up */ + r.b = (uch) l[h - 1]; /* bits to dump before + * this table */ + r.e = (uch) (16 + j); /* bits in this table */ + r.v.t = q; /* pointer to this table */ + j = (i & ((1 << w) - 1)) >> (w - l[h - 1]); + u[h - 1][j] = r; /* connect to last table */ + } + } + + /* set up table entry in r */ + r.b = (uch) (k - w); + if (p >= v + n) + r.e = 99; /* out of values--invalid + * code */ + else if (*p < s) { + r.e = (uch) (*p < 256 ? 16 : 15); /* 256 is end-of-block + * code */ + r.v.n = *p++; /* simple code is just the + * value */ + } else { + r.e = (uch) e[*p - s]; /* non-simple--look up + * in lists */ + r.v.n = d[*p++ - s]; + } + + /* fill code-like entries with r */ + f = 1 << (k - w); + for (j = i >> w; j < z; j += f) + q[j] = r; + + /* backwards increment the k-bit code i */ + for (j = 1 << (k - 1); i & j; j >>= 1) + i ^= j; + i ^= j; + + /* backup over finished tables */ + while ((i & ((1 << w) - 1)) != x[h]) + w -= l[--h]; /* don't need to update q */ + } + } + + /* return actual size of base table */ + *m = l[0]; + + /* Return true (1) if we were given an incomplete table */ + return y != 0 && g != 1; +} + +static int +huft_free(glbl, t) + struct inflate *glbl; + struct huft *t; /* table to free */ +/* Free the malloc'ed tables built by huft_build(), which makes a linked + list of the tables it made, with the links in a dummy first entry of + each table. */ +{ + register struct huft *p, *q; + + /* Go through linked list, freeing from the malloced (t[-1]) address. */ + p = t; + while (p != (struct huft *) NULL) { + q = (--p)->v.t; + free(p, M_GZIP); + p = q; + } + return 0; +} + +/* inflate (decompress) the codes in a deflated (compressed) block. + Return an error code or zero if it all goes ok. */ +static int +inflate_codes(glbl, tl, td, bl, bd) + struct inflate *glbl; + struct huft *tl, *td;/* literal/length and distance decoder tables */ + int bl, bd; /* number of bits decoded by tl[] and td[] */ +{ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + /* make local copies of globals */ + b = glbl->gz_bb; /* initialize bit buffer */ + k = glbl->gz_bk; + w = glbl->gz_wp; /* initialize window position */ + + /* inflate the coded data */ + ml = mask[bl]; /* precompute masks for speed */ + md = mask[bd]; + while (1) { /* do until end of block */ + NEEDBITS(glbl, (unsigned) bl) + if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(glbl, e) + } while ((e = (t = t->v.t + ((unsigned) b & mask[e]))->e) > 16); + DUMPBITS(t->b) + if (e == 16) { /* then it's a literal */ + glbl->gz_slide[w++] = (uch) t->v.n; + if (w == GZ_WSIZE) { + FLUSH(glbl, w); + w = 0; + } + } else { /* it's an EOB or a length */ + /* exit if end of block */ + if (e == 15) + break; + + /* get length of block to copy */ + NEEDBITS(glbl, e) + n = t->v.n + ((unsigned) b & mask[e]); + DUMPBITS(e); + + /* decode distance of block to copy */ + NEEDBITS(glbl, (unsigned) bd) + if ((e = (t = td + ((unsigned) b & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(glbl, e) + } while ((e = (t = t->v.t + ((unsigned) b & mask[e]))->e) > 16); + DUMPBITS(t->b) + NEEDBITS(glbl, e) + d = w - t->v.n - ((unsigned) b & mask[e]); + DUMPBITS(e) + /* do the copy */ + do { + n -= (e = (e = GZ_WSIZE - ((d &= GZ_WSIZE - 1) > w ? d : w)) > n ? n : e); +#ifndef NOMEMCPY + if (w - d >= e) { /* (this test assumes + * unsigned comparison) */ + memcpy(glbl->gz_slide + w, glbl->gz_slide + d, e); + w += e; + d += e; + } else /* do it slow to avoid memcpy() + * overlap */ +#endif /* !NOMEMCPY */ + do { + glbl->gz_slide[w++] = glbl->gz_slide[d++]; + } while (--e); + if (w == GZ_WSIZE) { + FLUSH(glbl, w); + w = 0; + } + } while (n); + } + } + + /* restore the globals from the locals */ + glbl->gz_wp = w; /* restore global window pointer */ + glbl->gz_bb = b; /* restore global bit buffer */ + glbl->gz_bk = k; + + /* done */ + return 0; +} + +/* "decompress" an inflated type 0 (stored) block. */ +static int +inflate_stored(glbl) + struct inflate *glbl; +{ + unsigned n; /* number of bytes in block */ + unsigned w; /* current window position */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + /* make local copies of globals */ + b = glbl->gz_bb; /* initialize bit buffer */ + k = glbl->gz_bk; + w = glbl->gz_wp; /* initialize window position */ + + /* go to byte boundary */ + n = k & 7; + DUMPBITS(n); + + /* get the length and its complement */ + NEEDBITS(glbl, 16) + n = ((unsigned) b & 0xffff); + DUMPBITS(16) + NEEDBITS(glbl, 16) + if (n != (unsigned) ((~b) & 0xffff)) + return 1; /* error in compressed data */ + DUMPBITS(16) + /* read and output the compressed data */ + while (n--) { + NEEDBITS(glbl, 8) + glbl->gz_slide[w++] = (uch) b; + if (w == GZ_WSIZE) { + FLUSH(glbl, w); + w = 0; + } + DUMPBITS(8) + } + + /* restore the globals from the locals */ + glbl->gz_wp = w; /* restore global window pointer */ + glbl->gz_bb = b; /* restore global bit buffer */ + glbl->gz_bk = k; + return 0; +} + +/* decompress an inflated type 1 (fixed Huffman codes) block. We should + either replace this with a custom decoder, or at least precompute the + Huffman tables. */ +static int +inflate_fixed(glbl) + struct inflate *glbl; +{ + /* if first time, set up tables for fixed blocks */ + if (glbl->gz_fixed_tl == (struct huft *) NULL) { + int i; /* temporary variable */ + static unsigned l[288]; /* length list for huft_build */ + + /* literal table */ + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) /* make a complete, but wrong code + * set */ + l[i] = 8; + glbl->gz_fixed_bl = 7; + if ((i = huft_build(glbl, l, 288, 257, cplens, cplext, + &glbl->gz_fixed_tl, &glbl->gz_fixed_bl)) != 0) { + glbl->gz_fixed_tl = (struct huft *) NULL; + return i; + } + /* distance table */ + for (i = 0; i < 30; i++) /* make an incomplete code + * set */ + l[i] = 5; + glbl->gz_fixed_bd = 5; + if ((i = huft_build(glbl, l, 30, 0, cpdist, cpdext, + &glbl->gz_fixed_td, &glbl->gz_fixed_bd)) > 1) { + huft_free(glbl, glbl->gz_fixed_tl); + glbl->gz_fixed_tl = (struct huft *) NULL; + return i; + } + } + /* decompress until an end-of-block code */ + return inflate_codes(glbl, glbl->gz_fixed_tl, glbl->gz_fixed_td, glbl->gz_fixed_bl, glbl->gz_fixed_bd) != 0; +} + +/* decompress an inflated type 2 (dynamic Huffman codes) block. */ +static int +inflate_dynamic(glbl) + struct inflate *glbl; +{ + int i; /* temporary variables */ + unsigned j; + unsigned l; /* last length */ + unsigned m; /* mask for bit lengths table */ + unsigned n; /* number of lengths to get */ + struct huft *tl; /* literal/length code table */ + struct huft *td; /* distance code table */ + int bl; /* lookup bits for tl */ + int bd; /* lookup bits for td */ + unsigned nb; /* number of bit length codes */ + unsigned nl; /* number of literal/length codes */ + unsigned nd; /* number of distance codes */ +#ifdef PKZIP_BUG_WORKAROUND + unsigned ll[288 + 32]; /* literal/length and distance code + * lengths */ +#else + unsigned ll[286 + 30]; /* literal/length and distance code + * lengths */ +#endif + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + /* make local bit buffer */ + b = glbl->gz_bb; + k = glbl->gz_bk; + + /* read in table lengths */ + NEEDBITS(glbl, 5) + nl = 257 + ((unsigned) b & 0x1f); /* number of + * literal/length codes */ + DUMPBITS(5) + NEEDBITS(glbl, 5) + nd = 1 + ((unsigned) b & 0x1f); /* number of distance codes */ + DUMPBITS(5) + NEEDBITS(glbl, 4) + nb = 4 + ((unsigned) b & 0xf); /* number of bit length codes */ + DUMPBITS(4) +#ifdef PKZIP_BUG_WORKAROUND + if (nl > 288 || nd > 32) +#else + if (nl > 286 || nd > 30) +#endif + return 1; /* bad lengths */ + /* read in bit-length-code lengths */ + for (j = 0; j < nb; j++) { + NEEDBITS(glbl, 3) + ll[border[j]] = (unsigned) b & 7; + DUMPBITS(3) + } + for (; j < 19; j++) + ll[border[j]] = 0; + + /* build decoding table for trees--single level, 7 bit lookup */ + bl = 7; + if ((i = huft_build(glbl, ll, 19, 19, NULL, NULL, &tl, &bl)) != 0) { + if (i == 1) + huft_free(glbl, tl); + return i; /* incomplete code set */ + } + /* read in literal and distance code lengths */ + n = nl + nd; + m = mask[bl]; + i = l = 0; + while ((unsigned) i < n) { + NEEDBITS(glbl, (unsigned) bl) + j = (td = tl + ((unsigned) b & m))->b; + DUMPBITS(j) + j = td->v.n; + if (j < 16) /* length of code in bits (0..15) */ + ll[i++] = l = j; /* save last length in l */ + else if (j == 16) { /* repeat last length 3 to 6 times */ + NEEDBITS(glbl, 2) + j = 3 + ((unsigned) b & 3); + DUMPBITS(2) + if ((unsigned) i + j > n) + return 1; + while (j--) + ll[i++] = l; + } else if (j == 17) { /* 3 to 10 zero length codes */ + NEEDBITS(glbl, 3) + j = 3 + ((unsigned) b & 7); + DUMPBITS(3) + if ((unsigned) i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } else { /* j == 18: 11 to 138 zero length codes */ + NEEDBITS(glbl, 7) + j = 11 + ((unsigned) b & 0x7f); + DUMPBITS(7) + if ((unsigned) i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + } + + /* free decoding table for trees */ + huft_free(glbl, tl); + + /* restore the global bit buffer */ + glbl->gz_bb = b; + glbl->gz_bk = k; + + /* build the decoding tables for literal/length and distance codes */ + bl = lbits; + i = huft_build(glbl, ll, nl, 257, cplens, cplext, &tl, &bl); + if (i != 0) { + if (i == 1 && !qflag) { + FPRINTF("(incomplete l-tree) "); + huft_free(glbl, tl); + } + return i; /* incomplete code set */ + } + bd = dbits; + i = huft_build(glbl, ll + nl, nd, 0, cpdist, cpdext, &td, &bd); + if (i != 0) { + if (i == 1 && !qflag) { + FPRINTF("(incomplete d-tree) "); +#ifdef PKZIP_BUG_WORKAROUND + i = 0; + } +#else + huft_free(glbl, td); + } + huft_free(glbl, tl); + return i; /* incomplete code set */ +#endif + } + /* decompress until an end-of-block code */ + if (inflate_codes(glbl, tl, td, bl, bd)) + return 1; + + /* free the decoding tables, return */ + huft_free(glbl, tl); + huft_free(glbl, td); + return 0; +} + +/* decompress an inflated block */ +static int +inflate_block(glbl, e) + struct inflate *glbl; + int *e; /* last block flag */ +{ + unsigned t; /* block type */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + /* make local bit buffer */ + b = glbl->gz_bb; + k = glbl->gz_bk; + + /* read in last block bit */ + NEEDBITS(glbl, 1) + * e = (int) b & 1; + DUMPBITS(1) + /* read in block type */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri May 29 20:45:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66FB3106568E; Fri, 29 May 2009 20:45:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08AD28FC16; Fri, 29 May 2009 20:45:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TKjg8a086378; Fri, 29 May 2009 20:45:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TKjgk0086377; Fri, 29 May 2009 20:45:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905292045.n4TKjgk0086377@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 20:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193064 - user/kmacy/releng_7_2_fcs/usr.sbin/btxld X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 20:45:44 -0000 Author: kmacy Date: Fri May 29 20:45:42 2009 New Revision: 193064 URL: http://svn.freebsd.org/changeset/base/193064 Log: don't fail on empty object Modified: user/kmacy/releng_7_2_fcs/usr.sbin/btxld/btxld.c Modified: user/kmacy/releng_7_2_fcs/usr.sbin/btxld/btxld.c ============================================================================== --- user/kmacy/releng_7_2_fcs/usr.sbin/btxld/btxld.c Fri May 29 20:42:57 2009 (r193063) +++ user/kmacy/releng_7_2_fcs/usr.sbin/btxld/btxld.c Fri May 29 20:45:42 2009 (r193064) @@ -336,6 +336,8 @@ gethdr(int fd, struct hdr *hdr) if (sb.st_size > MAXU32) errx(1, "%s: Too big", fname); hdr->size = sb.st_size; + if (!hdr->size) + return; if ((p = mmap(NULL, hdr->size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) err(2, "%s", fname); From owner-svn-src-user@FreeBSD.ORG Fri May 29 21:31:45 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82E2C106566C; Fri, 29 May 2009 21:31:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 719448FC08; Fri, 29 May 2009 21:31:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TLVjaA087406; Fri, 29 May 2009 21:31:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TLVjpd087399; Fri, 29 May 2009 21:31:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905292131.n4TLVjpd087399@svn.freebsd.org> From: Kip Macy Date: Fri, 29 May 2009 21:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193067 - user/kmacy/releng_7_2_fcs/sys/libkern/zlib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2009 21:31:45 -0000 Author: kmacy Date: Fri May 29 21:31:44 2009 New Revision: 193067 URL: http://svn.freebsd.org/changeset/base/193067 Log: remove unused crc32.c fix DEBUG compile for INVARIANTS Deleted: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/crc32.c Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/deflate.c user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inflate.c user/kmacy/releng_7_2_fcs/sys/libkern/zlib/trees.c user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zl_crc32.c user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/deflate.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/deflate.c Fri May 29 21:27:12 2009 (r193066) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/deflate.c Fri May 29 21:31:44 2009 (r193067) @@ -1225,7 +1225,7 @@ local uInt longest_match_fast(s, cur_mat return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; } -#ifdef DEBUG +#if 0 /* =========================================================================== * Check that the match at match_start is indeed a match. */ Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inflate.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inflate.c Fri May 29 21:27:12 2009 (r193066) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/inflate.c Fri May 29 21:31:44 2009 (r193067) @@ -245,7 +245,7 @@ struct inflate_state FAR *state; state->distbits = 5; } -#ifdef MAKEFIXED +#if 0 #include /* Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/trees.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/trees.c Fri May 29 21:27:12 2009 (r193066) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/trees.c Fri May 29 21:31:44 2009 (r193067) @@ -35,9 +35,6 @@ #include -#ifdef DEBUG -# include -#endif /* =========================================================================== * Constants @@ -163,7 +160,7 @@ local void copy_block OF((deflate_st local void gen_trees_header OF((void)); #endif -#ifndef DEBUG +#if 1 # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) /* Send a code of the given tree. c and tree must not have side effects */ @@ -318,7 +315,7 @@ local void tr_static_init() /* =========================================================================== * Genererate the file trees.h describing the static trees. */ -#ifdef GEN_TREES_H +#if 0 # ifndef DEBUG # include # endif Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zl_crc32.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zl_crc32.c Fri May 29 21:27:12 2009 (r193066) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zl_crc32.c Fri May 29 21:31:44 2009 (r193067) @@ -22,7 +22,7 @@ one thread to use crc32(). */ -#ifdef MAKECRCH +#if 0 # include # ifndef DYNAMIC_CRC_TABLE # define DYNAMIC_CRC_TABLE Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c Fri May 29 21:27:12 2009 (r193066) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c Fri May 29 21:31:44 2009 (r193067) @@ -112,7 +112,7 @@ uLong ZEXPORT zlibCompileFlags() return flags; } -#ifdef DEBUG +#if 0 # ifndef verbose # define verbose 0 Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h Fri May 29 21:27:12 2009 (r193066) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.h Fri May 29 21:31:44 2009 (r193067) @@ -243,7 +243,7 @@ extern const char * const z_errmsg[10]; #endif /* Diagnostic functions */ -#ifdef DEBUG +#if 0 # include extern int z_verbose; extern void z_error OF((char *m)); From owner-svn-src-user@FreeBSD.ORG Sat May 30 00:54:46 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0880106567B; Sat, 30 May 2009 00:54:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EE978FC24; Sat, 30 May 2009 00:54:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U0skG2091747; Sat, 30 May 2009 00:54:46 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U0skrk091746; Sat, 30 May 2009 00:54:46 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905300054.n4U0skrk091746@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 00:54:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193075 - user/kmacy/releng_7_2_fcs/sys/libkern/zlib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 00:54:47 -0000 Author: kmacy Date: Sat May 30 00:54:46 2009 New Revision: 193075 URL: http://svn.freebsd.org/changeset/base/193075 Log: ensure that new zlib resolves module dependencies Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c Modified: user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c Sat May 30 00:22:57 2009 (r193074) +++ user/kmacy/releng_7_2_fcs/sys/libkern/zlib/zutil.c Sat May 30 00:54:46 2009 (r193075) @@ -5,8 +5,20 @@ /* @(#) $Id$ */ + +#ifdef _KERNEL #include +/* Assume this is a *BSD or SVR4 kernel */ +#include +#include +#include +#include +#include +#include +# define HAVE_MEMCPY +#endif + #ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ #endif @@ -334,3 +346,25 @@ zcfree(void *opaque, void *ptr) #endif /* MY_ZCALLOC */ + +#ifdef _KERNEL +static int +zlib_modevent(module_t mod, int type, void *unused) +{ + switch (type) { + case MOD_LOAD: + return 0; + case MOD_UNLOAD: + return 0; + } + return EINVAL; +} + +static moduledata_t zlib_mod = { + "zlib", + zlib_modevent, + 0 +}; +DECLARE_MODULE(zlib, zlib_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); +MODULE_VERSION(zlib, 1); +#endif /* _KERNEL */ From owner-svn-src-user@FreeBSD.ORG Sat May 30 00:55:46 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E981065670; Sat, 30 May 2009 00:55:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56BB88FC18; Sat, 30 May 2009 00:55:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U0tkSC091824; Sat, 30 May 2009 00:55:46 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U0tkA0091822; Sat, 30 May 2009 00:55:46 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905300055.n4U0tkA0091822@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 00:55:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193076 - user/kmacy/releng_7_2_fcs/sys/amd64/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 00:55:46 -0000 Author: kmacy Date: Sat May 30 00:55:46 2009 New Revision: 193076 URL: http://svn.freebsd.org/changeset/base/193076 Log: prune mxge module add drm Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Sat May 30 00:54:46 2009 (r193075) +++ user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC Sat May 30 00:55:46 2009 (r193076) @@ -25,7 +25,7 @@ ident GENERIC #hints "GENERIC.hints" # Default places to look for devices. makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="geom opensolaris zfs cxgb fxp nfe hwpmc linux linprocfs drm" +makeoptions MODULES_OVERRIDE="geom zfs cxgb fxp nfe hwpmc linux linprocfs drm" makeoptions OPENSOLARIS options OPENSOLARIS Modified: user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS Sat May 30 00:54:46 2009 (r193075) +++ user/kmacy/releng_7_2_fcs/sys/amd64/conf/GENERIC_MINUS Sat May 30 00:55:46 2009 (r193076) @@ -25,8 +25,7 @@ ident GENERIC #hints "GENERIC.hints" # Default places to look for devices. makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="opensolaris zfs zlib mxge geom hwpmc linux linprocfs" - +makeoptions MODULES_OVERRIDE="geom zfs cxgb fxp nfe hwpmc linux linprocfs drm" makeoptions OPENSOLARIS options OPENSOLARIS options ZFS From owner-svn-src-user@FreeBSD.ORG Sat May 30 01:02:46 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BC1A106566B; Sat, 30 May 2009 01:02:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE7C18FC19; Sat, 30 May 2009 01:02:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U12j0R091998; Sat, 30 May 2009 01:02:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U12j5S091997; Sat, 30 May 2009 01:02:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905300102.n4U12j5S091997@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 01:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193077 - user/kmacy/releng_7_2_fcs/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 01:02:46 -0000 Author: kmacy Date: Sat May 30 01:02:45 2009 New Revision: 193077 URL: http://svn.freebsd.org/changeset/base/193077 Log: assert that we have the last reference if we're calling free Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/uma_machdep.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/uma_machdep.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/amd64/uma_machdep.c Sat May 30 00:55:46 2009 (r193076) +++ user/kmacy/releng_7_2_fcs/sys/amd64/amd64/uma_machdep.c Sat May 30 01:02:45 2009 (r193077) @@ -82,7 +82,10 @@ uma_small_free(void *mem, int size, u_in pa = DMAP_TO_PHYS((vm_offset_t)mem); dump_drop_page(pa); m = PHYS_TO_VM_PAGE(pa); - m->wire_count--; + + KASSERT(m->wire_count == 1, + ("wire_count == %d", m->wire_count)); + m->wire_count = 0; vm_page_free(m); atomic_subtract_int(&cnt.v_wire_count, 1); } From owner-svn-src-user@FreeBSD.ORG Sat May 30 01:05:31 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B36E91065679; Sat, 30 May 2009 01:05:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A06418FC14; Sat, 30 May 2009 01:05:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U15VhG092088; Sat, 30 May 2009 01:05:31 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U15VAF092086; Sat, 30 May 2009 01:05:31 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905300105.n4U15VAF092086@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 01:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193078 - in user/kmacy/releng_7_2_fcs/sys: amd64/amd64 vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 01:05:32 -0000 Author: kmacy Date: Sat May 30 01:05:31 2009 New Revision: 193078 URL: http://svn.freebsd.org/changeset/base/193078 Log: - protecting every wire count change of page table pages with a vm page lock acquisition is rather onerous, switch to treating it as an atomic - drop vm page queue free mutex as soon as we have removed it from the queue and we hold the only reference Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Sat May 30 01:02:45 2009 (r193077) +++ user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Sat May 30 01:05:31 2009 (r193078) @@ -618,7 +618,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) /* Setup page locks. */ for (i = 0; i < PA_LOCK_COUNT; i++) - mtx_init(&pa_lock[i], "page lock", NULL, MTX_DEF | MTX_RECURSE); + mtx_init(&pa_lock[i], "page lock", NULL, MTX_DEF | MTX_RECURSE | MTX_DUPOK); mtx_init(&pv_lock, "pv list lock", NULL, MTX_DEF); } @@ -1348,7 +1348,7 @@ static __inline int pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t *free) { - --m->wire_count; + atomic_subtract_int(&m->wire_count, 1); if (m->wire_count == 0) return _pmap_unwire_pte_hold(pmap, va, m, free); else @@ -1434,7 +1434,7 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t v return 0; KASSERT(ptepde != 0, ("pmap_unuse_pt: ptepde != 0")); mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME); - return pmap_unwire_pte_hold(pmap, va, mpte, free); + return (pmap_unwire_pte_hold(pmap, va, mpte, free)); } void @@ -1561,14 +1561,16 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p /* Have to allocate a new pdp, recurse */ if (_pmap_allocpte(pmap, pa, NUPDE + NUPDPE + pml4index, flags) == NULL) { - --m->wire_count; + KASSERT(m->wire_count == 1, + ("wire_count == %d", m->wire_count)); + m->wire_count = 0; vm_page_free(m); return (NULL); } } else { /* Add reference to pdp page */ pdppg = PHYS_TO_VM_PAGE(*pml4 & PG_FRAME); - pdppg->wire_count++; + atomic_add_int(&pdppg->wire_count, 1); } pdp = (pdp_entry_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME); @@ -1593,7 +1595,9 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p /* Have to allocate a new pd, recurse */ if (_pmap_allocpte(pmap, pa, NUPDE + pdpindex, flags) == NULL) { - --m->wire_count; + KASSERT(m->wire_count == 1, + ("wire_count == %d", m->wire_count)); + m->wire_count = 0; vm_page_free(m); return (NULL); } @@ -1606,14 +1610,16 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p /* Have to allocate a new pd, recurse */ if (_pmap_allocpte(pmap, pa, NUPDE + pdpindex, flags) == NULL) { - --m->wire_count; + KASSERT(m->wire_count == 1, + ("wire_count == %d", m->wire_count)); + m->wire_count = 0; vm_page_free(m); return (NULL); } } else { /* Add reference to the pd page */ pdpg = PHYS_TO_VM_PAGE(*pdp & PG_FRAME); - pdpg->wire_count++; + atomic_add_int(&pdpg->wire_count, 1); } } pd = (pd_entry_t *)PHYS_TO_DMAP(*pdp & PG_FRAME); @@ -1641,7 +1647,7 @@ retry: if (pdpe != NULL && (*pdpe & PG_V) != 0) { /* Add a reference to the pd page. */ pdpg = PHYS_TO_VM_PAGE(*pdpe & PG_FRAME); - pdpg->wire_count++; + atomic_add_int(&pdpg->wire_count, 1); } else { /* Allocate a pd page. */ ptepindex = pmap_pde_pindex(va); @@ -1705,7 +1711,7 @@ retry: */ if (pd != NULL && (*pd & PG_V) != 0) { m = PHYS_TO_VM_PAGE(*pd & PG_FRAME); - m->wire_count++; + atomic_add_int(&m->wire_count, 1); } else { /* * Here if the pte page isn't mapped, or if it has been @@ -1745,7 +1751,8 @@ pmap_release(pmap_t pmap) pmap->pm_pml4[DMPML4I] = 0; /* Direct Map */ pmap->pm_pml4[PML4PML4I] = 0; /* Recursive Mapping */ - m->wire_count--; + KASSERT(m->wire_count == 1, ("wire_count == %d", m->wire_count)); + m->wire_count = 0; atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free_zero(m); PMAP_LOCK_DESTROY(pmap); @@ -2010,7 +2017,8 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv /* entire chunk is free, return it */ m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m->phys_addr); - m->wire_count--; + KASSERT(m->wire_count == 1, ("wire_count == %d", m->wire_count)); + m->wire_count = 0; mtx_unlock(&pv_lock); vm_page_free(m); } @@ -3080,9 +3088,9 @@ restart: /* * Remove extra pte reference */ - if (mpte) - mpte->wire_count--; - + if (mpte) + atomic_subtract_int(&mpte->wire_count, 1); + /* * We might be turning off write access to the page, * so we go ahead and sense modify status. @@ -3112,7 +3120,7 @@ restart: om = NULL; } if (mpte != NULL) { - mpte->wire_count--; + atomic_subtract_int(&mpte->wire_count, 1); KASSERT(mpte->wire_count > 0, ("pmap_enter: missing reference to page table page," " va: 0x%lx", va)); @@ -3229,7 +3237,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t if ((*pde & PG_V) != 0) { KASSERT(mpde->wire_count > 1, ("pmap_enter_pde: mpde's wire count is too low")); - mpde->wire_count--; + atomic_subtract_int(&mpde->wire_count, 1); CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); @@ -3243,6 +3251,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t */ if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m))) { free = NULL; + if (pmap_unwire_pte_hold(pmap, va, mpde, &free)) { pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); @@ -3360,7 +3369,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ */ ptepindex = pmap_pde_pindex(va); if (mpte && (mpte->pindex == ptepindex)) { - mpte->wire_count++; + atomic_add_int(&mpte->wire_count, 1); } else { /* * Get the page directory entry @@ -3375,7 +3384,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ if (*ptepa & PG_PS) return (NULL); mpte = PHYS_TO_VM_PAGE(*ptepa & PG_FRAME); - mpte->wire_count++; + atomic_add_int(&mpte->wire_count, 1); } else { pa = VM_PAGE_TO_PHYS(m); mpte = _pmap_allocpte(pmap, pa, ptepindex, @@ -3397,7 +3406,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ pte = vtopte(va); if (*pte) { if (mpte != NULL) { - mpte->wire_count--; + atomic_subtract_int(&mpte->wire_count, 1); mpte = NULL; } return (mpte); @@ -3533,7 +3542,7 @@ retry: pmap->pm_stats.resident_count += NBPDR / PAGE_SIZE; } else { - pdpg->wire_count--; + atomic_subtract_int(&pdpg->wire_count, 1); KASSERT(pdpg->wire_count > 0, ("pmap_object_init_pt: missing reference " "to page directory page, va: 0x%lx", va)); @@ -3674,8 +3683,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm *pde = srcptepaddr & ~PG_W; dst_pmap->pm_stats.resident_count += NBPDR / PAGE_SIZE; - } else - dstmpde->wire_count--; + } else + atomic_subtract_int(&dstmpde->wire_count, 1); PA_UNLOCK(pa); continue; } @@ -3994,7 +4003,9 @@ restart: TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m->phys_addr); - m->wire_count--; + KASSERT(m->wire_count == 1, + ("wire_count == %d", m->wire_count)); + m->wire_count = 0; mtx_unlock(&pv_lock); vm_page_free(m); } Modified: user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Sat May 30 01:02:45 2009 (r193077) +++ user/kmacy/releng_7_2_fcs/sys/vm/vm_page.c Sat May 30 01:05:31 2009 (r193078) @@ -1155,13 +1155,15 @@ vm_page_alloc(vm_object_t object, vm_pin if (req & VM_ALLOC_ZERO) flags = PG_ZERO; } + mtx_unlock(&vm_page_queue_free_mtx); + if (object == NULL || object->type == OBJT_PHYS) flags |= PG_UNMANAGED; - m->flags = flags; if (req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ)) m->oflags = 0; else m->oflags = VPO_BUSY; + m->flags = flags; if (req & VM_ALLOC_WIRED) { atomic_add_int(&cnt.v_wire_count, 1); m->wire_count = 1; @@ -1171,8 +1173,6 @@ vm_page_alloc(vm_object_t object, vm_pin m->act_count = 0; m->busy = 0; KASSERT(m->dirty == 0, ("vm_page_alloc: free/cache page %p was dirty", m)); - mtx_unlock(&vm_page_queue_free_mtx); - if ((req & VM_ALLOC_NOOBJ) == 0) vm_page_insert(m, object, pindex); else @@ -1543,8 +1543,9 @@ vm_page_wire(vm_page_t m) if ((m->flags & PG_UNMANAGED) == 0) vm_pageq_remove(m); atomic_add_int(&cnt.v_wire_count, 1); - } - m->wire_count++; + m->wire_count = 1; + } else + atomic_add_int(&m->wire_count, 1); KASSERT(m->wire_count != 0, ("vm_page_wire: wire_count overflow m=%p", m)); } @@ -1584,7 +1585,10 @@ vm_page_unwire(vm_page_t m, int activate if (m->flags & PG_FICTITIOUS) return; if (m->wire_count > 0) { - m->wire_count--; + if (m->wire_count > 1) + atomic_subtract_int(&m->wire_count, 1); + else + m->wire_count = 0; if (m->wire_count == 0) { atomic_subtract_int(&cnt.v_wire_count, 1); if (m->flags & PG_UNMANAGED) { From owner-svn-src-user@FreeBSD.ORG Sat May 30 04:46:24 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA0D8106566C; Sat, 30 May 2009 04:46:24 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 989AE8FC1D; Sat, 30 May 2009 04:46:24 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U4kO0m096646; Sat, 30 May 2009 04:46:24 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U4kOt2096645; Sat, 30 May 2009 04:46:24 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905300446.n4U4kOt2096645@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 04:46:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193080 - user/kmacy/releng_7_2_fcs/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 04:46:24 -0000 Author: kmacy Date: Sat May 30 04:46:24 2009 New Revision: 193080 URL: http://svn.freebsd.org/changeset/base/193080 Log: when freeing a page that was wired decrement the global wire_count Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Sat May 30 01:33:05 2009 (r193079) +++ user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Sat May 30 04:46:24 2009 (r193080) @@ -1563,7 +1563,8 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p flags) == NULL) { KASSERT(m->wire_count == 1, ("wire_count == %d", m->wire_count)); - m->wire_count = 0; + m->wire_count = 0; + atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free(m); return (NULL); } @@ -1598,6 +1599,7 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p KASSERT(m->wire_count == 1, ("wire_count == %d", m->wire_count)); m->wire_count = 0; + atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free(m); return (NULL); } @@ -1613,6 +1615,7 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p KASSERT(m->wire_count == 1, ("wire_count == %d", m->wire_count)); m->wire_count = 0; + atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free(m); return (NULL); } @@ -2017,9 +2020,10 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv /* entire chunk is free, return it */ m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m->phys_addr); + mtx_unlock(&pv_lock); KASSERT(m->wire_count == 1, ("wire_count == %d", m->wire_count)); m->wire_count = 0; - mtx_unlock(&pv_lock); + atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free(m); } @@ -4007,6 +4011,7 @@ restart: ("wire_count == %d", m->wire_count)); m->wire_count = 0; mtx_unlock(&pv_lock); + atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free(m); } } From owner-svn-src-user@FreeBSD.ORG Sat May 30 21:21:03 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C90B11065672; Sat, 30 May 2009 21:21:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B60A08FC0A; Sat, 30 May 2009 21:21:03 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ULL34d019495; Sat, 30 May 2009 21:21:03 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ULL3Mx019492; Sat, 30 May 2009 21:21:03 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905302121.n4ULL3Mx019492@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 21:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193117 - in user/kmacy/releng_7_2_fcs/sys: libkern net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 21:21:04 -0000 Author: kmacy Date: Sat May 30 21:21:03 2009 New Revision: 193117 URL: http://svn.freebsd.org/changeset/base/193117 Log: move jenkins hash in to a separate header in libkern Added: user/kmacy/releng_7_2_fcs/sys/libkern/jenkins.h (contents, props changed) Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Added: user/kmacy/releng_7_2_fcs/sys/libkern/jenkins.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/releng_7_2_fcs/sys/libkern/jenkins.h Sat May 30 21:21:03 2009 (r193117) @@ -0,0 +1,148 @@ +#ifndef __LIBKERN_JENKINS_H__ +#define __LIBKERN_JENKINS_H__ +/* + * Taken from http://burtleburtle.net/bob/c/lookup3.c + */ + +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) + +/* +------------------------------------------------------------------------------- +mix -- mix 3 32-bit values reversibly. + +This is reversible, so any information in (a,b,c) before mix() is +still in (a,b,c) after mix(). + +If four pairs of (a,b,c) inputs are run through mix(), or through +mix() in reverse, there are at least 32 bits of the output that +are sometimes the same for one pair and different for another pair. +This was tested for: +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that +satisfy this are + 4 6 8 16 19 4 + 9 15 3 18 27 15 + 14 9 3 7 17 3 +Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing +for "differ" defined as + with a one-bit base and a two-bit delta. I +used http://burtleburtle.net/bob/hash/avalanche.html to choose +the operations, constants, and arrangements of the variables. + +This does not achieve avalanche. There are input bits of (a,b,c) +that fail to affect some output bits of (a,b,c), especially of a. The +most thoroughly mixed value is c, but it doesn't really even achieve +avalanche in c. + +This allows some parallelism. Read-after-writes are good at doubling +the number of bits affected, so the goal of mixing pulls in the opposite +direction as the goal of parallelism. I did what I could. Rotates +seem to cost as much as shifts on every machine I could lay my hands +on, and rotates are much kinder to the top and bottom bits, so I used +rotates. +------------------------------------------------------------------------------- +*/ +#define mix(a,b,c) \ +{ \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ +} + +/* +------------------------------------------------------------------------------- +final -- final mixing of 3 32-bit values (a,b,c) into c + +Pairs of (a,b,c) values differing in only a few bits will usually +produce values of c that look totally different. This was tested for +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +These constants passed: + 14 11 25 16 4 14 24 + 12 14 25 16 4 14 24 +and these came close: + 4 8 15 26 3 22 24 + 10 8 15 26 3 22 24 + 11 8 15 26 3 22 24 +------------------------------------------------------------------------------- +*/ +#define final(a,b,c) \ +{ \ + c ^= b; c -= rot(b,14); \ + a ^= c; a -= rot(c,11); \ + b ^= a; b -= rot(a,25); \ + c ^= b; c -= rot(b,16); \ + a ^= c; a -= rot(c,4); \ + b ^= a; b -= rot(a,14); \ + c ^= b; c -= rot(b,24); \ +} + +/* +-------------------------------------------------------------------- + This works on all machines. To be useful, it requires + -- that the key be an array of uint32_t's, and + -- that the length be the number of uint32_t's in the key + + The function hashword() is identical to hashlittle() on little-endian + machines, and identical to hashbig() on big-endian machines, + except that the length has to be measured in uint32_ts rather than in + bytes. hashlittle() is more complicated than hashword() only because + hashlittle() has to dance around fitting the key bytes into registers. +-------------------------------------------------------------------- +*/ +static uint32_t +jenkins_hashword( + const uint32_t *k, /* the key, an array of uint32_t values */ + size_t length, /* the length of the key, in uint32_ts */ + uint32_t initval /* the previous hash, or an arbitrary value */ +) +{ + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval; + + /*------------------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*------------------------------------------- handle the last 3 uint32_t's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------------------------ report the result */ + return c; +} +#endif Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Sat May 30 20:43:03 2009 (r193116) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Sat May 30 21:21:03 2009 (r193117) @@ -67,150 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include -/* - * Taken from http://burtleburtle.net/bob/c/lookup3.c - */ - -#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) - -/* -------------------------------------------------------------------------------- -mix -- mix 3 32-bit values reversibly. - -This is reversible, so any information in (a,b,c) before mix() is -still in (a,b,c) after mix(). - -If four pairs of (a,b,c) inputs are run through mix(), or through -mix() in reverse, there are at least 32 bits of the output that -are sometimes the same for one pair and different for another pair. -This was tested for: -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that -satisfy this are - 4 6 8 16 19 4 - 9 15 3 18 27 15 - 14 9 3 7 17 3 -Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing -for "differ" defined as + with a one-bit base and a two-bit delta. I -used http://burtleburtle.net/bob/hash/avalanche.html to choose -the operations, constants, and arrangements of the variables. - -This does not achieve avalanche. There are input bits of (a,b,c) -that fail to affect some output bits of (a,b,c), especially of a. The -most thoroughly mixed value is c, but it doesn't really even achieve -avalanche in c. - -This allows some parallelism. Read-after-writes are good at doubling -the number of bits affected, so the goal of mixing pulls in the opposite -direction as the goal of parallelism. I did what I could. Rotates -seem to cost as much as shifts on every machine I could lay my hands -on, and rotates are much kinder to the top and bottom bits, so I used -rotates. -------------------------------------------------------------------------------- -*/ -#define mix(a,b,c) \ -{ \ - a -= c; a ^= rot(c, 4); c += b; \ - b -= a; b ^= rot(a, 6); a += c; \ - c -= b; c ^= rot(b, 8); b += a; \ - a -= c; a ^= rot(c,16); c += b; \ - b -= a; b ^= rot(a,19); a += c; \ - c -= b; c ^= rot(b, 4); b += a; \ -} - -/* -------------------------------------------------------------------------------- -final -- final mixing of 3 32-bit values (a,b,c) into c - -Pairs of (a,b,c) values differing in only a few bits will usually -produce values of c that look totally different. This was tested for -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -These constants passed: - 14 11 25 16 4 14 24 - 12 14 25 16 4 14 24 -and these came close: - 4 8 15 26 3 22 24 - 10 8 15 26 3 22 24 - 11 8 15 26 3 22 24 -------------------------------------------------------------------------------- -*/ -#define final(a,b,c) \ -{ \ - c ^= b; c -= rot(b,14); \ - a ^= c; a -= rot(c,11); \ - b ^= a; b -= rot(a,25); \ - c ^= b; c -= rot(b,16); \ - a ^= c; a -= rot(c,4); \ - b ^= a; b -= rot(a,14); \ - c ^= b; c -= rot(b,24); \ -} - -/* --------------------------------------------------------------------- - This works on all machines. To be useful, it requires - -- that the key be an array of uint32_t's, and - -- that the length be the number of uint32_t's in the key - - The function hashword() is identical to hashlittle() on little-endian - machines, and identical to hashbig() on big-endian machines, - except that the length has to be measured in uint32_ts rather than in - bytes. hashlittle() is more complicated than hashword() only because - hashlittle() has to dance around fitting the key bytes into registers. --------------------------------------------------------------------- -*/ -static uint32_t hashword( -const uint32_t *k, /* the key, an array of uint32_t values */ -size_t length, /* the length of the key, in uint32_ts */ -uint32_t initval) /* the previous hash, or an arbitrary value */ -{ - uint32_t a,b,c; - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval; - - /*------------------------------------------------- handle most of the key */ - while (length > 3) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 3; - k += 3; - } - - /*------------------------------------------- handle the last 3 uint32_t's */ - switch(length) /* all the case statements fall through */ - { - case 3 : c+=k[2]; - case 2 : b+=k[1]; - case 1 : a+=k[0]; - final(a,b,c); - case 0: /* case 0: nothing left to add */ - break; - } - /*------------------------------------------------------ report the result */ - return c; -} - +#include struct ipv4_tuple { uint16_t ip_sport; /* source port */ @@ -525,7 +382,7 @@ ipv4_flow_lookup_hash_internal(struct mb ((uint16_t *)key)[1] = dport; skipports: - hash = hashword(key, 3, hashjitter + proto); + hash = jenkins_hashword(key, 3, hashjitter + proto); if (m != NULL && (m->m_flags & M_FLOWID) == 0) { m->m_flags |= M_FLOWID; m->m_pkthdr.flowid = hash; From owner-svn-src-user@FreeBSD.ORG Sat May 30 21:52:57 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38EF71065672; Sat, 30 May 2009 21:52:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27FCC8FC15; Sat, 30 May 2009 21:52:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ULqvSg020299; Sat, 30 May 2009 21:52:57 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ULqvAC020298; Sat, 30 May 2009 21:52:57 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905302152.n4ULqvAC020298@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 21:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193120 - user/kmacy/releng_7_2_fcs/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 21:52:57 -0000 Author: kmacy Date: Sat May 30 21:52:56 2009 New Revision: 193120 URL: http://svn.freebsd.org/changeset/base/193120 Log: cache line align page lock mutexes Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Sat May 30 21:51:38 2009 (r193119) +++ user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Sat May 30 21:52:56 2009 (r193120) @@ -165,6 +165,14 @@ __FBSDID("$FreeBSD$"); #define PV_STAT(x) do { } while (0) #endif +#define CACHE_LINE_FETCH_SIZE 128 +#define PA_LOCK_PAD CACHE_LINE_FETCH_SIZE + +struct vp_lock { + struct mtx vp_lock; + unsigned char pad[(PA_LOCK_PAD - sizeof(struct mtx))]; +}; + #define pa_index(pa) ((pa) >> PDRSHIFT) #define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) @@ -176,7 +184,7 @@ __FBSDID("$FreeBSD$"); #define PA_LOCK_COUNT 64 -struct mtx pa_lock[PA_LOCK_COUNT]; +struct vp_lock pa_lock[PA_LOCK_COUNT]; struct mtx pv_lock; struct pmap kernel_pmap_store; From owner-svn-src-user@FreeBSD.ORG Sat May 30 21:55:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6701106566C; Sat, 30 May 2009 21:55:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4C678FC16; Sat, 30 May 2009 21:55:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ULthLq020405; Sat, 30 May 2009 21:55:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ULth4u020404; Sat, 30 May 2009 21:55:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905302155.n4ULth4u020404@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 21:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193121 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 21:55:44 -0000 Author: kmacy Date: Sat May 30 21:55:43 2009 New Revision: 193121 URL: http://svn.freebsd.org/changeset/base/193121 Log: reduce hash table collisions by switching from crc32 to jenkins as the hash function Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat May 30 21:52:56 2009 (r193120) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat May 30 21:55:43 2009 (r193121) @@ -132,6 +132,7 @@ #include #include +#include static kmutex_t arc_reclaim_thr_lock; static kcondvar_t arc_reclaim_thr_cv; /* used to signal reclaim thr */ @@ -625,19 +626,25 @@ static void l2arc_hdr_stat_remove(void); static uint64_t buf_hash(spa_t *spa, const dva_t *dva, uint64_t birth) { - uintptr_t spav = (uintptr_t)spa; - uint8_t *vdva = (uint8_t *)dva; - uint64_t crc = -1ULL; - int i; - - ASSERT(zfs_crc64_table[128] == ZFS_CRC64_POLY); - - for (i = 0; i < sizeof (dva_t); i++) - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ vdva[i]) & 0xFF]; - - crc ^= (spav>>8) ^ birth; + uint32_t hashinput[2 + 4 + (sizeof(uintptr_t)>>2)]; + int count = 2 + 4 + (sizeof(uintptr_t)>>2); - return (crc); + hashinput[0] = ((uint32_t *)&birth)[0]; + hashinput[1] = ((uint32_t *)&birth)[1]; + hashinput[2] = ((uint32_t *)dva)[0]; + + hashinput[3] = ((uint32_t *)dva)[1]; + hashinput[4] = ((uint32_t *)dva)[2]; + hashinput[5] = ((uint32_t *)dva)[3]; + hashinput[6] = ((uint32_t *)&spa)[0]; +#ifdef __LP64__ + hashinput[7] = ((uint32_t *)&spa)[1]; +#endif +/* + * "only" 32-bits, but this will suffice up 16TB of RAM (2^(32+12)) + * + */ + return (jenkins_hashword(hashinput, count, 0xCAFEBABE)); } #define BUF_EMPTY(buf) \ From owner-svn-src-user@FreeBSD.ORG Sat May 30 22:00:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2D2D1065673; Sat, 30 May 2009 22:00:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A135E8FC19; Sat, 30 May 2009 22:00:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UM0UdN020563; Sat, 30 May 2009 22:00:30 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UM0UrU020562; Sat, 30 May 2009 22:00:30 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905302200.n4UM0UrU020562@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 22:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193122 - user/kmacy/releng_7_2_fcs/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 22:00:31 -0000 Author: kmacy Date: Sat May 30 22:00:30 2009 New Revision: 193122 URL: http://svn.freebsd.org/changeset/base/193122 Log: fix vm page lock change Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Sat May 30 21:55:43 2009 (r193121) +++ user/kmacy/releng_7_2_fcs/sys/amd64/amd64/pmap.c Sat May 30 22:00:30 2009 (r193122) @@ -176,7 +176,7 @@ struct vp_lock { #define pa_index(pa) ((pa) >> PDRSHIFT) #define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) -#define PA_LOCKPTR(pa) &pa_lock[pa_index((pa)) % PA_LOCK_COUNT] +#define PA_LOCKPTR(pa) &pa_lock[pa_index((pa)) % PA_LOCK_COUNT].vp_lock #define PA_LOCK(pa) mtx_lock(PA_LOCKPTR(pa)) #define PA_TRYLOCK(pa) mtx_trylock(PA_LOCKPTR(pa)) #define PA_UNLOCK(pa) mtx_unlock(PA_LOCKPTR(pa)) @@ -626,7 +626,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) /* Setup page locks. */ for (i = 0; i < PA_LOCK_COUNT; i++) - mtx_init(&pa_lock[i], "page lock", NULL, MTX_DEF | MTX_RECURSE | MTX_DUPOK); + mtx_init(&pa_lock[i].vp_lock, "page lock", NULL, MTX_DEF | MTX_RECURSE | MTX_DUPOK); mtx_init(&pv_lock, "pv list lock", NULL, MTX_DEF); } From owner-svn-src-user@FreeBSD.ORG Sat May 30 22:16:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B89F1065672; Sat, 30 May 2009 22:16:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A95B8FC1A; Sat, 30 May 2009 22:16:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UMGTsE021069; Sat, 30 May 2009 22:16:30 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UMGT8I021068; Sat, 30 May 2009 22:16:29 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905302216.n4UMGT8I021068@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 22:16:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193127 - user/kmacy/releng_7_2_fcs/cddl/lib/libzpool X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 22:16:30 -0000 Author: kmacy Date: Sat May 30 22:16:29 2009 New Revision: 193127 URL: http://svn.freebsd.org/changeset/base/193127 Log: include sys to make available libkern Modified: user/kmacy/releng_7_2_fcs/cddl/lib/libzpool/Makefile Modified: user/kmacy/releng_7_2_fcs/cddl/lib/libzpool/Makefile ============================================================================== --- user/kmacy/releng_7_2_fcs/cddl/lib/libzpool/Makefile Sat May 30 22:15:55 2009 (r193126) +++ user/kmacy/releng_7_2_fcs/cddl/lib/libzpool/Makefile Sat May 30 22:16:29 2009 (r193127) @@ -51,6 +51,7 @@ CFLAGS+= -DWANTS_MUTEX_OWNED CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/thread CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/sys CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_ARCH}/include +CFLAGS+= -I${.CURDIR}/../../../sys DPADD= ${LIBPTHREAD} ${LIBZ} LDADD= -lpthread -lz From owner-svn-src-user@FreeBSD.ORG Sat May 30 22:25:50 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2483D106566B; Sat, 30 May 2009 22:25:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1282B8FC26; Sat, 30 May 2009 22:25:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UMPnlF021388; Sat, 30 May 2009 22:25:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UMPnRm021386; Sat, 30 May 2009 22:25:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905302225.n4UMPnRm021386@svn.freebsd.org> From: Kip Macy Date: Sat, 30 May 2009 22:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193129 - in user/kmacy/releng_7_2_fcs/sys: cddl/contrib/opensolaris/uts/common/fs/zfs rpc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 22:25:50 -0000 Author: kmacy Date: Sat May 30 22:25:49 2009 New Revision: 193129 URL: http://svn.freebsd.org/changeset/base/193129 Log: fix xdrmem_control and rpc dependency Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat May 30 22:23:58 2009 (r193128) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat May 30 22:25:49 2009 (r193129) @@ -3122,3 +3122,4 @@ static moduledata_t zfs_mod = { }; DECLARE_MODULE(zfsctrl, zfs_mod, SI_SUB_VFS, SI_ORDER_ANY); MODULE_DEPEND(zfsctrl, opensolaris, 1, 1, 1); +MODULE_DEPEND(zfsctrl, krpc, 1, 1, 1); Modified: user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h Sat May 30 22:23:58 2009 (r193128) +++ user/kmacy/releng_7_2_fcs/sys/rpc/xdr.h Sat May 30 22:25:49 2009 (r193129) @@ -216,8 +216,8 @@ xdr_putlong(XDR *xdrs, long *lp) (*(xdrs)->x_ops->x_destroy)(xdrs) #define XDR_CONTROL(xdrs, req, op) \ - if ((xdrs)->x_ops->x_control) \ - (*(xdrs)->x_ops->x_control)(xdrs, req, op) + (((xdrs)->x_ops->x_control == NULL) ? (FALSE) : \ + (*(xdrs)->x_ops->x_control)(xdrs, req, op)) #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op) /* From owner-svn-src-user@FreeBSD.ORG Sat May 30 22:31:47 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53FD8106566B; Sat, 30 May 2009 22:31:47 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42F458FC0C; Sat, 30 May 2009 22:31:47 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UMVlkC021539; Sat, 30 May 2009 22:31:47 GMT (envelope-from gad@svn.freebsd.org) Received: (from gad@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UMVlM8021538; Sat, 30 May 2009 22:31:47 GMT (envelope-from gad@svn.freebsd.org) Message-Id: <200905302231.n4UMVlM8021538@svn.freebsd.org> From: Garance A Drosehn Date: Sat, 30 May 2009 22:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193130 - in user/gad: . singlemod speculate X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 22:31:47 -0000 Author: gad Date: Sat May 30 22:31:46 2009 New Revision: 193130 URL: http://svn.freebsd.org/changeset/base/193130 Log: Start to do a little work here. Added: user/gad/README.txt user/gad/singlemod/ user/gad/speculate/ Added: user/gad/README.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gad/README.txt Sat May 30 22:31:46 2009 (r193130) @@ -0,0 +1,5 @@ +An initial cut at some organization to my stuff here: + +SINGLEMOD will hold changes which are limited in scope to a single module. +SPECULATE is for experimental stuff which might never make it into the base. + From owner-svn-src-user@FreeBSD.ORG Sat May 30 23:01:17 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDAB81065688; Sat, 30 May 2009 23:01:17 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C26CF8FC08; Sat, 30 May 2009 23:01:17 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UN1Hkh022169; Sat, 30 May 2009 23:01:17 GMT (envelope-from gad@svn.freebsd.org) Received: (from gad@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UN1H63022168; Sat, 30 May 2009 23:01:17 GMT (envelope-from gad@svn.freebsd.org) Message-Id: <200905302301.n4UN1H63022168@svn.freebsd.org> From: Garance A Drosehn Date: Sat, 30 May 2009 23:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193132 - user/gad/singlemod/nsl-or X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 23:01:18 -0000 Author: gad Date: Sat May 30 23:01:17 2009 New Revision: 193132 URL: http://svn.freebsd.org/changeset/base/193132 Log: Starting point for changes to add "or"-ish support via multiple lines (for a single file-to-rotate) in the newsyslog.conf file. Added: user/gad/singlemod/nsl-or/ (props changed) - copied from r193131, head/usr.sbin/newsyslog/