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));
}
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
{
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)
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;
/*
{
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;
}
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));
}
/*
{
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;
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);
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;
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)
error);
}
- while (bno < end_bno) {
+ while (bno < mp->m_rsumblocks) {
struct xfs_rtalloc_args args = {
.mp = mp,
.tp = tp,
int i;
int nmap;
int error;
- int nsumblocks;
xfs_fileoff_t bno;
xfs_bmbt_irec_t map[XFS_BMAP_MAX_NMAP];
uint blocks;
/* 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)
* 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"),
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(
return;
check_rtfile_contents(mp, "rtsummary", mp->m_sb.sb_rsumino, sumcompute,
- XFS_B_TO_FSB(mp, mp->m_rsumsize));
+ mp->m_rsumblocks);
}