Lines Matching refs:mp
28 struct xfs_mount *mp, in xfs_get_aghdr_buf() argument
37 error = xfs_buf_get_uncached(mp->m_ddev_targp, numblks, 0, &bp); in xfs_get_aghdr_buf()
50 static inline bool is_log_ag(struct xfs_mount *mp, struct aghdr_init_data *id) in is_log_ag() argument
52 return mp->m_sb.sb_logstart > 0 && in is_log_ag()
53 id->agno == XFS_FSB_TO_AGNO(mp, mp->m_sb.sb_logstart); in is_log_ag()
61 struct xfs_mount *mp, in xfs_btroot_init() argument
65 xfs_btree_init_block(mp, bp, id->type, 0, 0, id->agno); in xfs_btroot_init()
71 struct xfs_mount *mp, in xfs_freesp_init_recs() argument
78 arec = XFS_ALLOC_REC_ADDR(mp, XFS_BUF_TO_BLOCK(bp), 1); in xfs_freesp_init_recs()
79 arec->ar_startblock = cpu_to_be32(mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
81 if (is_log_ag(mp, id)) { in xfs_freesp_init_recs()
83 xfs_agblock_t start = XFS_FSB_TO_AGBNO(mp, in xfs_freesp_init_recs()
84 mp->m_sb.sb_logstart); in xfs_freesp_init_recs()
86 ASSERT(start >= mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
87 if (start != mp->m_ag_prealloc_blocks) { in xfs_freesp_init_recs()
92 mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
108 be32_add_cpu(&arec->ar_startblock, mp->m_sb.sb_logblocks); in xfs_freesp_init_recs()
128 struct xfs_mount *mp, in xfs_bnoroot_init() argument
132 xfs_btree_init_block(mp, bp, XFS_BTNUM_BNO, 0, 1, id->agno); in xfs_bnoroot_init()
133 xfs_freesp_init_recs(mp, bp, id); in xfs_bnoroot_init()
138 struct xfs_mount *mp, in xfs_cntroot_init() argument
142 xfs_btree_init_block(mp, bp, XFS_BTNUM_CNT, 0, 1, id->agno); in xfs_cntroot_init()
143 xfs_freesp_init_recs(mp, bp, id); in xfs_cntroot_init()
151 struct xfs_mount *mp, in xfs_rmaproot_init() argument
158 xfs_btree_init_block(mp, bp, XFS_BTNUM_RMAP, 0, 4, id->agno); in xfs_rmaproot_init()
171 rrec->rm_blockcount = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_rmaproot_init()
177 rrec->rm_startblock = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_rmaproot_init()
184 rrec->rm_startblock = cpu_to_be32(XFS_IBT_BLOCK(mp)); in xfs_rmaproot_init()
185 rrec->rm_blockcount = cpu_to_be32(XFS_RMAP_BLOCK(mp) - in xfs_rmaproot_init()
186 XFS_IBT_BLOCK(mp)); in xfs_rmaproot_init()
192 rrec->rm_startblock = cpu_to_be32(XFS_RMAP_BLOCK(mp)); in xfs_rmaproot_init()
198 if (xfs_sb_version_hasreflink(&mp->m_sb)) { in xfs_rmaproot_init()
200 rrec->rm_startblock = cpu_to_be32(xfs_refc_block(mp)); in xfs_rmaproot_init()
208 if (is_log_ag(mp, id)) { in xfs_rmaproot_init()
212 XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart)); in xfs_rmaproot_init()
213 rrec->rm_blockcount = cpu_to_be32(mp->m_sb.sb_logblocks); in xfs_rmaproot_init()
230 struct xfs_mount *mp, in xfs_sbblock_init() argument
236 xfs_sb_to_disk(dsb, &mp->m_sb); in xfs_sbblock_init()
242 struct xfs_mount *mp, in xfs_agfblock_init() argument
253 agf->agf_roots[XFS_BTNUM_BNOi] = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_agfblock_init()
254 agf->agf_roots[XFS_BTNUM_CNTi] = cpu_to_be32(XFS_CNT_BLOCK(mp)); in xfs_agfblock_init()
257 if (xfs_sb_version_hasrmapbt(&mp->m_sb)) { in xfs_agfblock_init()
259 cpu_to_be32(XFS_RMAP_BLOCK(mp)); in xfs_agfblock_init()
267 tmpsize = id->agsize - mp->m_ag_prealloc_blocks; in xfs_agfblock_init()
270 if (xfs_sb_version_hascrc(&mp->m_sb)) in xfs_agfblock_init()
271 uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agfblock_init()
272 if (xfs_sb_version_hasreflink(&mp->m_sb)) { in xfs_agfblock_init()
274 xfs_refc_block(mp)); in xfs_agfblock_init()
279 if (is_log_ag(mp, id)) { in xfs_agfblock_init()
280 int64_t logblocks = mp->m_sb.sb_logblocks; in xfs_agfblock_init()
284 XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart) - logblocks); in xfs_agfblock_init()
290 struct xfs_mount *mp, in xfs_agflblock_init() argument
298 if (xfs_sb_version_hascrc(&mp->m_sb)) { in xfs_agflblock_init()
301 uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agflblock_init()
305 for (bucket = 0; bucket < xfs_agfl_size(mp); bucket++) in xfs_agflblock_init()
311 struct xfs_mount *mp, in xfs_agiblock_init() argument
323 agi->agi_root = cpu_to_be32(XFS_IBT_BLOCK(mp)); in xfs_agiblock_init()
328 if (xfs_sb_version_hascrc(&mp->m_sb)) in xfs_agiblock_init()
329 uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agiblock_init()
330 if (xfs_sb_version_hasfinobt(&mp->m_sb)) { in xfs_agiblock_init()
331 agi->agi_free_root = cpu_to_be32(XFS_FIBT_BLOCK(mp)); in xfs_agiblock_init()
336 if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) { in xfs_agiblock_init()
338 if (xfs_sb_version_hasfinobt(&mp->m_sb)) in xfs_agiblock_init()
343 typedef void (*aghdr_init_work_f)(struct xfs_mount *mp, struct xfs_buf *bp,
347 struct xfs_mount *mp, in xfs_ag_init_hdr() argument
355 error = xfs_get_aghdr_buf(mp, id->daddr, id->numblks, &bp, ops); in xfs_ag_init_hdr()
359 (*work)(mp, bp, id); in xfs_ag_init_hdr()
387 struct xfs_mount *mp, in xfs_ag_init_headers() argument
393 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_SB_DADDR), in xfs_ag_init_headers()
394 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
400 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGF_DADDR(mp)), in xfs_ag_init_headers()
401 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
407 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGFL_DADDR(mp)), in xfs_ag_init_headers()
408 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
414 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGI_DADDR(mp)), in xfs_ag_init_headers()
415 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
421 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_BNO_BLOCK(mp)), in xfs_ag_init_headers()
422 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
428 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_CNT_BLOCK(mp)), in xfs_ag_init_headers()
429 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
435 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_IBT_BLOCK(mp)), in xfs_ag_init_headers()
436 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
443 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_FIBT_BLOCK(mp)), in xfs_ag_init_headers()
444 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
448 .need_init = xfs_sb_version_hasfinobt(&mp->m_sb) in xfs_ag_init_headers()
451 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_RMAP_BLOCK(mp)), in xfs_ag_init_headers()
452 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
455 .need_init = xfs_sb_version_hasrmapbt(&mp->m_sb) in xfs_ag_init_headers()
458 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, xfs_refc_block(mp)), in xfs_ag_init_headers()
459 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
463 .need_init = xfs_sb_version_hasreflink(&mp->m_sb) in xfs_ag_init_headers()
473 id->nfree += id->agsize - mp->m_ag_prealloc_blocks; in xfs_ag_init_headers()
481 error = xfs_ag_init_hdr(mp, id, dp->work, dp->ops); in xfs_ag_init_headers()
493 struct xfs_mount *mp, in xfs_ag_extend_space() argument
506 error = xfs_ialloc_read_agi(mp, tp, id->agno, &bp); in xfs_ag_extend_space()
512 ASSERT(id->agno == mp->m_sb.sb_agcount - 1 || in xfs_ag_extend_space()
513 be32_to_cpu(agi->agi_length) == mp->m_sb.sb_agblocks); in xfs_ag_extend_space()
519 error = xfs_alloc_read_agf(mp, tp, id->agno, 0, &bp); in xfs_ag_extend_space()
540 return xfs_free_extent(tp, XFS_AGB_TO_FSB(mp, id->agno, in xfs_ag_extend_space()
549 struct xfs_mount *mp, in xfs_ag_get_geometry() argument
561 if (agno >= mp->m_sb.sb_agcount) in xfs_ag_get_geometry()
565 error = xfs_ialloc_read_agi(mp, NULL, agno, &agi_bp); in xfs_ag_get_geometry()
568 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agf_bp); in xfs_ag_get_geometry()