From patchwork Wed Mar 13 02:11:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13590912 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD3D8BA2B for ; Wed, 13 Mar 2024 02:11:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295893; cv=none; b=txR/EcECmAFC8/g0LF350ZslvH5rCXrW/JH3MieeQxBHVSo5VwAGtx7qxYKZqtON7jzMU87LiRhkwB0lHvUisPFxm8t6i+Dj4KWtU8MJ30JgrkoGuNQbj12lAByo84qwzyekr5z93dQFFtmsi4xZavCjUuZuS/A3L4l5+Vvp1fk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295893; c=relaxed/simple; bh=8kHd6+w53P0AmOt650tLXs73TW5VKvxj9sIN9mLT4tI=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KwfgEA4Ircg00TXGJIFgGfgoam7yMPHZBWrqPdwu8cxXkQ05S4Orf3f3h1NMjNi8mx9sLWcPKjdlILfNa4Guuw/P2CbfT0BY6voVMhamD5QijgrrspeJ+ZWKRednnauxqM0K0luG6VcoFWs238vjG9LLKPDYmJm53IYMoCks+KM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SVUVHySt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SVUVHySt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DAC9C433F1; Wed, 13 Mar 2024 02:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710295893; bh=8kHd6+w53P0AmOt650tLXs73TW5VKvxj9sIN9mLT4tI=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=SVUVHyStrKWavtj9WJkQDR5ojezzQyi0QpXBXGMU8fW3eFoNRAe7qYihqAlcDdfXY JWhyEPU9gYARLlJ2TZHqgRgL2iMv+O6mMSitWGQxaT2W80fjOksWAMZVEb1NQLt/IB KoTrYpCt81SzN/my3K/vTsL02IKk7uD9f+GrNNzI6/KNH1HpoSoP1ZybW4zqsJ5nIV 3S7mVnPNaezf1Cdg+NiRFXhfRHoiDdr9kMBGJJ5px5Wb8XKu5MyKGWHqBTw6x9fxQS kH3Kmaff2uSwmHCEhIghB0vAbm4bBUJrTWwFYxApoyAHdNUBaQIktJq4sSHgauD3OZ XI6PgqGblZlmA== Date: Tue, 12 Mar 2024 19:11:32 -0700 Subject: [PATCH 1/5] libxfs: remove the unused fs_topology_t typedef From: "Darrick J. Wong" To: djwong@kernel.org, cem@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org Message-ID: <171029433229.2063634.360630278280106571.stgit@frogsfrogsfrogs> In-Reply-To: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> References: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- libxfs/topology.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libxfs/topology.h b/libxfs/topology.h index 1af5b054947d..3a309a4dae05 100644 --- a/libxfs/topology.h +++ b/libxfs/topology.h @@ -10,13 +10,13 @@ /* * Device topology information. */ -typedef struct fs_topology { +struct fs_topology { int dsunit; /* stripe unit - data subvolume */ int dswidth; /* stripe width - data subvolume */ int rtswidth; /* stripe width - rt subvolume */ int lsectorsize; /* logical sector size &*/ int psectorsize; /* physical sector size */ -} fs_topology_t; +}; void get_topology( From patchwork Wed Mar 13 02:11:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13590913 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B84D8BE0 for ; Wed, 13 Mar 2024 02:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295909; cv=none; b=PbnnrVp1qwKWF33lB/eNFNnRTAh3ggVXKQp6ZOWR/xBKzobh8kvuygQnbtTIwXzRVAKO5pWBoGrH2k/O3Tp2msmHUlIBgoWjNNejRsz6y5hcEOhQuA3olSlQyU+WOLBOrQPB10ihQTPH54rUjCr0Xlky3301df62/CJ6AAojtS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295909; c=relaxed/simple; bh=sYvYo9EnT/3kskn67DljJ5QaWeGg1qxbQvSBUAtQQ80=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dmejIep8QsgAAmLEE0l9v+rimgJRZiHtfXmkoog16hMEuJ/HhmaLu5zo3fAWH7rTIvXih+HO6YCkCNvmR2VsyIQw/cKlduZmUPgi9SjzmC1SG7nbeHr3Vljz9yKEHYmNsQEmR+Z7i3ESVTtwC2cCuAnt0Z0lVtdjg3d84M2H1Ts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dBuonGTT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dBuonGTT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA30AC433F1; Wed, 13 Mar 2024 02:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710295908; bh=sYvYo9EnT/3kskn67DljJ5QaWeGg1qxbQvSBUAtQQ80=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=dBuonGTTBzj4nI9NrgHRR3IpXKKQok2C5mcHelLlHR18XV0CsX7uAzWnbr+Hoe8cH VxxjIz97Qhx53klww+wHq4SbqoGVH44qVe6NuNORIYzDTA6qNjrYrDRyzXrvjE6/+6 nq4Vk07B5pJPofEMWnU2cgr0kvms8VglXk2RXhXSlrRcOwywLB5KpBPVbtXpunSQYe 1gfyyrNulLNFiSK1u5Gyiv+Z1IJRoAOVa+Nq8/zkHUKZi2mYtTzuV3wseAB5mTGp5m /5dzczd5Vuvhuv1fbEky6twImiYsBDeSbkgXbnczwnzf11nrWqGir4LzWGUFaSdquh EYVCTdZM+yEUQ== Date: Tue, 12 Mar 2024 19:11:48 -0700 Subject: [PATCH 2/5] libxfs: refactor the fs_topology structure From: "Darrick J. Wong" To: djwong@kernel.org, cem@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org Message-ID: <171029433243.2063634.6109378862319035774.stgit@frogsfrogsfrogs> In-Reply-To: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> References: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig fs_topology is a mess that mixes up data and RT device reporting, and to make things worse reuses lsectorsize for the logical sector size while other parts of xfsprogs use it for the log sector size. Split out a device_topology structure that reports the topology for one device and embedded two of them into the fs_topology struture, and pass them directly to blkid_get_topology. Rename the sector size members to be more explicit, and move some of the sanity checking from mkfs into the topology helpers. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- libxfs/topology.c | 114 ++++++++++++++++++++++++++++------------------------- libxfs/topology.h | 14 ++++--- mkfs/xfs_mkfs.c | 64 +++++++++++++----------------- repair/sb.c | 2 - 4 files changed, 99 insertions(+), 95 deletions(-) diff --git a/libxfs/topology.c b/libxfs/topology.c index 06013d429456..8ae5f7483f96 100644 --- a/libxfs/topology.c +++ b/libxfs/topology.c @@ -173,18 +173,14 @@ check_overwrite( return ret; } -static void blkid_get_topology( - const char *device, - int *sunit, - int *swidth, - int *lsectorsize, - int *psectorsize, - int force_overwrite) +static void +blkid_get_topology( + const char *device, + struct device_topology *dt, + int force_overwrite) { - blkid_topology tp; blkid_probe pr; - unsigned long val; struct stat statbuf; /* can't get topology info from a file */ @@ -203,31 +199,28 @@ static void blkid_get_topology( if (!tp) goto out_free_probe; - val = blkid_topology_get_logical_sector_size(tp); - *lsectorsize = val; - val = blkid_topology_get_physical_sector_size(tp); - *psectorsize = val; - val = blkid_topology_get_minimum_io_size(tp); - *sunit = val; - val = blkid_topology_get_optimal_io_size(tp); - *swidth = val; + dt->logical_sector_size = blkid_topology_get_logical_sector_size(tp); + dt->physical_sector_size = blkid_topology_get_physical_sector_size(tp); + dt->sunit = blkid_topology_get_minimum_io_size(tp); + dt->swidth = blkid_topology_get_optimal_io_size(tp); /* * If the reported values are the same as the physical sector size * do not bother to report anything. It will only cause warnings * if people specify larger stripe units or widths manually. */ - if (*sunit == *psectorsize || *swidth == *psectorsize) { - *sunit = 0; - *swidth = 0; + if (dt->sunit == dt->physical_sector_size || + dt->swidth == dt->physical_sector_size) { + dt->sunit = 0; + dt->swidth = 0; } /* * Blkid reports the information in terms of bytes, but we want it in * terms of 512 bytes blocks (only to convert it to bytes later..) */ - *sunit = *sunit >> 9; - *swidth = *swidth >> 9; + dt->sunit >>= 9; + dt->swidth >>= 9; if (blkid_topology_get_alignment_offset(tp) != 0) { fprintf(stderr, @@ -241,7 +234,7 @@ static void blkid_get_topology( exit(EXIT_FAILURE); } /* Do not use physical sector size if the device is misaligned */ - *psectorsize = *lsectorsize; + dt->physical_sector_size = dt->logical_sector_size; } blkid_free_probe(pr); @@ -268,65 +261,78 @@ check_overwrite( return 1; } -static void blkid_get_topology( - const char *device, - int *sunit, - int *swidth, - int *lsectorsize, - int *psectorsize, - int force_overwrite) +static void +blkid_get_topology( + const char *device, + struct device_topology *dt, + int force_overwrite) { /* * Shouldn't make any difference (no blkid = no block device access), * but make sure this dummy replacement returns with at least some * sanity. */ - *lsectorsize = *psectorsize = 512; + dt->logical_sector_size = 512; + dt->physical_sector_size = 512; } #endif /* ENABLE_BLKID */ -void -get_topology( - struct libxfs_init *xi, - struct fs_topology *ft, +static void +get_device_topology( + struct libxfs_dev *dev, + struct device_topology *dt, int force_overwrite) { - struct stat statbuf; + struct stat st; + + /* + * Nothing to do if this particular subvolume doesn't exist. + */ + if (!dev->name) + return; /* * If our target is a regular file, use platform_findsizes * to try to obtain the underlying filesystem's requirements * for direct IO; we'll set our sector size to that if possible. */ - if (xi->data.isfile || - (!stat(xi->data.name, &statbuf) && S_ISREG(statbuf.st_mode))) { - int fd; + if (dev->isfile || (!stat(dev->name, &st) && S_ISREG(st.st_mode))) { int flags = O_RDONLY; long long dummy; + int fd; /* with xi->disfile we may not have the file yet! */ - if (xi->data.isfile) + if (dev->isfile) flags |= O_CREAT; - fd = open(xi->data.name, flags, 0666); + fd = open(dev->name, flags, 0666); if (fd >= 0) { - platform_findsizes(xi->data.name, fd, &dummy, - &ft->lsectorsize); + platform_findsizes(dev->name, fd, &dummy, + &dt->logical_sector_size); close(fd); - ft->psectorsize = ft->lsectorsize; - } else - ft->psectorsize = ft->lsectorsize = BBSIZE; + } else { + dt->logical_sector_size = BBSIZE; + } } else { - blkid_get_topology(xi->data.name, &ft->dsunit, &ft->dswidth, - &ft->lsectorsize, &ft->psectorsize, - force_overwrite); + blkid_get_topology(dev->name, dt, force_overwrite); } - if (xi->rt.name && !xi->rt.isfile) { - int sunit, lsectorsize, psectorsize; + ASSERT(dt->logical_sector_size); - blkid_get_topology(xi->rt.name, &sunit, &ft->rtswidth, - &lsectorsize, &psectorsize, force_overwrite); - } + /* + * Older kernels may not have physical/logical distinction. + */ + if (!dt->physical_sector_size) + dt->physical_sector_size = dt->logical_sector_size; +} + +void +get_topology( + struct libxfs_init *xi, + struct fs_topology *ft, + int force_overwrite) +{ + get_device_topology(&xi->data, &ft->data, force_overwrite); + get_device_topology(&xi->rt, &ft->rt, force_overwrite); } diff --git a/libxfs/topology.h b/libxfs/topology.h index 3a309a4dae05..ba0c8f6696a7 100644 --- a/libxfs/topology.h +++ b/libxfs/topology.h @@ -10,12 +10,16 @@ /* * Device topology information. */ +struct device_topology { + int logical_sector_size; /* logical sector size */ + int physical_sector_size; /* physical sector size */ + int sunit; /* stripe unit */ + int swidth; /* stripe width */ +}; + struct fs_topology { - int dsunit; /* stripe unit - data subvolume */ - int dswidth; /* stripe width - data subvolume */ - int rtswidth; /* stripe width - rt subvolume */ - int lsectorsize; /* logical sector size &*/ - int psectorsize; /* physical sector size */ + struct device_topology data; + struct device_topology rt; }; void diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 1a0a71dbec78..79d6eaa37a1a 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1986,31 +1986,24 @@ validate_sectorsize( * than that, then we can use logical, but warn about the * inefficiency. * - * Set the topology sectors if they were not probed to the - * minimum supported sector size. - */ - if (!ft->lsectorsize) - ft->lsectorsize = dft->sectorsize; - - /* - * Older kernels may not have physical/logical distinction. - * * Some architectures have a page size > XFS_MAX_SECTORSIZE. * In that case, a ramdisk or persistent memory device may * advertise a physical sector size that is too big to use. */ - if (!ft->psectorsize || ft->psectorsize > XFS_MAX_SECTORSIZE) - ft->psectorsize = ft->lsectorsize; + if (ft->data.physical_sector_size > XFS_MAX_SECTORSIZE) { + ft->data.physical_sector_size = + ft->data.logical_sector_size; + } - cfg->sectorsize = ft->psectorsize; + cfg->sectorsize = ft->data.physical_sector_size; if (cfg->blocksize < cfg->sectorsize && - cfg->blocksize >= ft->lsectorsize) { + cfg->blocksize >= ft->data.logical_sector_size) { fprintf(stderr, _("specified blocksize %d is less than device physical sector size %d\n" "switching to logical sector size %d\n"), - cfg->blocksize, ft->psectorsize, - ft->lsectorsize); - cfg->sectorsize = ft->lsectorsize; + cfg->blocksize, ft->data.physical_sector_size, + ft->data.logical_sector_size); + cfg->sectorsize = ft->data.logical_sector_size; } } else cfg->sectorsize = cli->sectorsize; @@ -2031,9 +2024,9 @@ _("block size %d cannot be smaller than sector size %d\n"), usage(); } - if (cfg->sectorsize < ft->lsectorsize) { + if (cfg->sectorsize < ft->data.logical_sector_size) { fprintf(stderr, _("illegal sector size %d; hw sector is %d\n"), - cfg->sectorsize, ft->lsectorsize); + cfg->sectorsize, ft->data.logical_sector_size); usage(); } } @@ -2455,7 +2448,7 @@ validate_rtextsize( if (!cfg->sb_feat.nortalign && !cli->xi->rt.isfile && !(!cli->rtsize && cli->xi->data.isfile)) - rswidth = ft->rtswidth; + rswidth = ft->rt.swidth; else rswidth = 0; @@ -2700,13 +2693,14 @@ _("data stripe width (%lld) is too large of a multiple of the data stripe unit ( /* if no stripe config set, use the device default */ if (!dsunit) { /* Ignore nonsense from device report. */ - if (!libxfs_validate_stripe_geometry(NULL, BBTOB(ft->dsunit), - BBTOB(ft->dswidth), 0, true)) { + if (!libxfs_validate_stripe_geometry(NULL, BBTOB(ft->data.sunit), + BBTOB(ft->data.swidth), 0, true)) { fprintf(stderr, _("%s: Volume reports invalid stripe unit (%d) and stripe width (%d), ignoring.\n"), - progname, BBTOB(ft->dsunit), BBTOB(ft->dswidth)); - ft->dsunit = 0; - ft->dswidth = 0; + progname, + BBTOB(ft->data.sunit), BBTOB(ft->data.swidth)); + ft->data.sunit = 0; + ft->data.swidth = 0; } else if (cfg->dblocks < GIGABYTES(1, cfg->blocklog)) { /* * Don't use automatic stripe detection if the device @@ -2714,29 +2708,29 @@ _("%s: Volume reports invalid stripe unit (%d) and stripe width (%d), ignoring.\ * on such a small system are not worth the risk that * we'll end up with an undersized log. */ - if (ft->dsunit || ft->dswidth) + if (ft->data.sunit || ft->data.swidth) fprintf(stderr, _("%s: small data volume, ignoring data volume stripe unit %d and stripe width %d\n"), - progname, ft->dsunit, - ft->dswidth); - ft->dsunit = 0; - ft->dswidth = 0; + progname, ft->data.sunit, + ft->data.swidth); + ft->data.sunit = 0; + ft->data.swidth = 0; } else { - dsunit = ft->dsunit; - dswidth = ft->dswidth; + dsunit = ft->data.sunit; + dswidth = ft->data.swidth; use_dev = true; } } else { /* check and warn if user-specified alignment is sub-optimal */ - if (ft->dsunit && ft->dsunit != dsunit) { + if (ft->data.sunit && ft->data.sunit != dsunit) { fprintf(stderr, _("%s: Specified data stripe unit %d is not the same as the volume stripe unit %d\n"), - progname, dsunit, ft->dsunit); + progname, dsunit, ft->data.sunit); } - if (ft->dswidth && ft->dswidth != dswidth) { + if (ft->data.swidth && ft->data.swidth != dswidth) { fprintf(stderr, _("%s: Specified data stripe width %d is not the same as the volume stripe width %d\n"), - progname, dswidth, ft->dswidth); + progname, dswidth, ft->data.swidth); } } diff --git a/repair/sb.c b/repair/sb.c index faf79d9d0835..4b49c1b33c6c 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -189,7 +189,7 @@ guess_default_geometry( * Use default block size (2^12) */ blocklog = 12; - multidisk = ft.dswidth | ft.dsunit; + multidisk = ft.data.swidth | ft.data.sunit; dblocks = x->data.size >> (blocklog - BBSHIFT); calc_default_ag_geometry(blocklog, dblocks, multidisk, agsize, agcount); From patchwork Wed Mar 13 02:12:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13590914 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD1208BE0 for ; Wed, 13 Mar 2024 02:12:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295924; cv=none; b=k2H92CXVCm3k+M3VjombG3rFl9K8CHBUH6AN2iNE2D7shLck1QhGVwj6qiuFfwSoiGB+rN6/BDxI6LTGbVI+jb/8LaUDK0Pb96pB2Cbjg6vwWtQWpeYGWS4Bg072U9BL5kArsYZiQI7fYKFsGuCqSEt4UfcBmPHxHcSnKInMFTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295924; c=relaxed/simple; bh=UApLG3N24gNFpBPDZjXm2f8cYwfx5F6+c+6oLdKFT9E=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Xi0OMdYsFiiJC2feP7GCe+xgUmLnD+e7CMywauj+V4eVSPGQBYjoDJ+BnDp6+Elbru/iCrUSIuwnSZX3vv/IvesgIAblx48CdmkMz/21D2dfSSX9Efvc+n0mtPRHo7EGUVsN+2uBs06uF2NVUcSGywayhCGW6VwidHF710joWPw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MzxGrehb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MzxGrehb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85644C433C7; Wed, 13 Mar 2024 02:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710295924; bh=UApLG3N24gNFpBPDZjXm2f8cYwfx5F6+c+6oLdKFT9E=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=MzxGrehbFtelE0eXN5cw6k6mErwpUyBFPpI2v1DqzSQ9fwpJM7c1glRX2P/7TZQfc n1tGuio9HGzw5XzQ57+nmeQ2cNeBvAzfNYNp9FnOlmNsT3Tj/1j+0+vM1CHA7IHXpo ywvfimwP1j1nR9kmIGdCxvTEmwO975xOr3sIGIA6OlNNhh+ftvb3u5iggyCMJBY27J jSLNA102UcXw6RW3mJDP3cZPZOYStIFxBjZ6NKXv2xnXdcVTvVEweO2+pDCkvbySXl SfjVpcx/Fmq9Kz4UMxPRSddKq8H9TV+7AYdb4BToaHR1kK6vgP3/LM/fBBVv+u5pN5 xPrKGW28PAtQg== Date: Tue, 12 Mar 2024 19:12:04 -0700 Subject: [PATCH 3/5] libxfs: remove the S_ISREG check from blkid_get_topology From: "Darrick J. Wong" To: djwong@kernel.org, cem@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org Message-ID: <171029433258.2063634.3143875873480142461.stgit@frogsfrogsfrogs> In-Reply-To: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> References: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig The only caller already performs the exact same check. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- libxfs/topology.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libxfs/topology.c b/libxfs/topology.c index 8ae5f7483f96..3a659c2627c7 100644 --- a/libxfs/topology.c +++ b/libxfs/topology.c @@ -181,15 +181,6 @@ blkid_get_topology( { blkid_topology tp; blkid_probe pr; - struct stat statbuf; - - /* can't get topology info from a file */ - if (!stat(device, &statbuf) && S_ISREG(statbuf.st_mode)) { - fprintf(stderr, - _("%s: Warning: trying to probe topology of a file %s!\n"), - progname, device); - return; - } pr = blkid_new_probe_from_filename(device); if (!pr) From patchwork Wed Mar 13 02:12:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13590915 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EB3F8BE0 for ; Wed, 13 Mar 2024 02:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295940; cv=none; b=cHc5fx7nB2KC7kX61N9lif31JHhJDyofyoBmu7nyIKzlA3faJU5mzA+YDFSZyt7U70oY/3gG7cCMA7SSY9dNB5FJo9ysVG0qpkwaSYW/owofhwe0SALu5s6kZ7i7kJIBhuxsn8zPrdG9t18ntYLqkjRQATEe5JxLUEY+it53v0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295940; c=relaxed/simple; bh=DJLUhMkxPWzYHF+hwOFLnmU93sGZKjoO8K6hTVF6hk8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CrNPuHBd1pMHy5DpvjTxoBy7agNNpbEKPEULMjPvyB6n8NkjHdANB+ZBCbdUo3HnuTZUTu2P3jweY5oLi1L39dmK7Xq1G0C1wt4feMMeagia9hw16t7Qok1nt77yrC/5xD+tYc1bB0S5KgiJTV7jCLoPT1U5n3Ks0gSNx9mNFX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U2iQpLFs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U2iQpLFs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2614CC433F1; Wed, 13 Mar 2024 02:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710295940; bh=DJLUhMkxPWzYHF+hwOFLnmU93sGZKjoO8K6hTVF6hk8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=U2iQpLFsH+eB+me7O5cqddsqHNqB45jvy6eNGtG1lQSGAjeHF3IO/lWIIkFubtYd2 aHmvuQB0tDDS7huLjNbeblK2QF/n5wEXJH7n8T1Nl1iqG/pRdl/LGSYAPxaWZh0agx BLmLKuPLK8YzaTS1DPuPOLTNtY6YK1CwIpm7TmD7s9hBrRQYiP86uvpRp7OJcU3i3K egF82PYfaQYYivaQ8lJRK9hHzR1AenKf2O5Jmv12Ct5GFzQ9GZUEF8VrYbL14F0fgA v2+DcBzEaXE9lrdWapdiQwxbyQLPRsSBDFccY5HcTRLKG8PyV65/ETGyS0Xmcjr/oZ DuwTATDsXzwig== Date: Tue, 12 Mar 2024 19:12:19 -0700 Subject: [PATCH 4/5] libxfs: also query log device topology in get_topology From: "Darrick J. Wong" To: djwong@kernel.org, cem@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org Message-ID: <171029433272.2063634.1143746697069724234.stgit@frogsfrogsfrogs> In-Reply-To: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> References: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig Also query the log device topology in get_topology, which we'll need in mkfs in a bit. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- libxfs/topology.c | 1 + libxfs/topology.h | 1 + 2 files changed, 2 insertions(+) diff --git a/libxfs/topology.c b/libxfs/topology.c index 3a659c2627c7..9d34235d0f57 100644 --- a/libxfs/topology.c +++ b/libxfs/topology.c @@ -326,4 +326,5 @@ get_topology( { get_device_topology(&xi->data, &ft->data, force_overwrite); get_device_topology(&xi->rt, &ft->rt, force_overwrite); + get_device_topology(&xi->log, &ft->log, force_overwrite); } diff --git a/libxfs/topology.h b/libxfs/topology.h index ba0c8f6696a7..fa0a23b77386 100644 --- a/libxfs/topology.h +++ b/libxfs/topology.h @@ -20,6 +20,7 @@ struct device_topology { struct fs_topology { struct device_topology data; struct device_topology rt; + struct device_topology log; }; void From patchwork Wed Mar 13 02:12:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13590916 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D0A3F9D9 for ; Wed, 13 Mar 2024 02:12:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295957; cv=none; b=hRCp1goYnwXAjyOzm7uY5N5t/H5WWMyBKk+rO8FpDxnUgtB5uUjeVEpybJTzlBruVA7B6DAuWDqyCT7szJx4+SZzpu4MYQgpMRoAf10hzm8jQzMFZ/Xp805ckOzEWhttlaiRb1DsXfWqDdJEJ03jjHeOKwIk4hnuHj49licRX2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710295957; c=relaxed/simple; bh=dCGvG7vZXDIQZtH5WItLVuOfiq+bgjXs5VwULaZc+EY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kCgOx2z25zuysF93X7fbpRT8n3X4SVckRflrbrcdBpc3KVFi2WHSbmGpqC70ikRaDAq87tuNtddzjqd5CvlqGYwxOaPjmQH6pyC+CWLzIsI75m6t4Ennlve4n75gV1d5qHoOMrbHn9YvwvMnRjzOMF6BvNFhiBfiz5ne/zb1TlM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n6o/YJ4h; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n6o/YJ4h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE019C433F1; Wed, 13 Mar 2024 02:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710295955; bh=dCGvG7vZXDIQZtH5WItLVuOfiq+bgjXs5VwULaZc+EY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=n6o/YJ4hfQ1s7f2bW+HKayqjAx3mqal2N5fGjS1ZGInTobpS9yFbJOOvlCnE1yWfm N1DpYUugn7F5Da+xMMxpKxdVWJ9LR4tfDwHJg4GAksdiEhDi3AooX57R9GrztAVKDy mBXKvJ7KUJUUVRDiGVqO23WTNdn0cGOVeAqDzQ4wxEgLxKeB8M+sbmIks7/If01vRO koMqfO1k3gIPr4qaNhqLq5+ITVYNSWe9FvBZsD9+E7hpKHmoavdkfEP7oWiWtUoh5A 8+oIBygxroRhy93POLKm4gd3/C4pXzXWxwuj1u55i3IUbjeV0ukkcsfazO4C2POAip S67qXtEwPKd7g== Date: Tue, 12 Mar 2024 19:12:35 -0700 Subject: [PATCH 5/5] mkfs: use a sensible log sector size default From: "Darrick J. Wong" To: djwong@kernel.org, cem@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org Message-ID: <171029433287.2063634.15497714444883500861.stgit@frogsfrogsfrogs> In-Reply-To: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> References: <171029433208.2063634.9779947272100308270.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig Currently the XFS log sector size defaults to the 512 bytes unless explicitly overriden. Default to the device logical block size queried by get_topology instead. If that is also 512 nothing changes, and if the device logical block size is larger this prevents a mkfs failure because the libxfs buffer cache blows up and as we obviously can't use a smaller than hardware supported sector size. This fixes xfs/157 with a 4k block size device. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- mkfs/xfs_mkfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 79d6eaa37a1a..18084b1cc6d1 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -2075,7 +2075,8 @@ static void validate_log_sectorsize( struct mkfs_params *cfg, struct cli_params *cli, - struct mkfs_default_params *dft) + struct mkfs_default_params *dft, + struct fs_topology *ft) { if (cli->loginternal && cli->lsectorsize && @@ -2090,7 +2091,7 @@ _("Can't change sector size on internal log!\n")); else if (cli->loginternal) cfg->lsectorsize = cfg->sectorsize; else - cfg->lsectorsize = dft->sectorsize; + cfg->lsectorsize = ft->log.logical_sector_size; cfg->lsectorlog = libxfs_highbit32(cfg->lsectorsize); if (cfg->lsectorsize < XFS_MIN_SECTORSIZE || @@ -4206,7 +4207,7 @@ main( blocksize = cfg.blocksize; sectorsize = cfg.sectorsize; - validate_log_sectorsize(&cfg, &cli, &dft); + validate_log_sectorsize(&cfg, &cli, &dft, &ft); validate_sb_features(&cfg, &cli); /*