diff mbox series

[45/45] xfs_growfs: support internal RT devices

Message ID 20250409075557.3535745-46-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/45] xfs: generalize the freespace and reserved blocks handling | expand

Commit Message

Christoph Hellwig April 9, 2025, 7:55 a.m. UTC
Allow RT growfs when rtstart is set in the geomety, and adjust the
queried size for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 growfs/xfs_growfs.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Darrick J. Wong April 9, 2025, 7:35 p.m. UTC | #1
On Wed, Apr 09, 2025 at 09:55:48AM +0200, Christoph Hellwig wrote:
> Allow RT growfs when rtstart is set in the geomety, and adjust the
> queried size for it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Seems fine to me...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  growfs/xfs_growfs.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
> index 4b941403e2fd..0d0b2ae3e739 100644
> --- a/growfs/xfs_growfs.c
> +++ b/growfs/xfs_growfs.c
> @@ -202,7 +202,7 @@ main(int argc, char **argv)
>  			progname, fname);
>  		exit(1);
>  	}
> -	if (rflag && !xi.rt.dev) {
> +	if (rflag && (!xi.rt.dev && !geo.rtstart)) {
>  		fprintf(stderr,
>  			_("%s: failed to access realtime device for %s\n"),
>  			progname, fname);
> @@ -211,6 +211,13 @@ main(int argc, char **argv)
>  
>  	xfs_report_geom(&geo, datadev, logdev, rtdev);
>  
> +	if (geo.rtstart) {
> +		xfs_daddr_t rtstart = geo.rtstart * (geo.blocksize / BBSIZE);
> +
> +		xi.rt.size = xi.data.size - rtstart;
> +		xi.data.size = rtstart;
> +	}
> +
>  	ddsize = xi.data.size;
>  	dlsize = (xi.log.size ? xi.log.size :
>  			geo.logblocks * (geo.blocksize / BBSIZE) );
> -- 
> 2.47.2
> 
>
diff mbox series

Patch

diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
index 4b941403e2fd..0d0b2ae3e739 100644
--- a/growfs/xfs_growfs.c
+++ b/growfs/xfs_growfs.c
@@ -202,7 +202,7 @@  main(int argc, char **argv)
 			progname, fname);
 		exit(1);
 	}
-	if (rflag && !xi.rt.dev) {
+	if (rflag && (!xi.rt.dev && !geo.rtstart)) {
 		fprintf(stderr,
 			_("%s: failed to access realtime device for %s\n"),
 			progname, fname);
@@ -211,6 +211,13 @@  main(int argc, char **argv)
 
 	xfs_report_geom(&geo, datadev, logdev, rtdev);
 
+	if (geo.rtstart) {
+		xfs_daddr_t rtstart = geo.rtstart * (geo.blocksize / BBSIZE);
+
+		xi.rt.size = xi.data.size - rtstart;
+		xi.data.size = rtstart;
+	}
+
 	ddsize = xi.data.size;
 	dlsize = (xi.log.size ? xi.log.size :
 			geo.logblocks * (geo.blocksize / BBSIZE) );