aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_rtalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
-rw-r--r--fs/xfs/xfs_rtalloc.c110
1 files changed, 1 insertions, 109 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 880c73271c05..6fff19dc3cf9 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -147,7 +147,7 @@ xfs_growfs_rt_alloc(
147 /* 147 /*
148 * Free any blocks freed up in the transaction, then commit. 148 * Free any blocks freed up in the transaction, then commit.
149 */ 149 */
150 error = xfs_bmap_finish(&tp, &flist, firstblock, &committed); 150 error = xfs_bmap_finish(&tp, &flist, &committed);
151 if (error) 151 if (error)
152 goto error_exit; 152 goto error_exit;
153 xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); 153 xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL);
@@ -913,57 +913,6 @@ xfs_rtcheck_alloc_range(
913} 913}
914#endif 914#endif
915 915
916#ifdef DEBUG
917/*
918 * Check whether the given block in the bitmap has the given value.
919 */
920STATIC int /* 1 for matches, 0 for not */
921xfs_rtcheck_bit(
922 xfs_mount_t *mp, /* file system mount structure */
923 xfs_trans_t *tp, /* transaction pointer */
924 xfs_rtblock_t start, /* bit (block) to check */
925 int val) /* 1 for free, 0 for allocated */
926{
927 int bit; /* bit number in the word */
928 xfs_rtblock_t block; /* bitmap block number */
929 xfs_buf_t *bp; /* buf for the block */
930 xfs_rtword_t *bufp; /* pointer into the buffer */
931 /* REFERENCED */
932 int error; /* error value */
933 xfs_rtword_t wdiff; /* difference between bit & expected */
934 int word; /* word number in the buffer */
935 xfs_rtword_t wval; /* word value from buffer */
936
937 block = XFS_BITTOBLOCK(mp, start);
938 error = xfs_rtbuf_get(mp, tp, block, 0, &bp);
939 bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp);
940 word = XFS_BITTOWORD(mp, start);
941 bit = (int)(start & (XFS_NBWORD - 1));
942 wval = bufp[word];
943 xfs_trans_brelse(tp, bp);
944 wdiff = (wval ^ -val) & ((xfs_rtword_t)1 << bit);
945 return !wdiff;
946}
947#endif /* DEBUG */
948
949#if 0
950/*
951 * Check that the given extent (block range) is free already.
952 */
953STATIC int /* error */
954xfs_rtcheck_free_range(
955 xfs_mount_t *mp, /* file system mount point */
956 xfs_trans_t *tp, /* transaction pointer */
957 xfs_rtblock_t bno, /* starting block number of extent */
958 xfs_extlen_t len, /* length of extent */
959 int *stat) /* out: 1 for free, 0 for not */
960{
961 xfs_rtblock_t new; /* dummy for xfs_rtcheck_range */
962
963 return xfs_rtcheck_range(mp, tp, bno, len, 1, &new, stat);
964}
965#endif
966
967/* 916/*
968 * Check that the given range is either all allocated (val = 0) or 917 * Check that the given range is either all allocated (val = 0) or
969 * all free (val = 1). 918 * all free (val = 1).
@@ -2382,60 +2331,3 @@ xfs_rtpick_extent(
2382 *pick = b; 2331 *pick = b;
2383 return 0; 2332 return 0;
2384} 2333}
2385
2386#ifdef DEBUG
2387/*
2388 * Debug code: print out the value of a range in the bitmap.
2389 */
2390void
2391xfs_rtprint_range(
2392 xfs_mount_t *mp, /* file system mount structure */
2393 xfs_trans_t *tp, /* transaction pointer */
2394 xfs_rtblock_t start, /* starting block to print */
2395 xfs_extlen_t len) /* length to print */
2396{
2397 xfs_extlen_t i; /* block number in the extent */
2398
2399 cmn_err(CE_DEBUG, "%Ld: ", (long long)start);
2400 for (i = 0; i < len; i++)
2401 cmn_err(CE_DEBUG, "%d", xfs_rtcheck_bit(mp, tp, start + i, 1));
2402 cmn_err(CE_DEBUG, "\n");
2403}
2404
2405/*
2406 * Debug code: print the summary file.
2407 */
2408void
2409xfs_rtprint_summary(
2410 xfs_mount_t *mp, /* file system mount structure */
2411 xfs_trans_t *tp) /* transaction pointer */
2412{
2413 xfs_suminfo_t c; /* summary data */
2414 xfs_rtblock_t i; /* bitmap block number */
2415 int l; /* summary information level */
2416 int p; /* flag for printed anything */
2417 xfs_fsblock_t sb; /* summary block number */
2418 xfs_buf_t *sumbp; /* summary block buffer */
2419
2420 sumbp = NULL;
2421 for (l = 0; l < mp->m_rsumlevels; l++) {
2422 for (p = 0, i = 0; i < mp->m_sb.sb_rbmblocks; i++) {
2423 (void)xfs_rtget_summary(mp, tp, l, i, &sumbp, &sb, &c);
2424 if (c) {
2425 if (!p) {
2426 cmn_err(CE_DEBUG, "%Ld-%Ld:", 1LL << l,
2427 XFS_RTMIN((1LL << l) +
2428 ((1LL << l) - 1LL),
2429 mp->m_sb.sb_rextents));
2430 p = 1;
2431 }
2432 cmn_err(CE_DEBUG, " %Ld:%d", (long long)i, c);
2433 }
2434 }
2435 if (p)
2436 cmn_err(CE_DEBUG, "\n");
2437 }
2438 if (sumbp)
2439 xfs_trans_brelse(tp, sumbp);
2440}
2441#endif /* DEBUG */