]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: convert xfs_extlen_t to xfs_rtxlen_t in the rt allocator
authorDarrick J. Wong <djwong@kernel.org>
Mon, 12 Feb 2024 14:13:20 +0000 (15:13 +0100)
committerCarlos Maiolino <cem@kernel.org>
Thu, 15 Feb 2024 11:56:43 +0000 (12:56 +0100)
Source kernel commit: a684c538bc14410565e8939393089670fa1e19dd

In most of the filesystem, we use xfs_extlen_t to store the length of a
file (or AG) space mapping in units of fs blocks.  Unfortunately, the
realtime allocator also uses it to store the length of a rt space
mapping in units of rt extents.  This is confusing, since one rt extent
can consist of many fs blocks.

Separate the two by introducing a new type (xfs_rtxlen_t) to store the
length of a space mapping (in units of realtime extents) that would be
found in a file.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_rtbitmap.c
libxfs/xfs_rtbitmap.h
libxfs/xfs_types.h

index bd0925c9a0061d5a0c34ad26d28f062e4ad5e6e0..976b1aca6903381545ec2f3c5bede31fdd02da49 100644 (file)
@@ -532,7 +532,7 @@ xfs_rtmodify_range(
        xfs_mount_t     *mp,            /* file system mount point */
        xfs_trans_t     *tp,            /* transaction pointer */
        xfs_rtblock_t   start,          /* starting block to modify */
-       xfs_extlen_t    len,            /* length of extent to modify */
+       xfs_rtxlen_t    len,            /* length of extent to modify */
        int             val)            /* 1 for free, 0 for allocated */
 {
        xfs_rtword_t    *b;             /* current word in buffer */
@@ -688,7 +688,7 @@ xfs_rtfree_range(
        xfs_mount_t     *mp,            /* file system mount point */
        xfs_trans_t     *tp,            /* transaction pointer */
        xfs_rtblock_t   start,          /* starting block to free */
-       xfs_extlen_t    len,            /* length to free */
+       xfs_rtxlen_t    len,            /* length to free */
        struct xfs_buf  **rbpp,         /* in/out: summary block buffer */
        xfs_fsblock_t   *rsb)           /* in/out: summary block number */
 {
@@ -764,7 +764,7 @@ xfs_rtcheck_range(
        xfs_mount_t     *mp,            /* file system mount point */
        xfs_trans_t     *tp,            /* transaction pointer */
        xfs_rtblock_t   start,          /* starting block number of extent */
-       xfs_extlen_t    len,            /* length of extent */
+       xfs_rtxlen_t    len,            /* length of extent */
        int             val,            /* 1 for free, 0 for allocated */
        xfs_rtblock_t   *new,           /* out: first block not matching */
        int             *stat)          /* out: 1 for matches, 0 for not */
@@ -940,7 +940,7 @@ xfs_rtcheck_alloc_range(
        xfs_mount_t     *mp,            /* file system mount point */
        xfs_trans_t     *tp,            /* transaction pointer */
        xfs_rtblock_t   bno,            /* starting block number of extent */
-       xfs_extlen_t    len)            /* length of extent */
+       xfs_rtxlen_t    len)            /* length of extent */
 {
        xfs_rtblock_t   new;            /* dummy for xfs_rtcheck_range */
        int             stat;
@@ -963,7 +963,7 @@ int                                 /* error */
 xfs_rtfree_extent(
        xfs_trans_t     *tp,            /* transaction pointer */
        xfs_rtblock_t   bno,            /* starting block number to free */
-       xfs_extlen_t    len)            /* length of extent freed */
+       xfs_rtxlen_t    len)            /* length of extent freed */
 {
        int             error;          /* error value */
        xfs_mount_t     *mp;            /* file system mount structure */
@@ -1114,7 +1114,7 @@ xfs_rtalloc_extent_is_free(
        struct xfs_mount                *mp,
        struct xfs_trans                *tp,
        xfs_rtblock_t                   start,
-       xfs_extlen_t                    len,
+       xfs_rtxlen_t                    len,
        bool                            *is_free)
 {
        xfs_rtblock_t                   end;
index 546dea34bb37c043b9bc3b7f16abde0ae2285209..d4449610154a8ef892cce084bf5f9f40217f2c23 100644 (file)
@@ -26,7 +26,7 @@ typedef int (*xfs_rtalloc_query_range_fn)(
 int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp,
                  xfs_rtblock_t block, int issum, struct xfs_buf **bpp);
 int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp,
-                     xfs_rtblock_t start, xfs_extlen_t len, int val,
+                     xfs_rtblock_t start, xfs_rtxlen_t len, int val,
                      xfs_rtblock_t *new, int *stat);
 int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp,
                    xfs_rtblock_t start, xfs_rtblock_t limit,
@@ -35,7 +35,7 @@ int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp,
                    xfs_rtblock_t start, xfs_rtblock_t limit,
                    xfs_rtblock_t *rtblock);
 int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp,
-                      xfs_rtblock_t start, xfs_extlen_t len, int val);
+                      xfs_rtblock_t start, xfs_rtxlen_t len, int val);
 int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp,
                             int log, xfs_rtblock_t bbno, int delta,
                             struct xfs_buf **rbpp, xfs_fsblock_t *rsb,
@@ -44,7 +44,7 @@ int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
                         xfs_rtblock_t bbno, int delta, struct xfs_buf **rbpp,
                         xfs_fsblock_t *rsb);
 int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
-                    xfs_rtblock_t start, xfs_extlen_t len,
+                    xfs_rtblock_t start, xfs_rtxlen_t len,
                     struct xfs_buf **rbpp, xfs_fsblock_t *rsb);
 int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
                const struct xfs_rtalloc_rec *low_rec,
@@ -53,9 +53,8 @@ int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
 int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp,
                          xfs_rtalloc_query_range_fn fn,
                          void *priv);
-bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
 int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp,
-                              xfs_rtblock_t start, xfs_extlen_t len,
+                              xfs_rtblock_t start, xfs_rtxlen_t len,
                               bool *is_free);
 /*
  * Free an extent in the realtime subvolume.  Length is expressed in
@@ -65,7 +64,7 @@ int                                   /* error */
 xfs_rtfree_extent(
        struct xfs_trans        *tp,    /* transaction pointer */
        xfs_rtblock_t           bno,    /* starting block number to free */
-       xfs_extlen_t            len);   /* length of extent freed */
+       xfs_rtxlen_t            len);   /* length of extent freed */
 
 /* Same as above, but in units of rt blocks. */
 int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno,
index 851220021484177e969ec4b08ae96582d708abcc..713cb70311efaf839ae9df87c0c2e2b89edd50df 100644 (file)
@@ -11,6 +11,7 @@ typedef uint32_t      prid_t;         /* project ID */
 typedef uint32_t       xfs_agblock_t;  /* blockno in alloc. group */
 typedef uint32_t       xfs_agino_t;    /* inode # within allocation grp */
 typedef uint32_t       xfs_extlen_t;   /* extent length in blocks */
+typedef uint32_t       xfs_rtxlen_t;   /* file extent length in rtextents */
 typedef uint32_t       xfs_agnumber_t; /* allocation group number */
 typedef uint64_t       xfs_extnum_t;   /* # of extents in a file */
 typedef uint32_t       xfs_aextnum_t;  /* # extents in an attribute fork */