From nobody Thu Feb 6 18:42:37 2025 X-Original-To: dev-commits-src-main@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 4YpmDs3Wffz5msx1; Thu, 06 Feb 2025 18:42:37 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YpmDs2LPDz3rWf; Thu, 06 Feb 2025 18:42:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1738867357; 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=yOMkr5sP5AJI1x+gflsw2wIZgzGzSHyUjpsVihEC8W4=; b=SnyuQyews/PN0JJaYMgNnaLBEgyX+WIIBIDt3Hwri6lOFPYNwknOhMxJOxENe3nszDyOEQ kI3MdK/hyEHxVbZfXJiEzQYzPX2WTivAZlInwrRyyRGM7nMFPR9qMvKv7UthzelNm7wbL8 OFPfp/gV7ptzDKoDDXv3OS2WoS4xM+VyOwygQdrZv12MJafUAV1wEaZYLQqEw19szAjPri fzENoBoUFupg1W3GCJtAsoslZJfnaBjrWFMXBhglrGnMQ1xGseAWG1K6Qx2tAOoalL+49E ++r/UwDXs6LoSt7PS8/KlRGI8drMRoqFMve14ggHukfmI8J5AGmKPue+IzEZng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1738867357; 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=yOMkr5sP5AJI1x+gflsw2wIZgzGzSHyUjpsVihEC8W4=; b=NSU0eNAmmopJxpRSznEi3MICUlz1BvLbA7tfKoO1Zh56flqSBPaHw5MYVbjigAMCv5xnXJ dT+twNENeMmEn+1TBsNmAb6FEf71bXbJAb6YzcztxVkM2P2KfMB+umv0+q9z7UIlAAkeY0 jUTLhqx1mx44mMsBQINBqKU60+Wj2kxIQW3S1J9AV4O+J+zdZJYBTjpKR6GLgYSODmUklc P42H5nMs9ev2FNjGNvcED5cqDAzh6FE8vdbn2xnMot1639wKXxhvGbF+lJFqmv7FjkDfgn 95JbgV3woch46/Ypd1q1mvnnQnB7LlWATA4N1+B7xUmPPe2Znae338FUClf5pg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1738867357; a=rsa-sha256; cv=none; b=DpKkXI/+mpgmBM6KcUsKarSVoFdw129boy1nYeTKFgtQIpvngJ1D1tV9Pt8R2kif68drp5 TEIqKjdZszDZIRgWyRP/zU9/tPzZqV/25BjlWsRB95tqB/ZANXDm9vIAY6wWtvs39Nf0dM 1PfucZkgut1UwnPgMQMA4SkEAPjC3wLZXyDXabvNuAAsZOg6o1yca9qDkjv5RIocM5gYA8 ACrK6dA9WOWxvGeWEC3Gj+Mf/zV+G5H6oZRj5GFWdkb0EnUdL3XFCbdG7vbt24/shKF4gT +26l+BTPYCOYLp1unIr9N+Q62bTOQK5SkPctKfUqoVpNZBa9aLmZbNjh06vPEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YpmDs1m2tzr2d; Thu, 06 Feb 2025 18:42:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 516Igbxj057933; Thu, 6 Feb 2025 18:42:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 516IgbcA057930; Thu, 6 Feb 2025 18:42:37 GMT (envelope-from git) Date: Thu, 6 Feb 2025 18:42:37 GMT Message-Id: <202502061842.516IgbcA057930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 25105fa029da - main - cam/cd: Simplify to remove invalid flag List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 25105fa029da88d5e02a94481733aa5a2d947ba4 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=25105fa029da88d5e02a94481733aa5a2d947ba4 commit 25105fa029da88d5e02a94481733aa5a2d947ba4 Author: Warner Losh AuthorDate: 2025-02-06 18:19:06 +0000 Commit: Warner Losh CommitDate: 2025-02-06 18:40:22 +0000 cam/cd: Simplify to remove invalid flag cdoninvalidate set the CD_FLAG_INVALID flag. However, the periph's invalid flag is set before that routine is called, so it's always set when CD_FLAG_INVALID is set. It's therefore redundant. The code in strategy can be simplified by checking the periph's CAM_PERIPH_INVALID flag. Since this is a locked access, they will always be the same. The check in cdopen is currently redundant because both cam_periph_acquire and cam_periph_hold will return an error when CAM_PERIPH_INVALID is set, the former being unlocked, the latter being locked (to catch the race, but in this case the race doesn't matter). Since these are the only places we use this flag, we can simplfy the code by removing it entirely and changing cdstreategy slightly. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D48840 --- sys/cam/scsi/scsi_cd.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index d9a40544e845..ec6e31d49b22 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -100,7 +100,6 @@ typedef enum { "\007RETRY_BUSY" typedef enum { - CD_FLAG_INVALID = 0x0001, CD_FLAG_NEW_DISC = 0x0002, CD_FLAG_DISC_LOCKED = 0x0004, CD_FLAG_DISC_REMOVABLE = 0x0008, @@ -376,8 +375,6 @@ cdoninvalidate(struct cam_periph *periph) */ xpt_register_async(0, cdasync, periph, periph->path); - softc->flags |= CD_FLAG_INVALID; - /* * Return all queued I/O with ENXIO. * XXX Handle any transactions queued to the card @@ -740,23 +737,15 @@ static int cdopen(struct disk *dp) { struct cam_periph *periph; - struct cd_softc *softc; int error; periph = (struct cam_periph *)dp->d_drv1; - softc = (struct cd_softc *)periph->softc; if (cam_periph_acquire(periph) != 0) return(ENXIO); cam_periph_lock(periph); - if (softc->flags & CD_FLAG_INVALID) { - cam_periph_release_locked(periph); - cam_periph_unlock(periph); - return(ENXIO); - } - if ((error = cam_periph_hold(periph, PRIBIO | PCATCH)) != 0) { cam_periph_release_locked(periph); cam_periph_unlock(periph); @@ -861,7 +850,7 @@ cdstrategy(struct bio *bp) /* * If the device has been made invalid, error out */ - if ((softc->flags & CD_FLAG_INVALID)) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { cam_periph_unlock(periph); biofinish(bp, NULL, ENXIO); return;