]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: fix xfs_rtalloc_rec units
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 28 Jun 2018 20:11:57 +0000 (15:11 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 28 Jun 2018 20:11:57 +0000 (15:11 -0500)
Source kernel commit: a0e5c435babd8bb61612d2e4e9b098cacdd825f7

All the realtime allocation functions deal with space on the rtdev in
units of realtime extents.  However, struct xfs_rtalloc_rec confusingly
uses the word 'block' in the name, even though they're really extents.

Fix the naming problem and fix all the unit handling problems in the two
existing users.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/libxfs_priv.h
libxfs/xfs_rtbitmap.c

index 511372b0de7b5ad037b9af7bb3e86342613a8eb5..9829bc88c92abd0456d362dccd2cef008d46dc36 100644 (file)
@@ -554,8 +554,8 @@ int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t);
 bool libxfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
 
 struct xfs_rtalloc_rec {
-       xfs_rtblock_t           ar_startblock;
-       xfs_rtblock_t           ar_blockcount;
+       xfs_rtblock_t           ar_startext;
+       xfs_rtblock_t           ar_extcount;
 };
 
 typedef int (*xfs_rtalloc_query_range_fn)(
index c97ccc68a1716caffd70406793a31e8a5305fbde..abf50617fd5ed5d4eb01a90cbf32605847cd53c9 100644 (file)
@@ -1031,17 +1031,17 @@ xfs_rtalloc_query_range(
        int                             is_free;
        int                             error = 0;
 
-       if (low_rec->ar_startblock > high_rec->ar_startblock)
+       if (low_rec->ar_startext > high_rec->ar_startext)
                return -EINVAL;
-       if (low_rec->ar_startblock >= mp->m_sb.sb_rextents ||
-           low_rec->ar_startblock == high_rec->ar_startblock)
+       if (low_rec->ar_startext >= mp->m_sb.sb_rextents ||
+           low_rec->ar_startext == high_rec->ar_startext)
                return 0;
-       if (high_rec->ar_startblock >= mp->m_sb.sb_rextents)
-               high_rec->ar_startblock = mp->m_sb.sb_rextents - 1;
+       if (high_rec->ar_startext >= mp->m_sb.sb_rextents)
+               high_rec->ar_startext = mp->m_sb.sb_rextents - 1;
 
        /* Iterate the bitmap, looking for discrepancies. */
-       rtstart = low_rec->ar_startblock;
-       rem = high_rec->ar_startblock - rtstart;
+       rtstart = low_rec->ar_startext;
+       rem = high_rec->ar_startext - rtstart;
        while (rem) {
                /* Is the first block free? */
                error = xfs_rtcheck_range(mp, tp, rtstart, 1, 1, &rtend,
@@ -1051,13 +1051,13 @@ xfs_rtalloc_query_range(
 
                /* How long does the extent go for? */
                error = xfs_rtfind_forw(mp, tp, rtstart,
-                               high_rec->ar_startblock - 1, &rtend);
+                               high_rec->ar_startext - 1, &rtend);
                if (error)
                        break;
 
                if (is_free) {
-                       rec.ar_startblock = rtstart;
-                       rec.ar_blockcount = rtend - rtstart + 1;
+                       rec.ar_startext = rtstart;
+                       rec.ar_extcount = rtend - rtstart + 1;
 
                        error = fn(tp, &rec, priv);
                        if (error)
@@ -1080,9 +1080,9 @@ xfs_rtalloc_query_all(
 {
        struct xfs_rtalloc_rec          keys[2];
 
-       keys[0].ar_startblock = 0;
-       keys[1].ar_startblock = tp->t_mountp->m_sb.sb_rextents - 1;
-       keys[0].ar_blockcount = keys[1].ar_blockcount = 0;
+       keys[0].ar_startext = 0;
+       keys[1].ar_startext = tp->t_mountp->m_sb.sb_rextents - 1;
+       keys[0].ar_extcount = keys[1].ar_extcount = 0;
 
        return xfs_rtalloc_query_range(tp, &keys[0], &keys[1], fn, priv);
 }