From nobody Sat Nov 30 16:51:05 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 4Y0wzZ2KHvz5fHmK; Sat, 30 Nov 2024 16:51:06 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y0wzY33N8z4nSC; Sat, 30 Nov 2024 16:51:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732985465; 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=6KPvM7Zuwlofk7kmkYW9XStVoRDDJZVX7n5Y2dYX9RU=; b=l0xdzvvqFns9tRXmMACHDFbJ/UbP0TwvZmjayK7NZeCzSoebGO60mxnnEwQblhx7OZrZcw HQJEcCdpXc2YVOBCgiDmPFTcl/+s1Ebhtcgw1ivdlIHlf/N2kLY2md9T9ygc3KtDTNtEfX zeOufBr51S6zIHdCysEBoDdfy3O1NNc2fvMJJ59m2YrT9FG3RduZUA+o26osdAylrGghTr Fi1rCRQB+W4Pwp5jFw6XOMVXNiZS3xyFxa/n4KkX1HjjyIPFS36DeBbqPv0AHzhwDhzL3d QD+DFZvXlhNEzysBKzheYq05hRBCrxh/8zUxB66anQl9GXuyQ/icCmYDFvKl9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732985465; 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=6KPvM7Zuwlofk7kmkYW9XStVoRDDJZVX7n5Y2dYX9RU=; b=vgqRiInfbj3Y/82qqK0Bo00kFVeedxNNIuo/mtyD8a+7KVEV3OdkzrKFwBOAChj2wT3GB/ aHSU22Syz4SWxEuoVW3VOIw4zPzC2t9UkkM630y+lal6eR87tJs25aJWTOSFiKLy+Mm34u +q592kGbZO9p9DTu9MiXcPX9tBLzY7EUGTOP1wloObu8T83yUjhHuQxEcGHduyq2FSt3uz NiXpFBQqc+zfcx+YbzvIJMHP4cFkVvD/5uq7aZr9++MEr3UJ8rF5ulw7HWbFSy89d+1AIc WbX3MVdAtddgWmFf2lm6u63nJy6LF9EKoZVx5YXbVBuQlB7hQ9Rw/4YddaeE1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732985465; a=rsa-sha256; cv=none; b=WWM4A227MlcOmnjZirmK48qDybXD26/pUfkxLQtiUuA45Q2rAqe+00kzNP2ZcPcrbNnxeV Gz5PrObUsf0pKkY3pveZOVTB2pypTL83vDuNXRo/smnW0o0Tqb943+xWLkvVa2hCBejeYF Za+Cjv1v1xjtxBC37daEFIHobM4AIeTx7TxGFlCmSE0KVysvUCBfYVT+3W/DMEf5HFLhKW nZHRB03d0JdoiIITQm2qFFE9P2HNFb9R+dDfpgxJObrvPtrUjkfOYckGyT58twPtuvD7R/ CLc86HVuG6SViu0T5SvOwReYXyVejRSM16rSmffdr6M1lvKr7Lxe4u7EVSVvug== 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 4Y0wzY2LrzzFxX; Sat, 30 Nov 2024 16:51:05 +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 4AUGp5RS043147; Sat, 30 Nov 2024 16:51:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AUGp5aR043144; Sat, 30 Nov 2024 16:51:05 GMT (envelope-from git) Date: Sat, 30 Nov 2024 16:51:05 GMT Message-Id: <202411301651.4AUGp5aR043144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 1fd57c5735ef - stable/14 - md: Merge two switch statements in mdstart_vnode 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1fd57c5735ef2789bcc97b81dd1d73a400578fc7 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1fd57c5735ef2789bcc97b81dd1d73a400578fc7 commit 1fd57c5735ef2789bcc97b81dd1d73a400578fc7 Author: John Baldwin AuthorDate: 2024-05-10 20:43:23 +0000 Commit: John Baldwin CommitDate: 2024-11-30 13:55:57 +0000 md: Merge two switch statements in mdstart_vnode While here, use bp->bio_cmd instead of auio.uio_rw to drive read vs write behavior. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45155 (cherry picked from commit f75764fea34afe59f2db338b3e973eba626243ee) --- sys/dev/md/md.c | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 3285cfef830d..f6634c709225 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -889,23 +889,6 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) int ma_offs, npages; bool mapped; - switch (bp->bio_cmd) { - case BIO_READ: - auio.uio_rw = UIO_READ; - break; - case BIO_WRITE: - auio.uio_rw = UIO_WRITE; - break; - case BIO_FLUSH: - break; - case BIO_DELETE: - if (sc->candelete) - break; - /* FALLTHROUGH */ - default: - return (EOPNOTSUPP); - } - td = curthread; vp = sc->vnode; piov = NULL; @@ -922,7 +905,14 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) * still valid. */ - if (bp->bio_cmd == BIO_FLUSH) { + switch (bp->bio_cmd) { + case BIO_READ: + auio.uio_rw = UIO_READ; + break; + case BIO_WRITE: + auio.uio_rw = UIO_WRITE; + break; + case BIO_FLUSH: do { (void)vn_start_write(vp, &mp, V_WAIT); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); @@ -931,11 +921,17 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) vn_finished_write(mp); } while (error == ERELOOKUP); return (error); - } else if (bp->bio_cmd == BIO_DELETE) { - error = vn_deallocate(vp, &off, &len, 0, - sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred, NOCRED); - bp->bio_resid = len; - return (error); + case BIO_DELETE: + if (sc->candelete) { + error = vn_deallocate(vp, &off, &len, 0, + sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred, + NOCRED); + bp->bio_resid = len; + return (error); + } + /* FALLTHROUGH */ + default: + return (EOPNOTSUPP); } auio.uio_offset = (vm_ooffset_t)bp->bio_offset; @@ -983,7 +979,7 @@ unmapped_step: auio.uio_iovcnt = 1; } iostart = auio.uio_offset; - if (auio.uio_rw == UIO_READ) { + if (bp->bio_cmd == BIO_READ) { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_READ(vp, &auio, 0, sc->cred); VOP_UNLOCK(vp);