Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 2024 00:42:06 GMT
From:      Ryan Libby <rlibby@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e754909cb0ae - main - virstor: remove relation between chunk size and MAXPHYS
Message-ID:  <202406110042.45B0g6aJ082703@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=e754909cb0aeaf759cddf79c14a04a42f8d894bc

commit e754909cb0aeaf759cddf79c14a04a42f8d894bc
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-11 00:38:17 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406110042.45B0g6aJ082703>