From owner-svn-src-stable@freebsd.org Sun Oct 18 18:37:53 2015 Return-Path: Delivered-To: svn-src-stable@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 579B29D1F8C; Sun, 18 Oct 2015 18:37:53 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C6A0512A1; Sun, 18 Oct 2015 18:37:52 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t9IIbpxn082550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Oct 2015 11:37:51 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t9IIbpKm082549; Sun, 18 Oct 2015 11:37:51 -0700 (PDT) (envelope-from jmg) Date: Sun, 18 Oct 2015 11:37:51 -0700 From: John-Mark Gurney To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r289516 - in stable/10: sbin/mdconfig sys/dev/md sys/sys Message-ID: <20151018183751.GB65715@funkthat.com> References: <201510181452.t9IEqVh9099329@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201510181452.t9IEqVh9099329@repo.freebsd.org> X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Sun, 18 Oct 2015 11:37:51 -0700 (PDT) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Oct 2015 18:37:53 -0000 Edward Tomasz Napierala wrote this message on Sun, Oct 18, 2015 at 14:52 +0000: > Author: trasz > Date: Sun Oct 18 14:52:31 2015 > New Revision: 289516 > URL: https://svnweb.freebsd.org/changeset/base/289516 > > Log: > MFC r258909: The following description doesn't match what r258909 says: https://svnweb.freebsd.org/base?view=revision&revision=r258909 wrong commit or wrong message? > Tweak mdconfig(8) manual page, in particular revise the EXAMPLES > section. This removes stuff that doesn't really belong there, > and simplifies examples for the basic operations. > > Sponsored by: The FreeBSD Foundation > > Modified: > stable/10/sbin/mdconfig/mdconfig.8 > stable/10/sbin/mdconfig/mdconfig.c > stable/10/sys/dev/md/md.c > stable/10/sys/sys/mdioctl.h > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sbin/mdconfig/mdconfig.8 > ============================================================================== > --- stable/10/sbin/mdconfig/mdconfig.8 Sun Oct 18 14:47:19 2015 (r289515) > +++ stable/10/sbin/mdconfig/mdconfig.8 Sun Oct 18 14:52:31 2015 (r289516) > @@ -41,7 +41,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd October 26, 2013 > +.Dd November 30, 2013 > .Dt MDCONFIG 8 > .Os > .Sh NAME > @@ -122,6 +122,8 @@ Using > backing is generally preferred instead of using > .Cm malloc > backing. > +.It Cm null > +Bitsink; all writes do nothing, all reads return zeroes. > .El > .It Fl f Ar file > Filename to use for the vnode type memory disk. > > Modified: stable/10/sbin/mdconfig/mdconfig.c > ============================================================================== > --- stable/10/sbin/mdconfig/mdconfig.c Sun Oct 18 14:47:19 2015 (r289515) > +++ stable/10/sbin/mdconfig/mdconfig.c Sun Oct 18 14:52:31 2015 (r289516) > @@ -155,6 +155,9 @@ main(int argc, char **argv) > } else if (!strcmp(optarg, "swap")) { > mdio.md_type = MD_SWAP; > mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; > + } else if (!strcmp(optarg, "null")) { > + mdio.md_type = MD_NULL; > + mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; > } else > errx(1, "unknown type: %s", optarg); > break; > @@ -287,9 +290,10 @@ main(int argc, char **argv) > } > } > > - if ((mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP) && > - sflag == NULL) > - errx(1, "must specify -s for -t malloc or -t swap"); > + if ((mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP || > + mdio.md_type == MD_NULL) && sflag == NULL) > + errx(1, "must specify -s for -t malloc, -t swap, " > + "or -t null"); > if (mdio.md_type == MD_VNODE && mdio.md_file[0] == '\0') > errx(1, "must specify -f for -t vnode"); > } else { > > Modified: stable/10/sys/dev/md/md.c > ============================================================================== > --- stable/10/sys/dev/md/md.c Sun Oct 18 14:47:19 2015 (r289515) > +++ stable/10/sys/dev/md/md.c Sun Oct 18 14:52:31 2015 (r289516) > @@ -911,6 +911,22 @@ mdstart_swap(struct md_s *sc, struct bio > return (rv != VM_PAGER_ERROR ? 0 : ENOSPC); > } > > +static int > +mdstart_null(struct md_s *sc, struct bio *bp) > +{ > + > + switch (bp->bio_cmd) { > + case BIO_READ: > + bzero(bp->bio_data, bp->bio_length); > + cpu_flush_dcache(bp->bio_data, bp->bio_length); > + break; > + case BIO_WRITE: > + break; > + } > + bp->bio_resid = 0; > + return (0); > +} > + > static void > md_kthread(void *arg) > { > @@ -1030,6 +1046,7 @@ mdinit(struct md_s *sc) > pp->flags |= G_PF_ACCEPT_UNMAPPED; > break; > case MD_PRELOAD: > + case MD_NULL: > break; > } > sc->gp = gp; > @@ -1248,6 +1265,7 @@ mdresize(struct md_s *sc, struct md_ioct > > switch (sc->type) { > case MD_VNODE: > + case MD_NULL: > break; > case MD_SWAP: > if (mdio->md_mediasize <= 0 || > @@ -1342,6 +1360,19 @@ mdcreate_swap(struct md_s *sc, struct md > return (error); > } > > +static int > +mdcreate_null(struct md_s *sc, struct md_ioctl *mdio, struct thread *td) > +{ > + > + /* > + * Range check. Disallow negative sizes or any size less then the > + * size of a page. Then round to a page. > + */ > + if (sc->mediasize <= 0 || (sc->mediasize % PAGE_SIZE) != 0) > + return (EDOM); > + > + return (0); > +} > > static int > xmdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) > @@ -1374,6 +1405,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd > case MD_PRELOAD: > case MD_VNODE: > case MD_SWAP: > + case MD_NULL: > break; > default: > return (EINVAL); > @@ -1419,6 +1451,10 @@ xmdctlioctl(struct cdev *dev, u_long cmd > sc->start = mdstart_swap; > error = mdcreate_swap(sc, mdio, td); > break; > + case MD_NULL: > + sc->start = mdstart_null; > + error = mdcreate_null(sc, mdio, td); > + break; > } > if (error != 0) { > mddestroy(sc, td); > @@ -1589,6 +1625,9 @@ g_md_dumpconf(struct sbuf *sb, const cha > case MD_SWAP: > type = "swap"; > break; > + case MD_NULL: > + type = "null"; > + break; > default: > type = "unknown"; > break; > > Modified: stable/10/sys/sys/mdioctl.h > ============================================================================== > --- stable/10/sys/sys/mdioctl.h Sun Oct 18 14:47:19 2015 (r289515) > +++ stable/10/sys/sys/mdioctl.h Sun Oct 18 14:52:31 2015 (r289516) > @@ -43,7 +43,7 @@ > #ifndef _SYS_MDIOCTL_H_ > #define _SYS_MDIOCTL_H_ > > -enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP}; > +enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP, MD_NULL}; > > /* > * Ioctl definitions for memory disk pseudo-device. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."