@@ -1958,7 +1958,7 @@ init(
dbmap[c] = xcalloc(mp->m_sb.sb_rblocks, sizeof(**dbmap));
inomap[c] = xcalloc(mp->m_sb.sb_rblocks, sizeof(**inomap));
- words = mp->m_rsumsize >> XFS_WORDLOG;
+ words = XFS_FSB_TO_B(mp, mp->m_rsumblocks) >> XFS_WORDLOG;
sumfile = xcalloc(words, sizeof(union xfs_suminfo_raw));
sumcompute = xcalloc(words, sizeof(union xfs_suminfo_raw));
}
@@ -50,7 +50,7 @@ typedef struct xfs_mount {
xfs_agnumber_t m_maxagi; /* highest inode alloc group */
struct xfs_ino_geometry m_ino_geo; /* inode geometry */
uint m_rsumlevels; /* rt summary levels */
- uint m_rsumsize; /* size of rt summary, bytes */
+ xfs_filblks_t m_rsumblocks; /* size of rt summary, FSBs */
/*
* Optional cache of rt summary level per bitmap block with the
* invariant that m_rsum_cache[bbno] <= the minimum i for which
@@ -293,7 +293,6 @@ rtmount_init(
{
struct xfs_buf *bp; /* buffer for last block of subvolume */
xfs_daddr_t d; /* address of last block of subvolume */
- unsigned int rsumblocks;
int error;
if (mp->m_sb.sb_rblocks == 0)
@@ -319,9 +318,8 @@ rtmount_init(
return -1;
}
mp->m_rsumlevels = mp->m_sb.sb_rextslog + 1;
- rsumblocks = xfs_rtsummary_blockcount(mp, mp->m_rsumlevels,
+ mp->m_rsumblocks = xfs_rtsummary_blockcount(mp, mp->m_rsumlevels,
mp->m_sb.sb_rbmblocks);
- mp->m_rsumsize = XFS_FSB_TO_B(mp, rsumblocks);
mp->m_rbmip = mp->m_rsumip = NULL;
/*
@@ -160,7 +160,7 @@ xfs_rtsummary_read_buf(
{
struct xfs_mount *mp = args->mp;
- if (XFS_IS_CORRUPT(mp, block >= XFS_B_TO_FSB(mp, mp->m_rsumsize))) {
+ if (XFS_IS_CORRUPT(mp, block >= mp->m_rsumblocks)) {
xfs_rt_mark_sick(args->mp, XFS_SICK_RT_SUMMARY);
return -EFSCORRUPTED;
}
@@ -915,7 +915,7 @@ xfs_calc_growrtfree_reservation(
return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
xfs_calc_inode_res(mp, 2) +
xfs_calc_buf_res(1, mp->m_sb.sb_blocksize) +
- xfs_calc_buf_res(1, mp->m_rsumsize);
+ xfs_calc_buf_res(1, XFS_FSB_TO_B(mp, mp->m_rsumblocks));
}
/*
@@ -813,7 +813,7 @@ rtsummary_create(
{
struct xfs_mount *mp = ip->i_mount;
- ip->i_disk_size = mp->m_rsumsize;
+ ip->i_disk_size = mp->m_rsumblocks * mp->m_sb.sb_blocksize;
mp->m_sb.sb_rsumino = ip->i_ino;
mp->m_rsumip = ip;
@@ -874,25 +874,23 @@ rtsummary_init(
struct xfs_trans *tp;
struct xfs_bmbt_irec *ep;
xfs_fileoff_t bno;
- xfs_extlen_t nsumblocks;
uint blocks;
int i;
int nmap;
int error;
- nsumblocks = mp->m_rsumsize >> mp->m_sb.sb_blocklog;
- blocks = nsumblocks + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1;
+ blocks = mp->m_rsumblocks + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1;
error = -libxfs_trans_alloc_rollable(mp, blocks, &tp);
if (error)
res_failed(error);
libxfs_trans_ijoin(tp, mp->m_rsumip, 0);
bno = 0;
- while (bno < nsumblocks) {
+ while (bno < mp->m_rsumblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, mp->m_rsumip, bno,
- (xfs_extlen_t)(nsumblocks - bno),
- 0, nsumblocks, map, &nmap);
+ (xfs_extlen_t)(mp->m_rsumblocks - bno),
+ 0, mp->m_rsumblocks, map, &nmap);
if (error)
fail(_("Allocation of the realtime summary failed"),
error);
@@ -1736,10 +1736,11 @@ _("realtime bitmap inode %" PRIu64 " has bad size %" PRId64 " (should be %" PRIu
break;
case XR_INO_RTSUM:
- if (size != mp->m_rsumsize) {
+ if (size != XFS_FSB_TO_B(mp, mp->m_rsumblocks)) {
do_warn(
-_("realtime summary inode %" PRIu64 " has bad size %" PRId64 " (should be %d)\n"),
- lino, size, mp->m_rsumsize);
+_("realtime summary inode %" PRIu64 " has bad size %" PRIu64 " (should be %" PRIu64 ")\n"),
+ lino, size,
+ XFS_FSB_TO_B(mp, mp->m_rsumblocks));
return 1;
}
break;
@@ -633,12 +633,10 @@ fill_rsumino(xfs_mount_t *mp)
int nmap;
int error;
xfs_fileoff_t bno;
- xfs_fileoff_t end_bno;
xfs_bmbt_irec_t map;
smp = sumcompute;
bno = 0;
- end_bno = mp->m_rsumsize >> mp->m_sb.sb_blocklog;
error = -libxfs_trans_alloc_rollable(mp, 10, &tp);
if (error)
@@ -651,7 +649,7 @@ fill_rsumino(xfs_mount_t *mp)
error);
}
- while (bno < end_bno) {
+ while (bno < mp->m_rsumblocks) {
struct xfs_rtalloc_args args = {
.mp = mp,
.tp = tp,
@@ -711,7 +709,6 @@ mk_rsumino(xfs_mount_t *mp)
int i;
int nmap;
int error;
- int nsumblocks;
xfs_fileoff_t bno;
xfs_bmbt_irec_t map[XFS_BMAP_MAX_NMAP];
uint blocks;
@@ -732,7 +729,7 @@ mk_rsumino(xfs_mount_t *mp)
/* Reset the rt summary inode. */
reset_sbroot_ino(tp, S_IFREG, ip);
- ip->i_disk_size = mp->m_rsumsize;
+ ip->i_disk_size = mp->m_rsumblocks * mp->m_sb.sb_blocksize;
libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
error = -libxfs_trans_commit(tp);
if (error)
@@ -742,19 +739,18 @@ mk_rsumino(xfs_mount_t *mp)
* then allocate blocks for file and fill with zeroes (stolen
* from mkfs)
*/
- nsumblocks = mp->m_rsumsize >> mp->m_sb.sb_blocklog;
- blocks = nsumblocks + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1;
+ blocks = mp->m_rsumblocks + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1;
error = -libxfs_trans_alloc_rollable(mp, blocks, &tp);
if (error)
res_failed(error);
libxfs_trans_ijoin(tp, ip, 0);
bno = 0;
- while (bno < nsumblocks) {
+ while (bno < mp->m_rsumblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, ip, bno,
- (xfs_extlen_t)(nsumblocks - bno),
- 0, nsumblocks, map, &nmap);
+ (xfs_extlen_t)(mp->m_rsumblocks - bno),
+ 0, mp->m_rsumblocks, map, &nmap);
if (error) {
do_error(
_("couldn't allocate realtime summary inode, error = %d\n"),
@@ -33,7 +33,7 @@ rtinit(xfs_mount_t *mp)
do_error(
_("couldn't allocate memory for incore realtime bitmap.\n"));
- wordcnt = mp->m_rsumsize >> XFS_WORDLOG;
+ wordcnt = XFS_FSB_TO_B(mp, mp->m_rsumblocks) >> XFS_WORDLOG;
sumcompute = calloc(wordcnt, sizeof(union xfs_suminfo_raw));
if (!sumcompute)
do_error(
@@ -228,5 +228,5 @@ check_rtsummary(
return;
check_rtfile_contents(mp, "rtsummary", mp->m_sb.sb_rsumino, sumcompute,
- XFS_B_TO_FSB(mp, mp->m_rsumsize));
+ mp->m_rsumblocks);
}