From owner-svn-src-head@freebsd.org Mon Aug 28 16:22:51 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 33638E0FB4B; Mon, 28 Aug 2017 16:22:51 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10F3B8005D; Mon, 28 Aug 2017 16:22:51 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 777DF10AF3A; Mon, 28 Aug 2017 12:22:49 -0400 (EDT) From: John Baldwin To: Maxim Sobolev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys Date: Mon, 28 Aug 2017 09:19:15 -0700 Message-ID: <7384187.efIiCynxO3@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708281554.v7SFs8fr014268@repo.freebsd.org> References: <201708281554.v7SFs8fr014268@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 28 Aug 2017 12:22:49 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean 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: Mon, 28 Aug 2017 16:22:51 -0000 On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: > Author: sobomax > Date: Mon Aug 28 15:54:07 2017 > New Revision: 322969 > URL: https://svnweb.freebsd.org/changeset/base/322969 > > Log: > Add ability to label md(4) devices. > > This feature comes from the fact that we rely memory-backed md(4) > in our build process heavily. However, if the build goes haywire > the allocated resources (i.e. swap and memory-backed md(4)'s) need > to be purged. It is extremely useful to have ability to attach > arbitrary labels to each of the virtual disks so that they can > be identified and GC'ed if neecessary. > > MFC after: 4 weeks > Differential Revision: https://reviews.freebsd.org/D10457 > > Modified: > head/sbin/mdconfig/mdconfig.8 > head/sbin/mdconfig/mdconfig.c > head/sys/dev/md/md.c > head/sys/sys/mdioctl.h > > Modified: head/sys/sys/mdioctl.h > ============================================================================== > --- head/sys/sys/mdioctl.h Mon Aug 28 14:49:26 2017 (r322968) > +++ head/sys/sys/mdioctl.h Mon Aug 28 15:54:07 2017 (r322969) > @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA > * Ioctl definitions for memory disk pseudo-device. > */ > > -#define MDNPAD 97 > +#define MDNPAD 96 > struct md_ioctl { > unsigned md_version; /* Structure layout version */ > unsigned md_unit; /* unit number */ > @@ -61,6 +61,7 @@ struct md_ioctl { > u_int64_t md_base; /* base address */ > int md_fwheads; /* firmware heads */ > int md_fwsectors; /* firmware sectors */ > + char *md_label; /* label of the device */ > int md_pad[MDNPAD]; /* padding for future ideas */ > }; This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on those platforms. It would be really neat if one could use the label more pervasively. For example, it would be nice to do something like this: # mdconfig -a -t malloc -s 16M -L foo # newfs /dev/md/foo # mdconfig -d -L foo This would mean that labelled memory disks would not create /dev/mdX entries, but would instead create /dev/md/