From nobody Mon May 20 20:06:41 2024 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 4VjpVn27Rsz5LKnt; Mon, 20 May 2024 20:06:41 +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 4VjpVn1Qdfz4NHh; Mon, 20 May 2024 20:06:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716235601; 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=DtrztrjsF/0HrqpLESjMXTtnpke3da1fPAjqTovvMN4=; b=Md9ih/BMfiAZZUGmOKL50xwE6xJ2A4Iu4ted2HefCTgUZzeutqicxVQmTDmwcSBfSfzAIv 2fbLENB9UAMGYePey3uj44oZkmyspvSP7/zVkriWVUlSIYaclxp2U0RY4UqW/MhYOTg+VS BRTRhFg+mmMLNXh8b0RT7hxXUv3v/chFwtVppQIIpnPTYwTK8YvnUJtMAeJb665hIzxkCF p7EnFxrquFoYnuv1jG4lPOiTDTwPpePzNHPwcsBkOEQ8aOPfnMF2aRUeTFwqenavk7B+pq wfOqhcVRc3jAqBvBNwO0fUcN+vwnmoxzkCO2pyQF6aOdwKR095bNtJIgntWZ9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716235601; a=rsa-sha256; cv=none; b=xahY8B/MfbjrgCzFhsbf9MOrqKAO9zi2AteypvLbIv113Zt6MiHe0I0UITkeWK0Xv47QUL G3m7sO5W4AYjA/1yO/47c4kCB0rGuWbniAvCgmnEBwHE7qIWDbCSvyIZFU3vnF8DhfbZ+S qQUtJJm+XCjQu270cvtJ56cTp/kiLVYOn11YhmkTrQMS7eSyexkO6/hIzkKOtSGpCSGVk/ Rs+m6EsyYhxqh2v6Blc+EtnI2HHfkMqsW6Pp9T+qNbUJqH2KCNcSFraOKvMkY5/0PX5icX Q9HY0cj6HYaKgml4PFSdbfBIW/Tty1ZVx9gZmA1qTvSSCv1HOFuGp2ZLfisyAg== 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=1716235601; 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=DtrztrjsF/0HrqpLESjMXTtnpke3da1fPAjqTovvMN4=; b=XSsgJCdSIeLUp3oDCph9KZQulvsUITiq4EzsT89fphIrGCcoriUzg1owzIQIovw7uwyJ8y BW3NV+4IVA4OQUwzoTXU9UBuYUtETMnmVFn9DvAluNK0B6/w6w0IsBvooblnbxVt1VNrBj KvaMtcAd77tvKreNRyIBPX4loxHUNAUTacJS8/iE7qjOReD9tR5ARdyCS63C8pkmU56mXo PKSXb8tFpd5iS9Exjp1geVJeFPQiML7x571Wd0QEnc1/giruN3TaCxlHeQ9hcxltmCE/F+ Vto+wN5AdrFp4K2QO2DunrZ8Gv2wJmZ0DUhIr0nEUkxPQK/PRQ13suh8LlblLQ== 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 4VjpVn12V1zrvP; Mon, 20 May 2024 20:06:41 +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 44KK6fe7007300; Mon, 20 May 2024 20:06:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44KK6f3l007297; Mon, 20 May 2024 20:06:41 GMT (envelope-from git) Date: Mon, 20 May 2024 20:06:41 GMT Message-Id: <202405202006.44KK6f3l007297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f65f02ccf2a5 - stable/14 - geom_stripe: Cascade cantrim just like we do 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f65f02ccf2a5656e96b32705bad52b11fbc3177c Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f65f02ccf2a5656e96b32705bad52b11fbc3177c commit f65f02ccf2a5656e96b32705bad52b11fbc3177c Author: Matthew Grooms AuthorDate: 2024-05-03 15:01:21 +0000 Commit: Warner Losh CommitDate: 2024-05-20 19:23:40 +0000 geom_stripe: Cascade cantrim just like we do for gmirror If any of the disks can support trim, cascade that up the stack. Otherwise, trims won't pass through striped raid setups. PR: 277673 Reviewed by: imp (minor style tweaks from bug report) (cherry picked from commit ea2d874cca7cdfe6133c1835dadd8f0672723fa6) --- sys/geom/stripe/g_stripe.c | 21 ++++++++++++++++++++- sys/geom/stripe/g_stripe.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c index ca3fbcbb30b2..2708284a8091 100644 --- a/sys/geom/stripe/g_stripe.c +++ b/sys/geom/stripe/g_stripe.c @@ -592,7 +592,12 @@ g_stripe_start(struct bio *bp) g_stripe_pushdown(sc, bp); return; case BIO_GETATTR: - /* To which provider it should be delivered? */ + if (!strcmp(bp->bio_attribute, "GEOM::candelete")) { + int val = (sc->sc_flags & G_STRIPE_FLAG_CANDELETE) != 0; + g_handleattr(bp, "GEOM::candelete", &val, sizeof(val)); + return; + } + /* otherwise: To which provider it should be delivered? */ default: g_io_deliver(bp, EOPNOTSUPP); return; @@ -795,6 +800,20 @@ g_stripe_add_disk(struct g_stripe_softc *sc, struct g_provider *pp, u_int no) } sc->sc_disks[no] = cp; + + /* cascade candelete */ + error = g_access(cp, 1, 0, 0); + if (error == 0) { + int can_delete; + + error = g_getattr("GEOM::candelete", cp, &can_delete); + if (error == 0 && can_delete != 0) + sc->sc_flags |= G_STRIPE_FLAG_CANDELETE; + G_STRIPE_DEBUG(1, "Provider %s candelete %i.", pp->name, + can_delete); + g_access(cp, -1, 0, 0); + } + G_STRIPE_DEBUG(0, "Disk %s attached to %s.", pp->name, sc->sc_name); g_stripe_check_and_run(sc); diff --git a/sys/geom/stripe/g_stripe.h b/sys/geom/stripe/g_stripe.h index 4c5430275350..1075a176b9b3 100644 --- a/sys/geom/stripe/g_stripe.h +++ b/sys/geom/stripe/g_stripe.h @@ -47,6 +47,8 @@ #define G_STRIPE_TYPE_MANUAL 0 #define G_STRIPE_TYPE_AUTOMATIC 1 +#define G_STRIPE_FLAG_CANDELETE 0x00000001UL + #define G_STRIPE_DEBUG(lvl, ...) \ _GEOM_DEBUG("GEOM_STRIPE", g_stripe_debug, (lvl), NULL, __VA_ARGS__) #define G_STRIPE_LOGREQ(bp, ...) \ @@ -62,6 +64,7 @@ struct g_stripe_softc { off_t sc_stripesize; uint32_t sc_stripebits; struct mtx sc_lock; + int sc_flags; }; #define sc_name sc_geom->name #endif /* _KERNEL */