From owner-svn-src-user@FreeBSD.ORG Sun Sep 20 05:06:42 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 658FA106566B; Sun, 20 Sep 2009 05:06:42 +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 555568FC17; Sun, 20 Sep 2009 05:06:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8K56gaJ044606; Sun, 20 Sep 2009 05:06:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8K56gke044601; Sun, 20 Sep 2009 05:06:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200909200506.n8K56gke044601@svn.freebsd.org> From: Kip Macy Date: Sun, 20 Sep 2009 05:06: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: r197339 - user/kmacy/releng_8_fcs/sys/netinet 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, 20 Sep 2009 05:06:42 -0000 Author: kmacy Date: Sun Sep 20 05:06:42 2009 New Revision: 197339 URL: http://svn.freebsd.org/changeset/base/197339 Log: cache lle and rtentry in connected sockets Modified: user/kmacy/releng_8_fcs/sys/netinet/in_pcb.c user/kmacy/releng_8_fcs/sys/netinet/in_pcb.h user/kmacy/releng_8_fcs/sys/netinet/ip_output.c user/kmacy/releng_8_fcs/sys/netinet/tcp_usrreq.c Modified: user/kmacy/releng_8_fcs/sys/netinet/in_pcb.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/netinet/in_pcb.c Sun Sep 20 05:04:23 2009 (r197338) +++ user/kmacy/releng_8_fcs/sys/netinet/in_pcb.c Sun Sep 20 05:06:42 2009 (r197339) @@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -203,6 +205,7 @@ in_pcballoc(struct socket *so, struct in inp->inp_socket = so; inp->inp_cred = crhold(so->so_cred); inp->inp_inc.inc_fibnum = so->so_fibnum; + inp->inp_flowid = arc4random(); #ifdef MAC error = mac_inpcb_init(inp, M_NOWAIT); if (error != 0) @@ -489,6 +492,80 @@ in_pcbbind_setup(struct inpcb *inp, stru return (0); } +void +in_pcbrtalloc(struct inpcb *inp, in_addr_t faddr, struct route *sro) +{ + struct sockaddr_in *sin; + struct sockaddr *dst; + struct llentry *la; + struct rtentry *rt; + struct ifnet *ifp; + int flags = LLE_EXCLUSIVE; + struct route iproute; + + INP_WLOCK_ASSERT(inp); + if (sro == NULL) + sro = &iproute; + + bzero(sro, sizeof(*sro)); + sin = (struct sockaddr_in *)&sro->ro_dst; + sin->sin_family = AF_INET; + sin->sin_len = sizeof(struct sockaddr_in); + sin->sin_addr.s_addr = faddr; + /* + * If route is known our src addr is taken from the i/f, + * else punt. + * + * Find out route to destination. + */ + if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0) { +#ifdef RADIX_MPATH + rtalloc_mpath_fib(sro, ntohl(faddr->s_addr), + inp->inp_inc.inc_fibnum); +#else + in_rtalloc_ign(sro, 0, inp->inp_inc.inc_fibnum); +#endif + } + + rt = sro->ro_rt; + /* + * Don't cache route in pcb if this is a per-packet + * route + */ + if (rt == NULL) + return; + + inp->inp_rt = rt; + inp->inp_flags2 |= INP_RT_VALID; + + if (rt->rt_ifp == NULL) + return; + + ifp = rt->rt_ifp; + dst = &sro->ro_dst; + if (rt->rt_flags & RTF_GATEWAY) + dst = rt->rt_gateway; + + IF_AFDATA_RLOCK(ifp); + la = lla_lookup(LLTABLE(ifp), flags, dst); + IF_AFDATA_RUNLOCK(ifp); + if ((la == NULL) && + (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { + flags |= (LLE_CREATE | LLE_EXCLUSIVE); + IF_AFDATA_WLOCK(ifp); + la = lla_lookup(LLTABLE(ifp), flags, dst); + IF_AFDATA_WUNLOCK(ifp); + } + if (la == NULL) + return; + + LLE_ADDREF(la); + LLE_WUNLOCK(la); + + inp->inp_lle = la; + inp->inp_flags2 |= INP_LLE_VALID; +} + /* * Connect from a socket to a specified address. * Both address and port must be specified in argument sin. @@ -524,6 +601,7 @@ in_pcbconnect(struct inpcb *inp, struct } } + in_pcbrtalloc(inp, faddr, NULL); /* Commit the remaining changes. */ inp->inp_lport = lport; inp->inp_laddr.s_addr = laddr; @@ -884,6 +962,17 @@ in_pcbdisconnect(struct inpcb *inp) INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + if (inp->inp_flags2 & INP_RT_VALID) { + inp->inp_flags2 &= ~INP_RT_VALID; + RTFREE(inp->inp_rt); + inp->inp_rt = NULL; + } + if (inp->inp_flags2 & INP_LLE_VALID) { + inp->inp_flags2 &= ~INP_LLE_VALID; + LLE_FREE(inp->inp_lle); + inp->inp_lle = NULL; + } + inp->inp_faddr.s_addr = INADDR_ANY; inp->inp_fport = 0; in_pcbrehash(inp); @@ -921,6 +1010,17 @@ in_pcbfree_internal(struct inpcb *inp) INP_INFO_WLOCK_ASSERT(ipi); INP_WLOCK_ASSERT(inp); + if (inp->inp_flags2 & INP_RT_VALID) { + inp->inp_flags2 &= ~INP_RT_VALID; + RTFREE(inp->inp_rt); + inp->inp_rt = NULL; + } + if (inp->inp_flags2 & INP_LLE_VALID) { + inp->inp_flags2 &= ~INP_LLE_VALID; + LLE_FREE(inp->inp_lle); + inp->inp_lle = NULL; + } + #ifdef IPSEC if (inp->inp_sp != NULL) ipsec_delete_pcbpolicy(inp); Modified: user/kmacy/releng_8_fcs/sys/netinet/in_pcb.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/netinet/in_pcb.h Sun Sep 20 05:04:23 2009 (r197338) +++ user/kmacy/releng_8_fcs/sys/netinet/in_pcb.h Sun Sep 20 05:06:42 2009 (r197339) @@ -452,6 +452,8 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af) #ifdef _KERNEL +struct route; + VNET_DECLARE(int, ipport_reservedhigh); VNET_DECLARE(int, ipport_reservedlow); VNET_DECLARE(int, ipport_lowfirstauto); @@ -496,6 +498,7 @@ void in_pcbdisconnect(struct inpcb *); void in_pcbdrop(struct inpcb *); void in_pcbfree(struct inpcb *); int in_pcbinshash(struct inpcb *); +void in_pcbrtalloc(struct inpcb *inp, in_addr_t faddr, struct route *sro); struct inpcb * in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short, int, struct ucred *); Modified: user/kmacy/releng_8_fcs/sys/netinet/ip_output.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/netinet/ip_output.c Sun Sep 20 05:04:23 2009 (r197338) +++ user/kmacy/releng_8_fcs/sys/netinet/ip_output.c Sun Sep 20 05:06:42 2009 (r197339) @@ -124,11 +124,13 @@ ip_output(struct mbuf *m, struct mbuf *o int mtu; int len, error = 0; int nortfree = 0; + int neednewroute = 0, neednewlle = 0; struct sockaddr_in *dst = NULL; /* keep compiler happy */ struct in_ifaddr *ia = NULL; int isbroadcast, sw_csum; struct route iproute; struct in_addr odst; + struct sockaddr_in *sin; #ifdef IPFIREWALL_FORWARD struct m_tag *fwd_tag = NULL; #endif @@ -202,7 +204,7 @@ again: if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_family != AF_INET || dst->sin_addr.s_addr != ip->ip_dst.s_addr)) { - if (!nortfree) + if (!nortfree && (inp == NULL || (ro->ro_rt != inp->inp_rt))) RTFREE(ro->ro_rt); ro->ro_rt = (struct rtentry *)NULL; ro->ro_lle = (struct llentry *)NULL; @@ -236,13 +238,17 @@ again: ip->ip_ttl = 1; isbroadcast = 1; } else if (flags & IP_ROUTETOIF) { - if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL && + if (!nortfree && + (ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL && (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) { IPSTAT_INC(ips_noroute); error = ENETUNREACH; goto bad; } - ifp = ia->ia_ifp; + if (nortfree) + ifp = ro->ro_rt->rt_ifp; + else + ifp = ia->ia_ifp; ip->ip_ttl = 1; isbroadcast = in_broadcast(dst->sin_addr, ifp); } else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) && @@ -418,6 +424,22 @@ again: if (ia != NULL) { ip->ip_src = IA_SIN(ia)->sin_addr; } + if ((ro == &iproute) && (inp->inp_flags2 & INP_RT_VALID)) { + if (inp->inp_rt->rt_flags & RTF_UP) { + sin = (struct sockaddr_in *)&ro->ro_dst; + sin->sin_family = AF_INET; + sin->sin_len = sizeof(struct sockaddr_in); + sin->sin_addr.s_addr = inp->inp_faddr.s_addr; + ro->ro_rt = inp->inp_rt; + } else + neednewroute = 1; + } + if ((ro == &iproute) && (inp->inp_flags2 & INP_LLE_VALID)) { + if (inp->inp_lle->la_flags & LLE_VALID) { + ro->ro_lle = inp->inp_lle; + } else + neednewlle = 1; + } } /* @@ -662,7 +684,45 @@ passout: done: if (ro == &iproute && ro->ro_rt && !nortfree) { - RTFREE(ro->ro_rt); + int wlocked = 0; + struct llentry *la; + + if (neednewlle || neednewroute) { + wlocked = INP_WLOCKED(inp); + if (!wlocked && INP_TRY_UPGRADE(inp) == 0) + return (error); + } + + if ((nortfree == 0) && + (inp == NULL || (inp->inp_vflag & INP_RT_VALID) == 0)) + RTFREE(ro->ro_rt); + else if (neednewroute && ro->ro_rt != inp->inp_rt) { + RTFREE(inp->inp_rt); + inp->inp_rt = ro->ro_rt; + } + if (neednewlle) { + IF_AFDATA_RLOCK(ifp); + la = lla_lookup(LLTABLE(ifp), LLE_EXCLUSIVE, + (struct sockaddr *)dst); + IF_AFDATA_RUNLOCK(ifp); + if ((la == NULL) && + (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { + IF_AFDATA_WLOCK(ifp); + la = lla_lookup(LLTABLE(ifp), + (LLE_CREATE | LLE_EXCLUSIVE), + (struct sockaddr *)dst); + IF_AFDATA_WUNLOCK(ifp); + } + if (la != NULL && (inp->inp_lle != la)) { + LLE_FREE(inp->inp_lle); + LLE_ADDREF(la); + LLE_WUNLOCK(la); + inp->inp_lle = la; + } else if (la != NULL) + LLE_WUNLOCK(la); + } + if ((neednewlle || neednewroute) && !wlocked) + INP_DOWNGRADE(inp); } if (ia != NULL) ifa_free(&ia->ia_ifa); Modified: user/kmacy/releng_8_fcs/sys/netinet/tcp_usrreq.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/netinet/tcp_usrreq.c Sun Sep 20 05:04:23 2009 (r197338) +++ user/kmacy/releng_8_fcs/sys/netinet/tcp_usrreq.c Sun Sep 20 05:06:42 2009 (r197339) @@ -1091,6 +1091,7 @@ tcp_connect(struct tcpcb *tp, struct soc inp->inp_laddr = laddr; in_pcbrehash(inp); + in_pcbrtalloc(inp, inp->inp_faddr.s_addr, NULL); /* * Compute window scaling to request: * Scale to fit into sweet spot. See tcp_syncache.c. From owner-svn-src-user@FreeBSD.ORG Sun Sep 20 05:31: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 567E0106572D; Sun, 20 Sep 2009 05:31:42 +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 6BF498FC1E; Sun, 20 Sep 2009 05:31:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8K5VggO045116; Sun, 20 Sep 2009 05:31:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8K5VgYg045114; Sun, 20 Sep 2009 05:31:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200909200531.n8K5VgYg045114@svn.freebsd.org> From: Kip Macy Date: Sun, 20 Sep 2009 05:31: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: r197340 - user/kmacy/releng_8_fcs/sys/netinet 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, 20 Sep 2009 05:31:43 -0000 Author: kmacy Date: Sun Sep 20 05:31:42 2009 New Revision: 197340 URL: http://svn.freebsd.org/changeset/base/197340 Log: don't delay ACKs to localhost Modified: user/kmacy/releng_8_fcs/sys/netinet/tcp_input.c Modified: user/kmacy/releng_8_fcs/sys/netinet/tcp_input.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/netinet/tcp_input.c Sun Sep 20 05:06:42 2009 (r197339) +++ user/kmacy/releng_8_fcs/sys/netinet/tcp_input.c Sun Sep 20 05:31:42 2009 (r197340) @@ -269,6 +269,8 @@ do { \ */ #define DELAY_ACK(tp) \ ((!tcp_timer_active(tp, TT_DELACK) && \ + !((tp->t_inpcb->inp_flags2 & INP_RT_VALID) && \ + (tp->t_inpcb->inp_rt->rt_ifp->if_flags & IFF_LOOPBACK)) && \ (tp->t_flags & TF_RXWIN0SENT) == 0) && \ (V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN))) From owner-svn-src-user@FreeBSD.ORG Mon Sep 21 07:50:58 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 25497106566C; Mon, 21 Sep 2009 07:50:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 133968FC1F; Mon, 21 Sep 2009 07:50:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8L7owmS080182; Mon, 21 Sep 2009 07:50:58 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8L7ovuN080175; Mon, 21 Sep 2009 07:50:58 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200909210750.n8L7ovuN080175@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 21 Sep 2009 07:50: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: r197382 - in user/edwin/locale/share: . colldef 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, 21 Sep 2009 07:50:58 -0000 Author: edwin Date: Mon Sep 21 07:50:57 2009 New Revision: 197382 URL: http://svn.freebsd.org/changeset/base/197382 Log: Complete the migration of share/colldef Added: user/edwin/locale/share/colldef/la_LN.ISO8859-13.src - copied unchanged from r196788, head/share/colldef/la_LN.ISO8859-13.src user/edwin/locale/share/colldef/sr_Cyrl_RS.ISO8859-5.src - copied unchanged from r196349, user/edwin/locale/share/colldef/sr_YU.ISO8859-5.src Deleted: user/edwin/locale/share/colldef/lt_LT.ISO8859-13.src user/edwin/locale/share/colldef/sr_YU.ISO8859-5.src Modified: user/edwin/locale/share/ (props changed) user/edwin/locale/share/Makefile user/edwin/locale/share/Makefile.def.inc user/edwin/locale/share/colldef/Makefile user/edwin/locale/share/mfc Modified: user/edwin/locale/share/Makefile ============================================================================== --- user/edwin/locale/share/Makefile Mon Sep 21 07:38:50 2009 (r197381) +++ user/edwin/locale/share/Makefile Mon Sep 21 07:50:57 2009 (r197382) @@ -5,7 +5,7 @@ # Do not include `info' in the SUBDIR list, it is handled separately. -SUBDIR= msgdef numericdef timedef monetdef # colldef +SUBDIR= colldef msgdef numericdef timedef monetdef _SUBDIR= ${_colldef} \ ${_dict} \ Modified: user/edwin/locale/share/Makefile.def.inc ============================================================================== --- user/edwin/locale/share/Makefile.def.inc Mon Sep 21 07:38:50 2009 (r197381) +++ user/edwin/locale/share/Makefile.def.inc Mon Sep 21 07:50:57 2009 (r197382) @@ -11,6 +11,17 @@ CMALIAS_ISCII-DEV= macdevanaga ICONV= iconv ICONV_hi_IN.ISCII-DEV= bsdiconv +# Target selection +TARGET_LC_MESSAGES= TARGET_CHARACTERMAP +TARGET_LC_MONETARY= TARGET_CHARACTERMAP +TARGET_LC_NUMERIC= TARGET_CHARACTERMAP +TARGET_LC_TIME= TARGET_CHARACTERMAP +TARGET_LC_COLLATE= TARGET_COLLDEF +.if !defined(TARGET_${LCTYPE}) +.error unknown LCTYPE (${LCTYPE}) or not set. +.endif +TARGET= ${TARGET_${LCTYPE}} + # # Calculated variables # @@ -30,8 +41,11 @@ CMS+= ${cm} . endfor .endfor -# All files generated and their locations +# All files generated and their locations. Default UTF-8 is only for +# the TARGET_CHARACTERMAP, not for the TARGET_COLLDEF. +.if ${TARGET} == "TARGET_CHARACTERMAP" ALLFILES= ${CCLN:S/$/.UTF-8/} +.endif .for ccln in ${CCLN} FILESDIR_${ccln}.UTF-8.out= ${LOCALEDIR}/${ccln}.UTF-8 . for cm in ${CMS_${ccln}} @@ -253,19 +267,6 @@ _TRANSLATIONAFTER_${cm}+= | awk '{ gsub .endfor # -# Target selection -# -TARGET_LC_MESSAGES= TARGET_CHARACTERMAP -TARGET_LC_MONETARY= TARGET_CHARACTERMAP -TARGET_LC_NUMERIC= TARGET_CHARACTERMAP -TARGET_LC_TIME= TARGET_CHARACTERMAP -TARGET_LC_COLLDEF= TARGET_COLLDEF -.if !defined(TARGET_${LCTYPE}) -.error unknown LCTYPE (${LCTYPE}) or not set. -.endif -TARGET= ${TARGET_${LCTYPE}} - -# # All targets for TARGET_CHARACTERMAP # # .unicode -> utf-8.src -> utf-8.out @@ -322,6 +323,21 @@ ${ccln}.${cms}.out: ${ccln}.${cms}.src . endfor .endif +# +# All targets for TARGET_COLLDEF +# +.if ${TARGET} == "TARGET_COLLDEF" +. for ccln in ${CCLN} +. for cm in ${CMS_${ccln}} +${ccln}.${cm}.out: ${ccln}.${cm}.src + colldef -I ${.CURDIR} -o ${.TARGET} ${.ALLSRC} +. endfor +. endfor +.endif + +# +# General targets. +# beforeinstall: .for f in ${FILES:S/.out//} rm -f ${DESTDIR}/${LOCALEDIR}/${f}/${FILESNAME} Modified: user/edwin/locale/share/colldef/Makefile ============================================================================== --- user/edwin/locale/share/colldef/Makefile Mon Sep 21 07:38:50 2009 (r197381) +++ user/edwin/locale/share/colldef/Makefile Mon Sep 21 07:50:57 2009 (r197382) @@ -18,7 +18,7 @@ CMS_hi_IN= ISCII-DEV CMS_hr_HR= ISO8859-2 CMS_hy_AM= ARMSCII-8 CMS_is_IS= ISO8859-1 ISO8859-15 -CMS_kk_KZ= CP154 +CMS_kk_KZ= PT154 CMS_la_LN= ISO8859-1 ISO8859-2 ISO8859-4 ISO8859-13 ISO8859-15 US-ASCII CMS_lt_LT= ISO8859-4 CMS_no_NO= ISO8859-1 ISO8859-15 @@ -32,28 +32,38 @@ CMS_uk_UA= CP1251 ISO8859-5 KOI8-U # For these locales, link the following charactermaps to the UTF-8 map. # (unless the origin charactermap is defined) -CMSLINK_be_BY= cm CMSLINK_ca_ES.ISO8859-1= ca_AD.ISO8859-1 ca_FR.ISO8859-1 ca_IT.ISO8859-1 CMSLINK_ca_ES.ISO8859-15= ca_AD.ISO8859-15 ca_FR.ISO8859-15 ca_IT.ISO8859-15 -CMSLINK_ca_CZ.ISO8859-2= sk_SK.ISO8859-2 +CMSLINK_cs_CZ.ISO8859-2= sk_SK.ISO8859-2 CMSLINK_de_DE.ISO8859-1= de_AT.ISO8859-1 de_CH.ISO8859-1 CMSLINK_de_DE.ISO8859-15= de_AT.ISO8859-15 de_CH.ISO8859-15 CMSLINK_is_IS.ISO8859-1= zh_Hant_TW.Big5 CMSLINK_no_NO.ISO8859-1= nb_NO.ISO8859-1 nn_NO.ISO8859-1 CMSLINK_no_NO.ISO8859-15= nb_NO.ISO8859-15 nn_NO.ISO8859-15 CMSLINK_pt_PT.ISO8859-1= pt_BR.ISO8859-1 -CMSLINK_la_LN.ISO8859-1= af_ZA.ISO8859-1/LC_COLLATE da_DK.ISO8859-1/LC_COLLATE en_AU.ISO8859-1/LC_COLLATE en_CA.ISO8859-1/LC_COLLATE en_GB.ISO8859-1/LC_COLLATE en_NZ.ISO8859-1/LC_COLLATE en_US.ISO8859-1/LC_COLLATE eu_ES.ISO8859-1/LC_COLLATE fi_FI.ISO8859-1/LC_COLLATE fr_BE.ISO8859-1/LC_COLLATE fr_CA.ISO8859-1/LC_COLLATE fr_CH.ISO8859-1/LC_COLLATE fr_FR.ISO8859-1/LC_COLLATE it_CH.ISO8859-1/LC_COLLATE it_IT.ISO8859-1/LC_COLLATE nl_BE.ISO8859-1/LC_COLLATE nl_NL.ISO8859-1/LC_COLLATE pt_PT.ISO8859-1/LC_COLLATE +CMSLINK_la_LN.ISO8859-1= af_ZA.ISO8859-1 da_DK.ISO8859-1 en_AU.ISO8859-1 en_CA.ISO8859-1 en_GB.ISO8859-1 en_NZ.ISO8859-1 en_US.ISO8859-1 eu_ES.ISO8859-1 fi_FI.ISO8859-1 fr_BE.ISO8859-1 fr_CA.ISO8859-1 fr_CH.ISO8859-1 fr_FR.ISO8859-1 it_CH.ISO8859-1 it_IT.ISO8859-1 nl_BE.ISO8859-1 nl_NL.ISO8859-1 pt_BR.ISO8859-1 pt_PT.ISO8859-1 CMSLINK_la_LN.ISO8859-2= hu_HU.ISO8859-2 ro_RO.ISO8859-2 sr_YU.ISO8859-2 CMSLINK_la_LN.ISO8859-13= lt_LT.ISO8859-13 lv_LV.ISO8859-13 -CMSLINK_la_LN.ISO8859-15= af_ZA.ISO8859-15/LC_COLLATE da_DK.ISO8859-15/LC_COLLATE en_AU.ISO8859-15/LC_COLLATE en_CA.ISO8859-15/LC_COLLATE en_GB.ISO8859-15/LC_COLLATE en_NZ.ISO8859-15/LC_COLLATE en_US.ISO8859-15/LC_COLLATE eu_ES.ISO8859-15/LC_COLLATE fi_FI.ISO8859-15/LC_COLLATE fr_BE.ISO8859-15/LC_COLLATE fr_CA.ISO8859-15/LC_COLLATE fr_CH.ISO8859-15/LC_COLLATE fr_FR.ISO8859-15/LC_COLLATE it_CH.ISO8859-15/LC_COLLATE it_IT.ISO8859-15/LC_COLLATE nl_BE.ISO8859-15/LC_COLLATE nl_NL.ISO8859-15/LC_COLLATE pt_PT.ISO8859-15/LC_COLLATE -CMSLINK_la_LN.US-ASCII= af_ZA.UTF-8/LC_COLLATE am_ET.UTF-8/LC_COLLATE be_BY.UTF-8/LC_COLLATE bg_BG.UTF-8/LC_COLLATE ca_AD.UTF-8/LC_COLLATE ca_ES.UTF-8/LC_COLLATE ca_FR.UTF-8/LC_COLLATE ca_IT.UTF-8/LC_COLLATE cs_CZ.UTF-8/LC_COLLATE da_DK.UTF-8/LC_COLLATE de_AT.UTF-8/LC_COLLATE de_CH.UTF-8/LC_COLLATE de_DE.UTF-8/LC_COLLATE el_GR.UTF-8/LC_COLLATE en_AU.US-ASCII/LC_COLLATE en_AU.UTF-8/LC_COLLATE en_CA.US-ASCII/LC_COLLATE en_CA.UTF-8/LC_COLLATE en_GB.US-ASCII/LC_COLLATE en_GB.UTF-8/LC_COLLATE en_IE.UTF-8/LC_COLLATE en_NZ.US-ASCII/LC_COLLATE en_NZ.UTF-8/LC_COLLATE en_US.US-ASCII/LC_COLLATE en_US.UTF-8/LC_COLLATE es_ES.UTF-8/LC_COLLATE et_EE.UTF-8/LC_COLLATE eu_ES.UTF-8/LC_COLLATE fi_FI.UTF-8/LC_COLLATE fr_BE.UTF-8/LC_COLLATE fr_CA.UTF-8/LC_COLLATE fr_CH.UTF-8/LC_COLLATE fr_FR.UTF-8/LC_COLLATE he_IL.UTF-8/LC_COLLATE hr_HR.UTF-8/LC_COLLATE hu_HU.UTF-8/LC_COLLATE hy_AM.UTF-8/LC_COLLATE is_IS.UTF-8/LC_COLLATE it_CH.UTF-8/LC_COLLATE it_IT.UTF-8/LC_COLLATE ja_JP.SJIS/LC_COLLATE ja_JP.U TF-8/LC_COLLATE ja_JP.eucJP/LC_COLLATE kk_KZ.UTF-8/LC_COLLATE ko_KR.CP949/LC_COLLATE ko_KR.UTF-8/LC_COLLATE ko_KR.eucKR/LC_COLLATE lt_LT.UTF-8/LC_COLLATE lv_LV.UTF-8/LC_COLLATE mn_MN.UTF-8/LC_COLLATE nb_NO.UTF-8/LC_COLLATE nl_BE.UTF-8/LC_COLLATE nl_NL.UTF-8/LC_COLLATE nn_NO.UTF-8/LC_COLLATE no_NO.UTF-8/LC_COLLATE pl_PL.UTF-8/LC_COLLATE pt_BR.UTF-8/LC_COLLATE pt_PT.UTF-8/LC_COLLATE ro_RO.UTF-8/LC_COLLATE ru_RU.UTF-8/LC_COLLATE sk_SK.UTF-8/LC_COLLATE sl_SI.UTF-8/LC_COLLATE sr_YU.UTF-8/LC_COLLATE sv_SE.UTF-8/LC_COLLATE tr_TR.UTF-8/LC_COLLATE uk_UA.UTF-8/LC_COLLATE zh_CN.GB18030/LC_COLLATE zh_CN.GB2312/LC_COLLATE zh_CN.GBK/LC_COLLATE zh_CN.UTF-8/LC_COLLATE zh_CN.eucCN/LC_COLLATE zh_HK.Big5HKSCS/LC_COLLATE zh_HK.UTF-8/LC_COLLATE zh_TW.UTF-8/LC_COLLATE +CMSLINK_la_LN.ISO8859-15= af_ZA.ISO8859-15 da_DK.ISO8859-15 en_AU.ISO8859-15 en_CA.ISO8859-15 en_GB.ISO8859-15 en_NZ.ISO8859-15 en_US.ISO8859-15 eu_ES.ISO8859-15 fi_FI.ISO8859-15 fr_BE.ISO8859-15 fr_CA.ISO8859-15 fr_CH.ISO8859-15 fr_FR.ISO8859-15 it_CH.ISO8859-15 it_IT.ISO8859-15 nl_BE.ISO8859-15 nl_NL.ISO8859-15 pt_PT.ISO8859-15 +CMSLINK_la_LN.US-ASCII= af_ZA.UTF-8 am_ET.UTF-8 be_BY.UTF-8 bg_BG.UTF-8 ca_AD.UTF-8 ca_ES.UTF-8 ca_FR.UTF-8 ca_IT.UTF-8 cs_CZ.UTF-8 da_DK.UTF-8 de_AT.UTF-8 de_CH.UTF-8 de_DE.UTF-8 el_GR.UTF-8 en_AU.US-ASCII en_AU.UTF-8 en_CA.US-ASCII en_CA.UTF-8 en_GB.US-ASCII en_GB.UTF-8 en_IE.UTF-8 en_NZ.US-ASCII en_NZ.UTF-8 en_US.US-ASCII en_US.UTF-8 es_ES.UTF-8 et_EE.UTF-8 eu_ES.UTF-8 fi_FI.UTF-8 fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 hr_HR.UTF-8 hu_HU.UTF-8 hy_AM.UTF-8 is_IS.UTF-8 it_CH.UTF-8 it_IT.UTF-8 ja_JP.SJIS ja_JP.UTF-8 ja_JP.eucJP kk_KZ.UTF-8 ko_KR.CP949 ko_KR.UTF-8 ko_KR.eucKR lt_LT.UTF-8 lv_LV.UTF-8 mn_MN.UTF-8 nb_NO.UTF-8 nl_BE.UTF-8 nl_NL.UTF-8 nn_NO.UTF-8 no_NO.UTF-8 pl_PL.UTF-8 pt_BR.UTF-8 pt_PT.UTF-8 ro_RO.UTF-8 ru_RU.UTF-8 sk_SK.UTF-8 sl_SI.UTF-8 sr_YU.UTF-8 sv_SE.UTF-8 tr_TR.UTF-8 uk_UA.UTF-8 zh_Hans_CN.GB18030 zh_Hans_CN.GB2312 zh_Hans_CN.GBK zh_Hans_CN.UTF-8 zh_Hans_CN.eucCN zh_Hant_HK.Big5HKSCS zh_Hant_HK.UTF-8 zh_Hant_TW.UTF-8 # For these locales, also create symlinks to the main locale. #CCLNLINK_ccln= ccnln # None! # For these locales, create symlinks to the main locale for historical reasons. -#LEGLINK_ccln= ccln +# The ones for zh_XX are linked to la_LN because there are no +# zh_Hanx_XX CCLN entries. +LEGLINK_sr_Cyrl_RS.ISO8859-5= sr_YU.ISO8859-5 +LEGLINK_sr_Latn_RS= sr_YU +LEGLINK_ja_JP= jp_JP +#EGLINK_zh_Hant_TW= zh_TW +LEGLINK_la_LN.US-ASCII+= zh_TW.UTF-8 +LEGLINK_is_IS.ISO8859-1+= zh_TW.Big5 +#EGLINK_zh_Hant_HK= zh_HK +LEGLINK_la_LN.US-ASCII+= zh_HK.UTF-8 zh_HK.Big5HKSCS +#EGLINK_zh_Hans_CN= zh_CN +LEGLINK_la_LN.US-ASCII+= zh_CN.eucCN zh_CN.UTF-8 zh_CN.GBK zh_CN.GB2312 zh_CN.GB18030 # # In theory there are no parts after here which should be touched when adding @@ -61,7 +71,7 @@ CMSLINK_la_LN.US-ASCII= af_ZA.UTF-8/LC_ # # Required variables -LCTYPE= LC_COLLDEF +LCTYPE= LC_COLLATE LOCALEDIR= /usr/share/locale # For testing only @@ -74,116 +84,5 @@ SHAREGRP= edwin # All variables # -#LOCALES= bg_BG.CP1251 \ -# be_BY.CP1131 \ -# be_BY.CP1251 \ -# be_BY.ISO8859-5 \ -# ca_ES.ISO8859-1 \ -# ca_ES.ISO8859-15 \ -# cs_CZ.ISO8859-2 \ -# de_DE.ISO8859-1 \ -# de_DE.ISO8859-15 \ -# el_GR.ISO8859-7 \ -# es_ES.ISO8859-1 \ -# es_ES.ISO8859-15 \ -# et_EE.ISO8859-15 \ -# hi_IN.ISCII-DEV \ -# hr_HR.ISO8859-2 \ -# hy_AM.ARMSCII-8 \ -# is_IS.ISO8859-1 \ -# is_IS.ISO8859-15 \ -# kk_KZ.PT154 \ -# la_LN.ISO8859-1 \ -# la_LN.ISO8859-15 \ -# la_LN.ISO8859-2 \ -# la_LN.ISO8859-4 \ -# la_LN.US-ASCII \ -# no_NO.ISO8859-1 \ -# no_NO.ISO8859-15 \ -# lt_LT.ISO8859-4 \ -# lt_LT.ISO8859-13 \ -# pl_PL.ISO8859-2 \ -# ru_RU.CP1251 \ -# ru_RU.CP866 \ -# ru_RU.ISO8859-5 \ -# ru_RU.KOI8-R \ -# sl_SI.ISO8859-2 \ -# sr_YU.ISO8859-5 \ -# sv_SE.ISO8859-1 \ -# sv_SE.ISO8859-15 \ -# tr_TR.ISO8859-9 \ -# uk_UA.CP1251 \ -# uk_UA.ISO8859-5 \ -# uk_UA.KOI8-U -# -#LOCALEDIR= /usr/share/locale -# -#.SUFFIXES: .src .out -# -#.src.out: -# colldef -I ${.CURDIR} -o ${.TARGET} ${.IMPSRC} -# -#FILES= ${LOCALES:S/$/.out/} -#FILESNAME= LC_COLLATE -# -#.for locale in ${LOCALES} -#FILESDIR_${locale}.out= ${LOCALEDIR}/${locale} -#.if exists(${.CURDIR}/map.${locale:E}) -#${locale}.out: map.${locale:E} -#.endif -#.endfor -# -#CLEANFILES= ${FILES} -# -#ENCODINGS= Big5 Big5HKSCS CP949 eucCN eucJP eucKR GB18030 GB2312 GBK \ -# ISO8859-1 ISO8859-2 ISO8859-15 SJIS US-ASCII UTF-8 -# -#ISO8859-1_Big5= is_IS:zh_TW -#ISO8859-1_ISO8859-1= ${ISO8859-15_ISO8859-15} pt_PT:pt_BR -# -#LATIN1LINKS= af_ZA da_DK en_AU en_CA en_GB en_NZ en_US eu_ES fi_FI \ -# fr_BE fr_CA fr_CH fr_FR it_CH it_IT nl_BE nl_NL pt_PT -#ISO8859-15_ISO8859-15= \ -# ca_ES:ca_AD ca_ES:ca_FR ca_ES:ca_IT \ -# de_DE:de_AT de_DE:de_CH \ -# no_NO:nb_NO no_NO:nn_NO \ -# ${LATIN1LINKS:C/^/la_LN:/} -# -#LATIN2LINKS= hu_HU ro_RO sr_YU -#ISO8859-2_ISO8859-2= ${LATIN2LINKS:C/^/la_LN:/} cs_CZ:sk_SK -# -#US-ASCII_Big5HKSCS= la_LN:zh_HK -#US-ASCII_CP949= la_LN:ko_KR -#US-ASCII_eucCN= la_LN:zh_CN -#US-ASCII_eucJP= la_LN:ja_JP -#US-ASCII_eucKR= la_LN:ko_KR -#US-ASCII_GB18030= la_LN:zh_CN -#US-ASCII_GB2312= la_LN:zh_CN -#US-ASCII_GBK= la_LN:zh_CN -#US-ASCII_SJIS= la_LN:ja_JP -# -#ASCIILINKS= en_AU en_CA en_GB en_NZ en_US -#US-ASCII_US-ASCII= ${ASCIILINKS:C/^/la_LN:/} -# -#UTF8LINKS= af_ZA am_ET be_BY bg_BG ca_AD ca_ES ca_FR ca_IT cs_CZ \ -# da_DK de_AT de_CH de_DE \ -# el_GR en_AU en_CA en_GB en_IE en_NZ en_US es_ES et_EE eu_ES \ -# fi_FI fr_BE fr_CA fr_CH fr_FR he_IL hr_HR hu_HU hy_AM \ -# is_IS it_CH it_IT ja_JP kk_KZ ko_KR lt_LT mn_MN \ -# nb_NO nl_BE nl_NL nn_NO no_NO pl_PL pt_BR pt_PT \ -# ro_RO ru_RU sk_SK sl_SI sr_YU sv_SE tr_TR uk_UA zh_CN zh_HK \ -# zh_TW -#US-ASCII_UTF-8= ${UTF8LINKS:C/^/la_LN:/} -# -#SYMLINKS= -#.for enc1 in ${ENCODINGS} -#.for enc2 in ${ENCODINGS} -#.for lang_terr in ${${enc1}_${enc2}} -#SYMLINKS+= ../${lang_terr:C/:.*$//}.${enc1}/${FILESNAME} \ -# ${LOCALEDIR}/${lang_terr:C/^.*://}.${enc2} -#.endfor -#.endfor -#.endfor - .include "../Makefile.def.inc" .include Copied: user/edwin/locale/share/colldef/la_LN.ISO8859-13.src (from r196788, head/share/colldef/la_LN.ISO8859-13.src) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/locale/share/colldef/la_LN.ISO8859-13.src Mon Sep 21 07:50:57 2009 (r197382, copy of r196788, head/share/colldef/la_LN.ISO8859-13.src) @@ -0,0 +1,37 @@ +# Latin-7 / Baltic Rim (backward compatible with ASCII) +# +# $FreeBSD$ +# +charmap map.ISO8859-13 +order \ +# controls + ;...;;;...;;\ +# + ;;!;\";<"">;;\ + ;;;;\ + %;&;';\(;\);*;+;<-:>;<*X>;<.M>;\,;<,,>;<``>;<-->;<+->;-;.;<'.>;/;\ +# digits + 0;...;9;\ +# + :;\;;\<;=;>;<<<>;/>>;?;;;;\ +# capital + (A,,,,,);\ + B;(C,,);D;(E,,,,);\ + F;(G,);H;(I,,);Y;\ + J;(K,);(L,,);M;(N,,);(O,,,,,);\ + P;Q;(R,);(S,,);T;\ + (U,,,);\ + V;W;X;(Z,,,);\ +# + [;\\;];^;_;`;\ +# small + (a,,,,,);\ + b;(c,,);d;(e,,,,);\ + f;(g,);h;(i,,);y;\ + j;(k,);(l,,);m;(n,,);(o,,,,,);\ + p;q;(r,);(s,,,);t;\ + (u,,,);\ + v;w;x;(z,,,);\ +# + \{;|;;\};~;;
;;;;;<1S>;<2S>;<3S>;\ + <14>;<12>;<34> Copied: user/edwin/locale/share/colldef/sr_Cyrl_RS.ISO8859-5.src (from r196349, user/edwin/locale/share/colldef/sr_YU.ISO8859-5.src) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/locale/share/colldef/sr_Cyrl_RS.ISO8859-5.src Mon Sep 21 07:50:57 2009 (r197382, copy of r196349, user/edwin/locale/share/colldef/sr_YU.ISO8859-5.src) @@ -0,0 +1,38 @@ +# Serbian part of ISO8859-5 (backward compatible with ASCII) +# +# $FreeBSD$ +# +charmap map.ISO8859-5 +order \ +# controls + ;...;;\ +# + ;;!;\";;;\ + %;&;';\(;\);*;+;\,;-;.;/;\ +# digits + 0;...;9;\ +# + :;\;;\<;=;>;?;;\ +# capital + A;...;Z;\ + ;;;;;;;;;\ + ;;;;;;;;;\ + ;;;;;;;;;\ + ;;;\ +# + [;\\;];^;_;`;\ +# small + a;...;z;\ + ;;;;;;;;;\ + ;;;;;;;;;\ + ;;;;;;;;;\ + ;;;\ +# + \{;\|;\};\~;
;;;;;;;\ + ;;;;;;;;;;\ + ;;;;;;;;;;\ + ;;;;;;;;;;\ + ;;;<-->;;;;<=">;;<%">;\ + ;;;;;<='>;;<%'>;;;\ + ;;;;;;;;;;\ + Modified: user/edwin/locale/share/mfc ============================================================================== --- user/edwin/locale/share/mfc Mon Sep 21 07:38:50 2009 (r197381) +++ user/edwin/locale/share/mfc Mon Sep 21 07:50:57 2009 (r197382) @@ -1,3 +1,12 @@ +MERGED +r196788 | ache | 2009-09-04 02:53:11 +1000 (Fri, 04 Sep 2009) | 2 lines +Changed paths: + M /head/share/colldef/Makefile + A /head/share/colldef/la_LN.ISO8859-13.src (from /head/share/colldef/lt_LT.ISO8859-13.src:196787) + D /head/share/colldef/lt_LT.ISO8859-13.src + +Add lv_LV, move lt_LT to common part + ------------------------------------------------------------------------ MERGED r196814 | ache | 2009-09-04 16:26:40 +1000 (Fri, 04 Sep 2009) | 5 lines From owner-svn-src-user@FreeBSD.ORG Mon Sep 21 23:20:19 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 166F61065697; Mon, 21 Sep 2009 23:20:19 +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 B73BD8FC2B; Mon, 21 Sep 2009 23:20:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8LNKIkR003002; Mon, 21 Sep 2009 23:20:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8LNKIlX002998; Mon, 21 Sep 2009 23:20:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200909212320.n8LNKIlX002998@svn.freebsd.org> From: Kip Macy Date: Mon, 21 Sep 2009 23:20: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: r197396 - in user/kmacy/releng_8_fcs/sys: cddl/contrib/opensolaris/uts/common/fs/zfs 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: Mon, 21 Sep 2009 23:20:19 -0000 Author: kmacy Date: Mon Sep 21 23:20:18 2009 New Revision: 197396 URL: http://svn.freebsd.org/changeset/base/197396 Log: use UMA for buffer allocation Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c user/kmacy/releng_8_fcs/sys/modules/zfs/Makefile Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Sep 21 20:16:10 2009 (r197395) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Sep 21 23:20:18 2009 (r197396) @@ -186,6 +186,11 @@ SYSCTL_QUAD(_vfs_zfs, OID_AUTO, arc_min, SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_disable, CTLFLAG_RDTUN, &zfs_mdcomp_disable, 0, "Disable metadata compression"); +#ifdef ZIO_USE_UMA +extern kmem_cache_t *zio_buf_cache[]; +extern kmem_cache_t *zio_data_buf_cache[]; +#endif + /* * Note that buffers can be in one of 6 states: * ARC_anon - anonymous (discussed below) @@ -1893,8 +1898,6 @@ arc_kmem_reap_now(arc_reclaim_strategy_t size_t i; kmem_cache_t *prev_cache = NULL; kmem_cache_t *prev_data_cache = NULL; - extern kmem_cache_t *zio_buf_cache[]; - extern kmem_cache_t *zio_data_buf_cache[]; #endif #ifdef _KERNEL Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Sep 21 20:16:10 2009 (r197395) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Sep 21 23:20:18 2009 (r197396) @@ -91,13 +91,6 @@ zio_init(void) #ifdef ZIO_USE_UMA size_t c; #endif -#if 0 - vmem_t *data_alloc_arena = NULL; - -#ifdef _KERNEL - data_alloc_arena = zio_alloc_arena; -#endif -#endif zio_cache = kmem_cache_create("zio_cache", sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0); @@ -132,7 +125,7 @@ zio_init(void) (void) sprintf(name, "zio_data_buf_%lu", (ulong_t)size); zio_data_buf_cache[c] = kmem_cache_create(name, size, - align, NULL, NULL, NULL, NULL, data_alloc_arena, + align, NULL, NULL, NULL, NULL, NULL, KMC_NODEBUG); } } @@ -422,7 +415,6 @@ zio_create(zio_t *pio, spa_t *spa, uint6 ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); ASSERT(P2PHASE(size, SPA_MINBLOCKSIZE) == 0); ASSERT(P2PHASE(offset, SPA_MINBLOCKSIZE) == 0); - ASSERT(!vd || spa_config_held(spa, SCL_STATE_ALL, RW_READER)); ASSERT(!bp || !(flags & ZIO_FLAG_CONFIG_WRITER)); ASSERT(vd || stage == ZIO_STAGE_OPEN); Modified: user/kmacy/releng_8_fcs/sys/modules/zfs/Makefile ============================================================================== --- user/kmacy/releng_8_fcs/sys/modules/zfs/Makefile Mon Sep 21 20:16:10 2009 (r197395) +++ user/kmacy/releng_8_fcs/sys/modules/zfs/Makefile Mon Sep 21 23:20:18 2009 (r197396) @@ -63,8 +63,8 @@ ZFS_SRCS= ${ZFS_OBJS:C/.o$/.c/} SRCS+= ${ZFS_SRCS} SRCS+= vdev_geom.c -# Use UMA for ZIO allocation. This is not stable. -#CFLAGS+=-DZIO_USE_UMA +# Use UMA for ZIO allocation. +CFLAGS+=-DZIO_USE_UMA # Use FreeBSD's namecache. CFLAGS+=-DFREEBSD_NAMECACHE From owner-svn-src-user@FreeBSD.ORG Tue Sep 22 03:10: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 1FE251065670; Tue, 22 Sep 2009 03:10:05 +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 0C9928FC12; Tue, 22 Sep 2009 03:10:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8M3A58v007698; Tue, 22 Sep 2009 03:10:05 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8M3A4vX007682; Tue, 22 Sep 2009 03:10:04 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200909220310.n8M3A4vX007682@svn.freebsd.org> From: Kip Macy Date: Tue, 22 Sep 2009 03:10: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: r197398 - in user/kmacy/releng_8_fcs: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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, 22 Sep 2009 03:10:05 -0000 Author: kmacy Date: Tue Sep 22 03:10:04 2009 New Revision: 197398 URL: http://svn.freebsd.org/changeset/base/197398 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 - remove assert that doesn't apply to freebsd - update ztest for new zil_replay Modified: user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/cmd/ztest/ztest.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Sep 22 03:10:04 2009 (r197398) @@ -1304,7 +1304,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); } @@ -3321,8 +3321,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); } Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Sep 22 03:10:04 2009 (r197398) @@ -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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Tue Sep 22 03:10:04 2009 (r197398) @@ -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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Tue Sep 22 03:10:04 2009 (r197398) @@ -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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Tue Sep 22 03:10:04 2009 (r197398) @@ -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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Tue Sep 22 03:10:04 2009 (r197398) @@ -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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue Sep 22 03:10:04 2009 (r197398) @@ -2137,12 +2137,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; @@ -2197,7 +2197,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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Sep 22 03:10:04 2009 (r197398) @@ -564,24 +564,6 @@ zfs_rmnode(znode_t *zp) 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 && @@ -855,9 +837,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); @@ -944,7 +926,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; } @@ -975,7 +957,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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c Tue Sep 22 03:10:04 2009 (r197398) @@ -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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Tue Sep 22 03:10:04 2009 (r197398) @@ -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: * @@ -554,6 +577,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; @@ -583,6 +608,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 @@ -649,6 +676,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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 22 03:10:04 2009 (r197398) @@ -499,6 +499,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 @@ -512,21 +519,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); } @@ -562,7 +575,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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 22 03:10:04 2009 (r197398) @@ -132,12 +132,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; @@ -793,10 +793,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; @@ -906,7 +905,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); } @@ -1397,11 +1396,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; @@ -1610,11 +1608,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; @@ -1812,10 +1810,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; @@ -1942,13 +1940,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; @@ -2843,7 +2841,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)); @@ -2853,7 +2851,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; @@ -3298,7 +3296,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); @@ -3307,7 +3305,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; @@ -3444,10 +3442,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; @@ -3663,10 +3661,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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Sep 22 03:10:04 2009 (r197398) @@ -658,7 +658,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() */ @@ -1196,9 +1196,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; @@ -1318,9 +1318,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; @@ -1397,9 +1397,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; @@ -1505,7 +1505,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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Sep 22 03:10:04 2009 (r197398) @@ -1221,7 +1221,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; @@ -1230,7 +1230,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) { /* @@ -1467,9 +1467,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; @@ -1484,7 +1482,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 */ @@ -1548,44 +1546,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; @@ -1593,36 +1561,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); } @@ -1637,9 +1591,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; @@ -1653,9 +1606,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); @@ -1664,7 +1615,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, @@ -1673,6 +1624,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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Sep 21 23:58:29 2009 (r197397) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Sep 22 03:10:04 2009 (r197398) @@ -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. @@ -294,28 +296,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; } } @@ -353,6 +399,7 @@ zvol_serve_one(zvol_state_t *zv, struct rl_t *rl; int error = 0; boolean_t reading; + boolean_t sync; off = bp->bio_offset; volsize = zv->zv_volsize; @@ -365,12 +412,15 @@ zvol_serve_one(zvol_state_t *zv, struct error = 0; + + reading = (bp->bio_cmd == BIO_READ); + sync = /* !(bp->b_flags & B_ASYNC) && !is_dump && */ !reading && + !(zv->zv_flags & ZVOL_WCE) && !zil_disable; /* * There must be no buffer changes when doing a dmu_sync() because * we can't change the data whilst calculating the checksum. * A better approach than a per zvol rwlock would be to lock ranges. */ - reading = (bp->bio_cmd == BIO_READ); rl = zfs_range_lock(&zv->zv_znode, off, resid, reading ? RL_READER : RL_WRITER); @@ -391,7 +441,7 @@ zvol_serve_one(zvol_state_t *zv, struct *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Sep 22 20:56:39 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 356E91065695; Tue, 22 Sep 2009 20:56:39 +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 24FE58FC1C; Tue, 22 Sep 2009 20:56:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8MKudq9032029; Tue, 22 Sep 2009 20:56:39 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8MKudYw032023; Tue, 22 Sep 2009 20:56:39 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200909222056.n8MKudYw032023@svn.freebsd.org> From: Kip Macy Date: Tue, 22 Sep 2009 20:56:39 +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: r197418 - user/kmacy/releng_8_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: Tue, 22 Sep 2009 20:56:39 -0000 Author: kmacy Date: Tue Sep 22 20:56:38 2009 New Revision: 197418 URL: http://svn.freebsd.org/changeset/base/197418 Log: - add option to link ZFS support in to the kernel for cases where having a single binary is simpler (profiling etc.) Modified: user/kmacy/releng_8_fcs/sys/conf/files user/kmacy/releng_8_fcs/sys/conf/files.amd64 user/kmacy/releng_8_fcs/sys/conf/files.i386 user/kmacy/releng_8_fcs/sys/conf/kern.pre.mk user/kmacy/releng_8_fcs/sys/conf/options Modified: user/kmacy/releng_8_fcs/sys/conf/files ============================================================================== --- user/kmacy/releng_8_fcs/sys/conf/files Tue Sep 22 20:31:32 2009 (r197417) +++ user/kmacy/releng_8_fcs/sys/conf/files Tue Sep 22 20:56:38 2009 (r197418) @@ -2824,3 +2824,237 @@ dev/xen/xenpci/xenpci.c optional xenpci dev/xen/xenpci/evtchn.c optional xenpci dev/xen/xenpci/machine_reboot.c optional xenpci + +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_acl.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_taskq.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/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_8_fcs/sys/conf/files.amd64 ============================================================================== --- user/kmacy/releng_8_fcs/sys/conf/files.amd64 Tue Sep 22 20:31:32 2009 (r197417) +++ user/kmacy/releng_8_fcs/sys/conf/files.amd64 Tue Sep 22 20:56:38 2009 (r197418) @@ -291,3 +291,7 @@ i386/cpufreq/p4tcc.c optional cpufreq # libkern/memmove.c standard 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_8_fcs/sys/conf/files.i386 ============================================================================== --- user/kmacy/releng_8_fcs/sys/conf/files.i386 Tue Sep 22 20:31:32 2009 (r197417) +++ user/kmacy/releng_8_fcs/sys/conf/files.i386 Tue Sep 22 20:56:38 2009 (r197418) @@ -378,3 +378,6 @@ i386/xbox/xbox.c optional xbox i386/xbox/xboxfb.c optional xboxfb dev/fb/boot_font.c optional xboxfb i386/xbox/pic16l.s optional xbox + +cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S optional zfs \ + compile-with "${ZFS_C} ${ZFS_CFLAGS} ${OPENSOLARIS_INC}" Modified: user/kmacy/releng_8_fcs/sys/conf/kern.pre.mk ============================================================================== --- user/kmacy/releng_8_fcs/sys/conf/kern.pre.mk Tue Sep 22 20:31:32 2009 (r197417) +++ user/kmacy/releng_8_fcs/sys/conf/kern.pre.mk Tue Sep 22 20:56:38 2009 (r197418) @@ -53,7 +53,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. @@ -79,8 +116,6 @@ INCLUDES+= -I$S/dev/twa # ... 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 # ... and the same for cxgb INCLUDES+= -I$S/dev/cxgb @@ -89,10 +124,26 @@ INCLUDES+= -I$S/dev/cxgb 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 +.endif + +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" WERROR?= -Werror .endif @@ -121,6 +172,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_8_fcs/sys/conf/options ============================================================================== --- user/kmacy/releng_8_fcs/sys/conf/options Tue Sep 22 20:31:32 2009 (r197417) +++ user/kmacy/releng_8_fcs/sys/conf/options Tue Sep 22 20:56:38 2009 (r197418) @@ -797,6 +797,10 @@ XBOX opt_xbox.h # XFS XFS +# ZFS +OPENSOLARIS +ZFS + # Interrupt filtering INTR_FILTER From owner-svn-src-user@FreeBSD.ORG Wed Sep 23 20:37:00 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 CD83D106566C; Wed, 23 Sep 2009 20:37:00 +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 A275A8FC0C; Wed, 23 Sep 2009 20:37:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8NKb0Ai073918; Wed, 23 Sep 2009 20:37:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8NKb0Zk073916; Wed, 23 Sep 2009 20:37:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200909232037.n8NKb0Zk073916@svn.freebsd.org> From: Kip Macy Date: Wed, 23 Sep 2009 20:37:00 +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: r197443 - user/kmacy/releng_8_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: Wed, 23 Sep 2009 20:37:00 -0000 Author: kmacy Date: Wed Sep 23 20:37:00 2009 New Revision: 197443 URL: http://svn.freebsd.org/changeset/base/197443 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_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Wed Sep 23 20:13:36 2009 (r197442) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Wed Sep 23 20:37:00 2009 (r197443) @@ -49,11 +49,11 @@ uint32_t zfetch_block_cap = 256; uint64_t zfetch_array_rd_sz = 1024 * 1024; SYSCTL_DECL(_vfs_zfs); -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, @@ -338,8 +338,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; @@ -363,8 +365,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; @@ -391,8 +395,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); @@ -408,8 +414,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 Thu Sep 24 00:22: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 C2337106566C; Thu, 24 Sep 2009 00:22:33 +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 B13508FC08; Thu, 24 Sep 2009 00:22:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8O0MX2r078526; Thu, 24 Sep 2009 00:22:33 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8O0MXbB078523; Thu, 24 Sep 2009 00:22:33 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200909240022.n8O0MXbB078523@svn.freebsd.org> From: Kip Macy Date: Thu, 24 Sep 2009 00:22:33 +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: r197446 - in user/kmacy/releng_8_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: Thu, 24 Sep 2009 00:22:33 -0000 Author: kmacy Date: Thu Sep 24 00:22:33 2009 New Revision: 197446 URL: http://svn.freebsd.org/changeset/base/197446 Log: - align the arc state lock and reduce the length of time that it is held - swap data metadata enum order - parallelize locking on ARC states Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Sep 23 21:38:57 2009 (r197445) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Sep 24 00:22:33 2009 (r197446) @@ -223,13 +223,31 @@ extern kmem_cache_t *zio_data_buf_cache[ * second level ARC benefit from these fast lookups. */ +#define ARCS_LOCK_PAD 128 +struct arcs_lock { + kmutex_t arcs_lock; +#ifdef _KERNEL + unsigned char pad[(ARCS_LOCK_PAD - sizeof (kmutex_t))]; +#endif +}; + +/* + * must be power of two for mask use to work + * + */ +#define ARC_BUFC_NUMDATALISTS 16 +#define ARC_BUFC_NUMMETADATALISTS 16 +#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS+ARC_BUFC_NUMDATALISTS) + 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; + list_t arcs_lists[ARC_BUFC_NUMLISTS]; /* list of evictable buffers */ + struct arcs_lock arcs_locks[ARC_BUFC_NUMLISTS] __aligned(128); } arc_state_t; +#define ARCS_LOCK(s, i) &((s)->arcs_locks[(i)].arcs_lock) + /* The 6 states: */ static arc_state_t ARC_anon; static arc_state_t ARC_mru; @@ -958,20 +976,42 @@ arc_buf_freeze(arc_buf_t *buf) } static void +get_buf_info(arc_buf_hdr_t *ab, arc_state_t *state, list_t **list, kmutex_t **lock) +{ + uint64_t buf_hashid = buf_hash(ab->b_spa, &ab->b_dva, ab->b_birth); + + if (ab->b_type == ARC_BUFC_METADATA) + buf_hashid &= (ARC_BUFC_NUMMETADATALISTS-1); + else { + buf_hashid &= (ARC_BUFC_NUMDATALISTS-1); + buf_hashid += ARC_BUFC_NUMMETADATALISTS; + } + + *list = &state->arcs_lists[buf_hashid]; + *lock = ARCS_LOCK(state, buf_hashid); +} + + +static void add_reference(arc_buf_hdr_t *ab, kmutex_t *hash_lock, void *tag) { + ASSERT(MUTEX_HELD(hash_lock)); if ((refcount_add(&ab->b_refcnt, tag) == 1) && (ab->b_state != arc_anon)) { + list_t *list; + kmutex_t *lock; uint64_t delta = ab->b_size * ab->b_datacnt; - list_t *list = &ab->b_state->arcs_list[ab->b_type]; uint64_t *size = &ab->b_state->arcs_lsize[ab->b_type]; - ASSERT(!MUTEX_HELD(&ab->b_state->arcs_mtx)); - mutex_enter(&ab->b_state->arcs_mtx); + get_buf_info(ab, ab->b_state, &list, &lock); + ASSERT(!MUTEX_HELD(lock)); + mutex_enter(lock); ASSERT(list_link_active(&ab->b_arc_node)); list_remove(list, ab); + mutex_exit(lock); + if (GHOST_STATE(ab->b_state)) { ASSERT3U(ab->b_datacnt, ==, 0); ASSERT3P(ab->b_buf, ==, NULL); @@ -980,7 +1020,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; @@ -999,14 +1038,19 @@ remove_reference(arc_buf_hdr_t *ab, kmut if (((cnt = refcount_remove(&ab->b_refcnt, tag)) == 0) && (state != arc_anon)) { uint64_t *size = &state->arcs_lsize[ab->b_type]; + list_t *list; + kmutex_t *lock; - ASSERT(!MUTEX_HELD(&state->arcs_mtx)); - mutex_enter(&state->arcs_mtx); + get_buf_info(ab, state, &list, &lock); + + ASSERT(!MUTEX_HELD(lock)); + mutex_enter(lock); ASSERT(!list_link_active(&ab->b_arc_node)); - list_insert_head(&state->arcs_list[ab->b_type], ab); + list_insert_head(list, ab); + mutex_exit(lock); + ASSERT(ab->b_datacnt > 0); atomic_add_64(size, ab->b_size * ab->b_datacnt); - mutex_exit(&state->arcs_mtx); } return (cnt); } @@ -1021,6 +1065,8 @@ arc_change_state(arc_state_t *new_state, arc_state_t *old_state = ab->b_state; int64_t refcnt = refcount_count(&ab->b_refcnt); uint64_t from_delta, to_delta; + list_t *list; + kmutex_t *lock; ASSERT(MUTEX_HELD(hash_lock)); ASSERT(new_state != old_state); @@ -1035,14 +1081,17 @@ arc_change_state(arc_state_t *new_state, */ if (refcnt == 0) { if (old_state != arc_anon) { - int use_mutex = !MUTEX_HELD(&old_state->arcs_mtx); + int use_mutex; uint64_t *size = &old_state->arcs_lsize[ab->b_type]; + get_buf_info(ab, old_state, &list, &lock); + use_mutex = !MUTEX_HELD(lock); + if (use_mutex) - mutex_enter(&old_state->arcs_mtx); + mutex_enter(lock); ASSERT(list_link_active(&ab->b_arc_node)); - list_remove(&old_state->arcs_list[ab->b_type], ab); + list_remove(list, ab); /* * If prefetching out of the ghost cache, @@ -1057,16 +1106,20 @@ arc_change_state(arc_state_t *new_state, atomic_add_64(size, -from_delta); if (use_mutex) - mutex_exit(&old_state->arcs_mtx); + mutex_exit(lock); } if (new_state != arc_anon) { - int use_mutex = !MUTEX_HELD(&new_state->arcs_mtx); + int use_mutex; uint64_t *size = &new_state->arcs_lsize[ab->b_type]; + get_buf_info(ab, new_state, &list, &lock); + use_mutex = !MUTEX_HELD(lock); + + if (use_mutex) - mutex_enter(&new_state->arcs_mtx); + mutex_enter(lock); - list_insert_head(&new_state->arcs_list[ab->b_type], ab); + list_insert_head(list, ab); /* ghost elements have a ghost size */ if (GHOST_STATE(new_state)) { @@ -1077,7 +1130,7 @@ arc_change_state(arc_state_t *new_state, atomic_add_64(size, to_delta); if (use_mutex) - mutex_exit(&new_state->arcs_mtx); + mutex_exit(lock); } } @@ -1468,17 +1521,42 @@ arc_evict(arc_state_t *state, spa_t *spa arc_state_t *evicted_state; uint64_t bytes_evicted = 0, skipped = 0, missed = 0; arc_buf_hdr_t *ab, *ab_prev = NULL; - list_t *list = &state->arcs_list[type]; + list_t *evicted_list, *list, *evicted_list_start, *list_start; + kmutex_t *lock, *evicted_lock; kmutex_t *hash_lock; boolean_t have_lock; void *stolen = NULL; + static int evict_metadata_offset, evict_data_offset; + int idx, offset, list_count, count; ASSERT(state == arc_mru || state == arc_mfu); evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; + + if (type == ARC_BUFC_METADATA) { + offset = 0; + list_count = ARC_BUFC_NUMMETADATALISTS; + list_start = &state->arcs_lists[0]; + evicted_list_start = &evicted_state->arcs_lists[0]; + idx = evict_metadata_offset; + } else { + offset = ARC_BUFC_NUMMETADATALISTS; - mutex_enter(&state->arcs_mtx); - mutex_enter(&evicted_state->arcs_mtx); + list_start = &state->arcs_lists[offset]; + evicted_list_start = &evicted_state->arcs_lists[offset]; + list_count = ARC_BUFC_NUMDATALISTS; + idx = evict_data_offset; + } + count = 0; + +evict_start: + list = &list_start[idx]; + evicted_list = &evicted_list_start[idx]; + lock = ARCS_LOCK(state, (offset + idx)); + evicted_lock = ARCS_LOCK(evicted_state, (offset + idx)); + + mutex_enter(lock); + mutex_enter(evicted_lock); for (ab = list_tail(list); ab; ab = ab_prev) { ab_prev = list_prev(list, ab); @@ -1546,13 +1624,24 @@ arc_evict(arc_state_t *state, spa_t *spa } } - mutex_exit(&evicted_state->arcs_mtx); - mutex_exit(&state->arcs_mtx); - - if (bytes_evicted < bytes) - dprintf("only evicted %lld bytes from %x", - (longlong_t)bytes_evicted, state); + mutex_exit(evicted_lock); + mutex_exit(lock); + + idx = ((idx + 1)&(list_count-1)); + count++; + if (bytes_evicted < bytes) { + if (count < list_count) + goto evict_start; + else + dprintf("only evicted %lld bytes from %x", + (longlong_t)bytes_evicted, state); + } + if (type == ARC_BUFC_METADATA) + evict_metadata_offset = idx; + else + evict_data_offset = idx; + if (skipped) ARCSTAT_INCR(arcstat_evict_skip, skipped); @@ -1591,14 +1680,28 @@ static void arc_evict_ghost(arc_state_t *state, spa_t *spa, int64_t bytes) { arc_buf_hdr_t *ab, *ab_prev; - list_t *list = &state->arcs_list[ARC_BUFC_DATA]; - kmutex_t *hash_lock; + list_t *list, *list_start; + kmutex_t *hash_lock, *lock; uint64_t bytes_deleted = 0; uint64_t bufs_skipped = 0; + static int evict_offset; + int list_count, idx = evict_offset; + int offset, count = 0; ASSERT(GHOST_STATE(state)); -top: - mutex_enter(&state->arcs_mtx); + + /* + * data lists come after metadata lists + */ + list_start = &state->arcs_lists[ARC_BUFC_NUMMETADATALISTS]; + list_count = ARC_BUFC_NUMDATALISTS; + offset = ARC_BUFC_NUMMETADATALISTS; + +evict_start: + list = &list_start[idx]; + lock = ARCS_LOCK(state, idx + offset); + + mutex_enter(lock); for (ab = list_tail(list); ab; ab = ab_prev) { ab_prev = list_prev(list, ab); if (spa && ab->b_spa != spa) @@ -1628,20 +1731,31 @@ top: break; } else { if (bytes < 0) { - mutex_exit(&state->arcs_mtx); + /* + * we're draining the ARC, retry + */ + mutex_exit(lock); mutex_enter(hash_lock); mutex_exit(hash_lock); - goto top; + goto evict_start; } bufs_skipped += 1; } } - mutex_exit(&state->arcs_mtx); - - if (list == &state->arcs_list[ARC_BUFC_DATA] && + mutex_exit(lock); + idx = ((idx + 1)&(ARC_BUFC_NUMDATALISTS-1)); + count++; + + if (count < list_count) + goto evict_start; + + evict_offset = idx; + if ((uintptr_t)list > (uintptr_t)&state->arcs_lists[ARC_BUFC_NUMMETADATALISTS] && (bytes < 0 || bytes_deleted < bytes)) { - list = &state->arcs_list[ARC_BUFC_METADATA]; - goto top; + list_start = &state->arcs_lists[0]; + list_count = ARC_BUFC_NUMMETADATALISTS; + offset = count = 0; + goto evict_start; } if (bufs_skipped) { @@ -1755,22 +1869,22 @@ restart: void arc_flush(spa_t *spa) { - while (list_head(&arc_mru->arcs_list[ARC_BUFC_DATA])) { + while (arc_mru->arcs_lsize[ARC_BUFC_DATA]) { (void) arc_evict(arc_mru, spa, -1, FALSE, ARC_BUFC_DATA); if (spa) break; } - while (list_head(&arc_mru->arcs_list[ARC_BUFC_METADATA])) { + while (arc_mru->arcs_lsize[ARC_BUFC_METADATA]) { (void) arc_evict(arc_mru, spa, -1, FALSE, ARC_BUFC_METADATA); if (spa) break; } - while (list_head(&arc_mfu->arcs_list[ARC_BUFC_DATA])) { + while (arc_mfu->arcs_lsize[ARC_BUFC_DATA]) { (void) arc_evict(arc_mfu, spa, -1, FALSE, ARC_BUFC_DATA); if (spa) break; } - while (list_head(&arc_mfu->arcs_list[ARC_BUFC_METADATA])) { + while (arc_mfu->arcs_lsize[ARC_BUFC_METADATA]) { (void) arc_evict(arc_mfu, spa, -1, FALSE, ARC_BUFC_METADATA); if (spa) break; @@ -2823,7 +2937,9 @@ arc_buf_evict(arc_buf_t *buf) arc_buf_hdr_t *hdr; kmutex_t *hash_lock; arc_buf_t **bufp; - + list_t *list, *evicted_list; + kmutex_t *lock, *evicted_lock; + rw_enter(&buf->b_lock, RW_WRITER); hdr = buf->b_hdr; if (hdr == NULL) { @@ -2871,16 +2987,18 @@ arc_buf_evict(arc_buf_t *buf) evicted_state = (old_state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; - mutex_enter(&old_state->arcs_mtx); - mutex_enter(&evicted_state->arcs_mtx); + get_buf_info(hdr, old_state, &list, &lock); + get_buf_info(hdr, evicted_state, &evicted_list, &evicted_lock); + mutex_enter(lock); + mutex_enter(evicted_lock); arc_change_state(evicted_state, hdr, hash_lock); ASSERT(HDR_IN_HASH_TABLE(hdr)); hdr->b_flags |= ARC_IN_HASH_TABLE; hdr->b_flags &= ~ARC_BUF_AVAILABLE; - mutex_exit(&evicted_state->arcs_mtx); - mutex_exit(&old_state->arcs_mtx); + mutex_exit(evicted_lock); + mutex_exit(lock); } mutex_exit(hash_lock); rw_exit(&buf->b_lock); @@ -3426,7 +3544,8 @@ void arc_init(void) { int prefetch_tunable_set = 0; - + int i; + mutex_init(&arc_reclaim_thr_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&arc_reclaim_thr_cv, NULL, CV_DEFAULT, NULL); mutex_init(&arc_lowmem_lock, NULL, MUTEX_DEFAULT, NULL); @@ -3494,33 +3613,34 @@ arc_init(void) arc_l2c_only = &ARC_l2c_only; arc_size = 0; - mutex_init(&arc_anon->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mru->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mru_ghost->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mfu->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mfu_ghost->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_l2c_only->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); - - list_create(&arc_mru->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mru->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mfu->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mfu->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); - list_create(&arc_l2c_only->arcs_list[ARC_BUFC_DATA], - sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + for (i = 0; i < ARC_BUFC_NUMLISTS; i++) { + + mutex_init(&arc_anon->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mru->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mru_ghost->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mfu->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mfu_ghost->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_l2c_only->arcs_locks[i].arcs_lock, + NULL, MUTEX_DEFAULT, NULL); + + list_create(&arc_mru->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_mru_ghost->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_mfu->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_mfu_ghost->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_mfu_ghost->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + list_create(&arc_l2c_only->arcs_lists[i], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); + } buf_init(); @@ -3590,7 +3710,8 @@ arc_init(void) void arc_fini(void) { - + int i; + mutex_enter(&arc_reclaim_thr_lock); arc_thread_exit = 1; cv_signal(&arc_reclaim_thr_cv); @@ -3611,21 +3732,19 @@ arc_fini(void) mutex_destroy(&arc_reclaim_thr_lock); cv_destroy(&arc_reclaim_thr_cv); - list_destroy(&arc_mru->arcs_list[ARC_BUFC_METADATA]); - list_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); - list_destroy(&arc_mfu->arcs_list[ARC_BUFC_METADATA]); - list_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]); - list_destroy(&arc_mru->arcs_list[ARC_BUFC_DATA]); - list_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA]); - list_destroy(&arc_mfu->arcs_list[ARC_BUFC_DATA]); - list_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]); - - mutex_destroy(&arc_anon->arcs_mtx); - mutex_destroy(&arc_mru->arcs_mtx); - mutex_destroy(&arc_mru_ghost->arcs_mtx); - mutex_destroy(&arc_mfu->arcs_mtx); - mutex_destroy(&arc_mfu_ghost->arcs_mtx); - + for (i = 0; i < ARC_BUFC_NUMLISTS; i++) { + list_destroy(&arc_mru->arcs_lists[i]); + list_destroy(&arc_mru_ghost->arcs_lists[i]); + list_destroy(&arc_mfu->arcs_lists[i]); + list_destroy(&arc_mfu_ghost->arcs_lists[i]); + + mutex_destroy(&arc_anon->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_mru->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_mru_ghost->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_mfu->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_mfu_ghost->arcs_locks[i].arcs_lock); + } + mutex_destroy(&zfs_write_limit_lock); buf_fini(); @@ -4020,26 +4139,26 @@ static list_t * l2arc_list_locked(int list_num, kmutex_t **lock) { list_t *list; + int idx; + + ASSERT(list_num >= 0 && list_num <= 2*ARC_BUFC_NUMLISTS); - ASSERT(list_num >= 0 && list_num <= 3); - - switch (list_num) { - case 0: - list = &arc_mfu->arcs_list[ARC_BUFC_METADATA]; - *lock = &arc_mfu->arcs_mtx; - break; - case 1: - list = &arc_mru->arcs_list[ARC_BUFC_METADATA]; - *lock = &arc_mru->arcs_mtx; - break; - case 2: - list = &arc_mfu->arcs_list[ARC_BUFC_DATA]; - *lock = &arc_mfu->arcs_mtx; - break; - case 3: - list = &arc_mru->arcs_list[ARC_BUFC_DATA]; - *lock = &arc_mru->arcs_mtx; - break; + if (list_num < ARC_BUFC_NUMMETADATALISTS) { + list = &arc_mfu->arcs_lists[list_num]; + *lock = ARCS_LOCK(arc_mfu, list_num); + } else if (list_num < ARC_BUFC_NUMMETADATALISTS*2) { + idx = list_num - ARC_BUFC_NUMMETADATALISTS; + list = &arc_mru->arcs_lists[idx]; + *lock = ARCS_LOCK(arc_mru, idx); + } else if (list_num < (ARC_BUFC_NUMMETADATALISTS*2 + + ARC_BUFC_NUMDATALISTS)) { + idx = list_num - ARC_BUFC_NUMLISTS; + list = &arc_mfu->arcs_lists[idx]; + *lock = ARCS_LOCK(arc_mfu, idx); + } else { + idx = list_num - ARC_BUFC_NUMLISTS - ARC_BUFC_NUMMETADATALISTS; + list = &arc_mru->arcs_lists[idx]; + *lock = ARCS_LOCK(arc_mru, idx); } ASSERT(!(MUTEX_HELD(*lock))); @@ -4210,7 +4329,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * Copy buffers for L2ARC writing. */ mutex_enter(&l2arc_buflist_mtx); - for (try = 0; try <= 3; try++) { + for (try = 0; try <= 2*ARC_BUFC_NUMLISTS; try++) { list = l2arc_list_locked(try, &list_lock); passed_sz = 0; Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Wed Sep 23 21:38:57 2009 (r197445) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Thu Sep 24 00:22:33 2009 (r197446) @@ -55,8 +55,8 @@ struct arc_buf { }; typedef enum arc_buf_contents { - ARC_BUFC_DATA, /* buffer contains data */ ARC_BUFC_METADATA, /* buffer contains metadata */ + ARC_BUFC_DATA, /* buffer contains data */ ARC_BUFC_NUMTYPES } arc_buf_contents_t; /* From owner-svn-src-user@FreeBSD.ORG Sat Sep 26 20:43:00 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 E3D53106566C; Sat, 26 Sep 2009 20:43:00 +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 B9FA88FC1E; Sat, 26 Sep 2009 20:43:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8QKh0U0070552; Sat, 26 Sep 2009 20:43:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8QKh04O070550; Sat, 26 Sep 2009 20:43:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200909262043.n8QKh04O070550@svn.freebsd.org> From: Kip Macy Date: Sat, 26 Sep 2009 20:43:00 +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: r197530 - user/kmacy/releng_8_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, 26 Sep 2009 20:43:01 -0000 Author: kmacy Date: Sat Sep 26 20:43:00 2009 New Revision: 197530 URL: http://svn.freebsd.org/changeset/base/197530 Log: - rather than evicting from one list and skewing the weighting, evict one buffer from each list until we've examined all buffers or we've hit the eviction target - never evict if we're below arc_min - always evict if we'r above arc_max Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 26 20:07:48 2009 (r197529) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 26 20:43:00 2009 (r197530) @@ -1520,6 +1520,7 @@ arc_evict(arc_state_t *state, spa_t *spa { arc_state_t *evicted_state; uint64_t bytes_evicted = 0, skipped = 0, missed = 0; + int64_t bytes_remaining; arc_buf_hdr_t *ab, *ab_prev = NULL; list_t *evicted_list, *list, *evicted_list_start, *list_start; kmutex_t *lock, *evicted_lock; @@ -1533,6 +1534,7 @@ arc_evict(arc_state_t *state, spa_t *spa evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; + bytes_remaining = evicted_state->arcs_lsize[ab->b_type]; if (type == ARC_BUFC_METADATA) { offset = 0; list_count = ARC_BUFC_NUMMETADATALISTS; @@ -1560,6 +1562,7 @@ evict_start: for (ab = list_tail(list); ab; ab = ab_prev) { ab_prev = list_prev(list, ab); + bytes_remaining -= (ab->b_size * ab->b_datacnt); /* prefetch buffers have a minimum lifespan */ if (HDR_IO_IN_PROGRESS(ab) || (spa && ab->b_spa != spa) || @@ -1619,6 +1622,13 @@ evict_start: mutex_exit(hash_lock); if (bytes >= 0 && bytes_evicted >= bytes) break; + if (bytes_remaining > 0) { + mutex_exit(evicted_lock); + mutex_exit(lock); + idx = ((idx + 1)&(list_count-1)); + count++; + goto evict_start; + } } else { missed += 1; } @@ -1940,6 +1950,12 @@ arc_reclaim_needed(void) #endif #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 or we're within 2048 pages @@ -1948,9 +1964,6 @@ arc_reclaim_needed(void) if (vm_pages_needed || (vm_paging_target() > -2048)) return (1); - if (needfree) - return (1); - #if 0 /* * take 'desfree' extra pages, so we reclaim sooner, rather than later