From owner-svn-src-head@freebsd.org Sat Oct 14 05:12:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD92AE3CFC1; Sat, 14 Oct 2017 05:12:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x235.google.com (mail-pf0-x235.google.com [IPv6:2607:f8b0:400e:c00::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 974C163606; Sat, 14 Oct 2017 05:12:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x235.google.com with SMTP id 17so11882084pfn.12; Fri, 13 Oct 2017 22:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=Q5LUKRAsgEXzTrvcau/RxZ79hMFdORYi51iujfOn+/c=; b=fCAqTR508n3I46XKmAFjK2qkyL1bNmtmPedciP0TunbW8tGOZK876x7mQiiHfQ6Ysv KRGbMcmQy94Eiwg+hd9f6o5vdjBYv1A+m9veBUlIWJnujrQSAEa8ppzqU9HCy6Oo+1vD dudvGU35Zfqf80V/otEhi4hU7grn6rLHZw11FXXWa2eBpVedC5fXpkM7ClvUilxv4mY4 cH/vG5afjERSiH/axuQ81SFTldN4j616xeNQY+RXg7sCfx3LlUjIJm1JD0ihxWKC7U3w XMETPDL9HKHXmuogo94Lw1OFQYsKrKn0evBytGhKScvT00vL5IGJUXzT/trEyeAjBw8u xvCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=Q5LUKRAsgEXzTrvcau/RxZ79hMFdORYi51iujfOn+/c=; b=ABZASdWTw3MAz4bN8S8aNw/Vvw91oOiCUKncUKAc0T/A81m/DyNhPBiVAH54SuYDUp kXN34gLfF5ZUPA5SpYWLUCJXebCs7lJjBGpgjB8PE/zB0IltEnt9SELT9LuRkEDzPa6C HqQqAlzteAb6x9RqOWKYNsdiYKude2D28WL9mw03TCwCeOuv8JcZPi+CdLrWQSf1q4RO dfiwLO59Ke6rh2eZYT52fa3UJ/Q/EzN50DkNjPR6y9vWHs3ziHMSc2z6MDtnnHNW2cM9 hqoF9/qELfghcNtf9DNZvVTsseceXm17tckE7xuQ+QCW0KAJ8NxqTReEJ4JNVpPWIsUP TGzA== X-Gm-Message-State: AMCzsaWnITeDGrpjE+Tt6tSXR/Zjk5eDoCY8UH5Sc4qDHl3eWGMS2I8x xTdvdY5FF6ZC6BtYIEL7nqzPPmXt X-Google-Smtp-Source: AOwi7QB72wThSF6iJ9GnnBcz9W1l6ApIKkvt3KeKWiy/vR451win+wb0q45AVx3jSHwDwS6ZBAKiSQ== X-Received: by 10.99.172.83 with SMTP id z19mr3111462pgn.46.1507957937666; Fri, 13 Oct 2017 22:12:17 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id o128sm4730490pfg.118.2017.10.13.22.12.16 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Oct 2017 22:12:16 -0700 (PDT) Subject: Re: svn commit: r324541 - in head: share/man/man9 sys/kern sys/sys Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_C4B17B83-4374-47E5-8CC4-F3496C26AE87"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201710112153.v9BLroeR007323@repo.freebsd.org> Date: Fri, 13 Oct 2017 22:12:22 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <365AD758-5761-4BD4-A80E-8EF2EA84EAAA@gmail.com> References: <201710112153.v9BLroeR007323@repo.freebsd.org> To: Matt Joras X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Oct 2017 05:12:18 -0000 --Apple-Mail=_C4B17B83-4374-47E5-8CC4-F3496C26AE87 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Oct 11, 2017, at 14:53, Matt Joras wrote: >=20 > Author: mjoras > Date: Wed Oct 11 21:53:50 2017 > New Revision: 324541 > URL: https://svnweb.freebsd.org/changeset/base/324541 >=20 > Log: > Add clearing function for unr(9). >=20 > Previously before you could call unrhdr_delete you needed to > individually free every allocated unit. It is useful to be able to = tear > down the unr without having to go through this process, as it is > significantly faster than freeing the individual units. >=20 > Reviewed by: cem, lidl > Approved by: rstone (mentor) > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D12591 >=20 > Modified: > head/share/man/man9/Makefile > head/share/man/man9/unr.9 > head/sys/kern/subr_unit.c > head/sys/sys/systm.h >=20 > Modified: head/share/man/man9/Makefile > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/share/man/man9/Makefile Wed Oct 11 20:36:22 2017 = (r324540) > +++ head/share/man/man9/Makefile Wed Oct 11 21:53:50 2017 = (r324541) > @@ -414,6 +414,7 @@ MAN=3D accept_filter.9 \ > MLINKS=3D unr.9 alloc_unr.9 \ > unr.9 alloc_unrl.9 \ > unr.9 alloc_unr_specific.9 \ > + unr.9 clear_unrhdr.9 \ > unr.9 delete_unrhdr.9 \ > unr.9 free_unr.9 \ > unr.9 new_unrhdr.9 >=20 > Modified: head/share/man/man9/unr.9 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/share/man/man9/unr.9 Wed Oct 11 20:36:22 2017 = (r324540) > +++ head/share/man/man9/unr.9 Wed Oct 11 21:53:50 2017 = (r324541) > @@ -24,11 +24,12 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 5, 2010 > +.Dd October 4, 2017 > .Dt UNR 9 > .Os > .Sh NAME > .Nm new_unrhdr , > +.Nm clear_unrhdr , > .Nm delete_unrhdr , > .Nm alloc_unr , > .Nm alloc_unr_specific , > @@ -39,6 +40,8 @@ > .Ft "struct unrhdr *" > .Fn new_unrhdr "int low" "int high" "struct mtx *mutex" > .Ft void > +.Fn clear_unrhdr "struct unrhdr *uh" > +.Ft void > .Fn delete_unrhdr "struct unrhdr *uh" > .Ft int > .Fn alloc_unr "struct unrhdr *uh" > @@ -70,8 +73,16 @@ is not > .Dv NULL , > it is used for locking when allocating and freeing units. > Otherwise, internal mutex is used. > +.It Fn clear_unrhdr uh > +Clear all units from the specified unit number allocator entity. > +This function resets the entity as if it were just initialized with > +.Fn new_unrhdr . > .It Fn delete_unrhdr uh > -Destroy specified unit number allocator entity. > +Delete specified unit number allocator entity. > +This function frees the memory associated with the entity, it does = not free > +any units. > +To free all units use > +.Fn clear_unrhdr . > .It Fn alloc_unr uh > Return a new unit number. > The lowest free number is always allocated. >=20 > Modified: head/sys/kern/subr_unit.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/subr_unit.c Wed Oct 11 20:36:22 2017 = (r324540) > +++ head/sys/kern/subr_unit.c Wed Oct 11 21:53:50 2017 = (r324541) > @@ -366,6 +366,27 @@ delete_unrhdr(struct unrhdr *uh) > Free(uh); > } >=20 > +void > +clear_unrhdr(struct unrhdr *uh) > +{ > + struct unr *up, *uq; > + > + KASSERT(TAILQ_EMPTY(&uh->ppfree), > + ("unrhdr has postponed item for free")); > + up =3D TAILQ_FIRST(&uh->head); > + while (up !=3D NULL) { Could this be done with TAILQ_FOREACH_SAFE? -Ngie --Apple-Mail=_C4B17B83-4374-47E5-8CC4-F3496C26AE87 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZ4Zy3AAoJEPWDqSZpMIYVK7gQAL21exfm7Dzwiv+5DPPjurWW H7YkznsfYSDNIEuSx7TJJuQ4iawtShKYh8+fyGeKSDwclwqqVaKZqeqOUqUOCYch xt4U7cA7MJbSru6l8pn8Vc3B78dEWLZw/1PrAhbhjI7nT8fWMiNJeP9Bs26Px4QE 91YYHHoopqKh/gRI3tstPFmqCTzKgBbUgvS3BsPHC/M6tlgR+AWoZw6AK2O2FuMt EU6nxbBk5Lw2WLY2Daf7I+GA19bS2homXGQO5yHO3UTtyI6NgjXoEGUgKwnJATmT ibQVRNh38gGWC+ov808VkL9KHLqzgZvc1+aXG645DdylTN3pZM4lSGw2KY8FaF0p D8AZRq8bMQS8h2GBHQXDKYX1FITkd9IbqU8P+RPVAQoOn9RW7neTc/Kja+UCP8I/ P/lIhjPqFlsH+dHKMIevU9GbCSLHKPzNnxs4uG1Rjk/doqClnHCwvl+Of1Um7KoP +gJpSiWji1Yk/TH/DD9rZ9ZWIxE8ussgLiUWMHen09y5e/doLfz7jpB4pXwbeoQ1 m88B6KJB1xTkmKnH6KUauWOe7ALxqomPwMu8BJLuqCjIo6LSgWcs6oc41qiZa1wb iByiSw6u6RCo/Rhzhzlvud3vpIA8SfcaYi7jhz1IMal2zzj2PfhFK863ARCST2nl dCfFjNoP0fNp6sScEg0v =poKv -----END PGP SIGNATURE----- --Apple-Mail=_C4B17B83-4374-47E5-8CC4-F3496C26AE87--