From nobody Wed Sep 06 20:44:31 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RgvW36yt4z4sqZ9; Wed, 6 Sep 2023 20:44:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RgvW36XZDz4f3B; Wed, 6 Sep 2023 20:44:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694033071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TSqT0l1rn38ls/GSaX2g9mRMyZgzNmo9miRVfg9+bDU=; b=bq6rx2xKJtUBoSGlJtoScZ9T49NfbWG1Mb2N5GBhaWuuNwZL6CMrIiZc4icpWGuL8LCThg ZhIHfvAJE7E1l4lOV6zRn2OVBdDg12WKYIUjlmP7E+DuVhLw0dXNJr5iesjUx4mSR85Int 0VB/qXL0iRsuiAJvQNEicopgj0LE9toM5fv9xtrE7/dALXDoQP50RZIZAIIsFxWR9AmqTz BqtGxN4MrWPXpTe8seRSZuRxW0Q/M51fgMoQNPkCtar8oKuNq3wu56AERSef5D4WgpCj99 EpUTkgFiGzQ996qiPmEcBoQjzS6ZrEoNjrOjfQ89wXRF9xXf/eghfWh0tfmkkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694033071; a=rsa-sha256; cv=none; b=L8J4yLjjwPFJM2gJao03R2ZLu7MBL2pcFyTKnnQyva3AwhqIiI6/UH7ueUKSk4BiwSW1vV glXTyegKjI9U07BxdjL8iALwCmN2hxUjdSbtvuZDu6skxvzR5MPgFkwxOo1N7Il/HepCCc PW26N0WrwvY2uLd9APyGJkw6I5POowuT1YHkI5UGDsHSLsWXkc0FaIns1uh8fG9EAteX3y tuH/j0Bt+VkE/PMZBoIB9ztpQ1SrRKD49oZ1fH0QinMLyXP1ciBrU5X8p2+mVG9XcsMHvb 0bZ66H1+pRDJahMXbEceZLG13phg6gw0R9zVWysHXZ5WdwypizHY4Kr1J9z/7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694033071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TSqT0l1rn38ls/GSaX2g9mRMyZgzNmo9miRVfg9+bDU=; b=MP93f5uo8rEwZMtAt8+OXWU+tLmscT3QE32U2ezxuZMsYvIZGKgluxNWmJSCKIa6M4vXbd s4BTZiaqcxRwCRMW16jJrAydENrrJj5xrd3fptngh14nXjFPTg1FSPxkSEdnW+7xstC37M o3eRKpLao6mIFK5cJk9lCVIlVOFTRNQRUH92SkPEIQU3nTAeo05bfXw41Mbm+miQSappA6 YEwvPPSA0OaZF4Y/FziRp8q6a4luwZkAu7S4mcS2/p/mf6WReQErcPD23vQnuwKhABUDZ8 BvboOT5ZiGQoqSEB76JWtJg6InRKVWlEM3SHC2qj+kqcX2Zl6K+sa22W3j2MYw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RgvW35bF8zWmJ; Wed, 6 Sep 2023 20:44:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 386KiVkJ002366; Wed, 6 Sep 2023 20:44:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 386KiVE1002362; Wed, 6 Sep 2023 20:44:31 GMT (envelope-from git) Date: Wed, 6 Sep 2023 20:44:31 GMT Message-Id: <202309062044.386KiVE1002362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 422efa7050a7 - stable/13 - Implement GEOM::rotation_rate for gmirror List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 422efa7050a7a0a75f04aed2c857a2e2ea4f51ed Auto-Submitted: auto-generated The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=422efa7050a7a0a75f04aed2c857a2e2ea4f51ed commit 422efa7050a7a0a75f04aed2c857a2e2ea4f51ed Author: Alan Somers AuthorDate: 2023-04-07 16:07:50 +0000 Commit: Alan Somers CommitDate: 2023-09-06 20:42:59 +0000 Implement GEOM::rotation_rate for gmirror If all of the mirror's children have the same rotation rate, report that. But if they have mixed rotation rates, or if any child has an unknown rotation rate, report "Unknown". Sponsored by: Axcient Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D39458 (cherry picked from commit 9309a460b23a8cda8d47c5f775da7fc6472d9925) --- sys/geom/mirror/g_mirror.c | 29 +++++++++++++++++++++++++++++ sys/geom/mirror/g_mirror.h | 1 + 2 files changed, 30 insertions(+) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 223412224cb0..14eabe242d2d 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -46,6 +46,7 @@ #include #include +#include #include FEATURE(geom_mirror, "GEOM mirroring support"); @@ -477,6 +478,10 @@ g_mirror_init_disk(struct g_mirror_softc *sc, struct g_provider *pp, error = g_getattr("GEOM::candelete", disk->d_consumer, &i); if (error == 0 && i != 0) disk->d_flags |= G_MIRROR_DISK_FLAG_CANDELETE; + error = g_getattr("GEOM::rotation_rate", disk->d_consumer, + &disk->d_rotation_rate); + if (error) + disk->d_rotation_rate = DISK_RR_UNKNOWN; if (md->md_provider[0] != '\0') disk->d_flags |= G_MIRROR_DISK_FLAG_HARDCODED; disk->d_sync.ds_consumer = NULL; @@ -1145,6 +1150,27 @@ g_mirror_kernel_dump(struct bio *bp) g_mirror_get_diskname(disk)); } +static void +g_mirror_rotation_rate(struct bio *bp) +{ + struct g_mirror_softc *sc; + struct g_mirror_disk *disk; + bool first = true; + uint16_t rr = DISK_RR_UNKNOWN; + + sc = bp->bio_to->private; + LIST_FOREACH(disk, &sc->sc_disks, d_next) { + if (first) + rr = disk->d_rotation_rate; + else if (rr != disk->d_rotation_rate) { + rr = DISK_RR_UNKNOWN; + break; + } + first = false; + } + g_handleattr(bp, "GEOM::rotation_rate", &rr, sizeof(rr)); +} + static void g_mirror_start(struct bio *bp) { @@ -1174,6 +1200,9 @@ g_mirror_start(struct bio *bp) } else if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) { g_mirror_kernel_dump(bp); return; + } else if (!strcmp(bp->bio_attribute, "GEOM::rotation_rate")) { + g_mirror_rotation_rate(bp); + return; } /* FALLTHROUGH */ default: diff --git a/sys/geom/mirror/g_mirror.h b/sys/geom/mirror/g_mirror.h index 3b6880ee004d..76e736584c4b 100644 --- a/sys/geom/mirror/g_mirror.h +++ b/sys/geom/mirror/g_mirror.h @@ -137,6 +137,7 @@ struct g_mirror_disk { u_int d_init_ndisks; /* Initial number of mirror components */ uint32_t d_init_slice; /* Initial slice size */ uint8_t d_init_balance;/* Initial balance */ + uint16_t d_rotation_rate;/* Disk's rotation rate */ uint64_t d_init_mediasize;/* Initial mediasize */ }; #define d_name d_consumer->provider->name