From nobody Tue Jun 11 00:42:06 2024 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 4Vyqct5wJWz5NG8M; Tue, 11 Jun 2024 00:42: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vyqct4hgSz4hDr; Tue, 11 Jun 2024 00:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718066526; 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=pYGvoGtTff2JVuVia+V1ajuwXIsxAkjQ8jqbJQwgDuU=; b=DrTTqsHVngCtFnAwAROnikbjpjppsihyGK6mOEODCGJVSXM7oCajN+pGknXBQUXw73A9ZQ 6FYyrdYkN2xZdNw1zV04ILfcY8+1FDga8W988O+4Fty21mdpmmxKYclmHbf727xy0hWmoe qQ+uobaaV2NFZwdfshXDUato+qJIuGJvSKwQzOWF1UiTGbA8M3nV6iqXu79sK4J7HYrZ96 hqZICJvWLGctXLVLxQ89J/jJH/wtXejNv9TV5k8+iY+Ehc8JnQDi3hmHoVuuuGvYiMjIKd YwnrbatopXIdPQsjTvMllngRNnm0lBRGkt+uPQlzMmqUVk6GmkYflaWcT9gjFw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718066526; a=rsa-sha256; cv=none; b=M6JC2veTHDg129qv24oodZNyPjLbgI+h4cIcbEEuXHSHGdusbDjBUYFRGKjM1qhSSmZrvs cta+h7PwgbiNwe5DTMPcMlr32gWMVk72cX2jA9AhXBgCpOQEAZ/BNjA1XpN3q2ocBvgHXq jN+NPwjEbixlX+Zw8zUUsv4lZSyCUups5G4YRCZywRck6EitxQSavuD/xYA43SNITlMEOc MLPectT+R3h9Heb8UOazxOoLVC/Qir7CPyu1BIegF0+lkUNoDqFgH87cqmT5NcorsZaDMR UXhVLMWkgx185DVBL38O8RqDbvluWtQVNzJ2XrmQ5T9+84BwTrRZp1MfMM4Sxg== 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=1718066526; 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=pYGvoGtTff2JVuVia+V1ajuwXIsxAkjQ8jqbJQwgDuU=; b=lPTPldBlVDKDiEYU89fd9vPAoaXCgSpaqIu7yubERkXM422lw1WYbJFepWy9ess0n2nIFY Cp+/dLWomHd8G4jEiRhKpO178uQ8NcJ3GtD7IbR57/w5OWo5c4sEiwJBcOUdoi8x/iFLY7 GuerWJNbpNO0gafuSdlFy7Jk0WOui6WqLfOtzuzX6SKapN0Wj5kToXMFXTGaeK6Uf17840 4fOz9jvei1Lq4v9/NHLaj41NgWF4t5eI3mzC+rlhNCsCm0OhjByCo4Ajgi21PcnDnAslXA Ju+jWx21YLAzWfciBlZGpc87gwpkmWxYXeBCnzzYV0+cyjMReXW77jyFJTjgww== 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 4Vyqct4Jt9znhs; Tue, 11 Jun 2024 00:42:06 +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 45B0g6tP082706; Tue, 11 Jun 2024 00:42:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45B0g6aJ082703; Tue, 11 Jun 2024 00:42:06 GMT (envelope-from git) Date: Tue, 11 Jun 2024 00:42:06 GMT Message-Id: <202406110042.45B0g6aJ082703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: e754909cb0ae - main - virstor: remove relation between chunk size and MAXPHYS 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: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e754909cb0aeaf759cddf79c14a04a42f8d894bc Auto-Submitted: auto-generated The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=e754909cb0aeaf759cddf79c14a04a42f8d894bc commit e754909cb0aeaf759cddf79c14a04a42f8d894bc Author: Ryan Libby AuthorDate: 2024-06-11 00:38:17 +0000 Commit: Ryan Libby CommitDate: 2024-06-11 00:38:17 +0000 virstor: remove relation between chunk size and MAXPHYS There's no reason why the virstor chunk size needs to relate to MAXPHYS. Remove it. Instead, just make sure that the chunk size is a multiple of the sector size. Reviewed by: imp Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D45518 --- lib/geom/virstor/geom_virstor.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/lib/geom/virstor/geom_virstor.c b/lib/geom/virstor/geom_virstor.c index 6a7dfb27fe43..5f5087e99213 100644 --- a/lib/geom/virstor/geom_virstor.c +++ b/lib/geom/virstor/geom_virstor.c @@ -195,27 +195,6 @@ virstor_label(struct gctl_req *req) return; } - if (md.md_chunk_size % MAXPHYS != 0) { - /* XXX: This is not strictly needed, but it's convenient to - * impose some limitations on it, so why not MAXPHYS. */ - size_t new_size = rounddown(md.md_chunk_size, MAXPHYS); - if (new_size < md.md_chunk_size) - new_size += MAXPHYS; - fprintf(stderr, "Resizing chunk size to be a multiple of " - "MAXPHYS (%d kB).\n", MAXPHYS / 1024); - fprintf(stderr, "New chunk size: %zu kB\n", new_size / 1024); - md.md_chunk_size = new_size; - } - - if (md.md_virsize % md.md_chunk_size != 0) { - off_t chunk_count = md.md_virsize / md.md_chunk_size; - md.md_virsize = chunk_count * md.md_chunk_size; - fprintf(stderr, "Resizing virtual size to be a multiple of " - "chunk size.\n"); - fprintf(stderr, "New virtual size: %zu MB\n", - (size_t)(md.md_virsize/(1024 * 1024))); - } - msize = secsize = 0; for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); @@ -240,11 +219,20 @@ virstor_label(struct gctl_req *req) } if (md.md_chunk_size % secsize != 0) { - fprintf(stderr, "Error: chunk size is not a multiple of sector " - "size."); - gctl_error(req, "Chunk size (in bytes) must be multiple of %u.", - (unsigned int)secsize); - return; + size_t new_size = roundup(md.md_chunk_size, secsize); + fprintf(stderr, "Resizing chunk size to be a multiple of " + "sector size (%zu bytes).\n", secsize); + fprintf(stderr, "New chunk size: %zu kB\n", new_size / 1024); + md.md_chunk_size = new_size; + } + + if (md.md_virsize % md.md_chunk_size != 0) { + off_t chunk_count = md.md_virsize / md.md_chunk_size; + md.md_virsize = chunk_count * md.md_chunk_size; + fprintf(stderr, "Resizing virtual size to be a multiple of " + "chunk size.\n"); + fprintf(stderr, "New virtual size: %zu MB\n", + (size_t)(md.md_virsize / (1024 * 1024))); } total_chunks = md.md_virsize / md.md_chunk_size;