Lines Matching full:mp

43 	struct xfs_mount	*mp,  in xfs_perag_get()  argument
50 pag = radix_tree_lookup(&mp->m_perag_tree, agno); in xfs_perag_get()
56 trace_xfs_perag_get(mp, agno, ref, _RET_IP_); in xfs_perag_get()
65 struct xfs_mount *mp, in xfs_perag_get_tag() argument
74 found = radix_tree_gang_lookup_tag(&mp->m_perag_tree, in xfs_perag_get_tag()
82 trace_xfs_perag_get_tag(mp, pag->pag_agno, ref, _RET_IP_); in xfs_perag_get_tag()
107 struct xfs_mount *mp, in xfs_initialize_perag_data() argument
112 struct xfs_sb *sbp = &mp->m_sb; in xfs_initialize_perag_data()
126 pag = xfs_perag_get(mp, index); in xfs_initialize_perag_data()
151 xfs_alert(mp, "AGF corruption. Please run xfs_repair."); in xfs_initialize_perag_data()
157 spin_lock(&mp->m_sb_lock); in xfs_initialize_perag_data()
161 spin_unlock(&mp->m_sb_lock); in xfs_initialize_perag_data()
163 xfs_reinit_percpu_counters(mp); in xfs_initialize_perag_data()
165 xfs_fs_mark_healthy(mp, XFS_SICK_FS_COUNTERS); in xfs_initialize_perag_data()
184 struct xfs_mount *mp) in xfs_free_perag() argument
189 for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) { in xfs_free_perag()
190 spin_lock(&mp->m_perag_lock); in xfs_free_perag()
191 pag = radix_tree_delete(&mp->m_perag_tree, agno); in xfs_free_perag()
192 spin_unlock(&mp->m_perag_lock); in xfs_free_perag()
206 struct xfs_mount *mp, in __xfs_ag_block_count() argument
214 return mp->m_sb.sb_agblocks; in __xfs_ag_block_count()
215 return dblocks - (agno * mp->m_sb.sb_agblocks); in __xfs_ag_block_count()
220 struct xfs_mount *mp, in xfs_ag_block_count() argument
223 return __xfs_ag_block_count(mp, agno, mp->m_sb.sb_agcount, in xfs_ag_block_count()
224 mp->m_sb.sb_dblocks); in xfs_ag_block_count()
230 struct xfs_mount *mp, in __xfs_agino_range() argument
241 bno = round_up(XFS_AGFL_BLOCK(mp) + 1, M_IGEO(mp)->cluster_align); in __xfs_agino_range()
242 *first = XFS_AGB_TO_AGINO(mp, bno); in __xfs_agino_range()
248 bno = round_down(eoag, M_IGEO(mp)->cluster_align); in __xfs_agino_range()
249 *last = XFS_AGB_TO_AGINO(mp, bno) - 1; in __xfs_agino_range()
254 struct xfs_mount *mp, in xfs_agino_range() argument
259 return __xfs_agino_range(mp, xfs_ag_block_count(mp, agno), first, last); in xfs_agino_range()
264 struct xfs_mount *mp, in xfs_initialize_perag() argument
280 pag = xfs_perag_get(mp, index); in xfs_initialize_perag()
292 pag->pag_mount = mp; in xfs_initialize_perag()
298 spin_lock(&mp->m_perag_lock); in xfs_initialize_perag()
299 if (radix_tree_insert(&mp->m_perag_tree, index, pag)) { in xfs_initialize_perag()
301 spin_unlock(&mp->m_perag_lock); in xfs_initialize_perag()
306 spin_unlock(&mp->m_perag_lock); in xfs_initialize_perag()
332 pag->block_count = __xfs_ag_block_count(mp, index, agcount, in xfs_initialize_perag()
334 pag->min_block = XFS_AGFL_BLOCK(mp); in xfs_initialize_perag()
335 __xfs_agino_range(mp, pag->block_count, &pag->agino_min, in xfs_initialize_perag()
339 index = xfs_set_inode_alloc(mp, agcount); in xfs_initialize_perag()
344 mp->m_ag_prealloc_blocks = xfs_prealloc_blocks(mp); in xfs_initialize_perag()
348 radix_tree_delete(&mp->m_perag_tree, index); in xfs_initialize_perag()
354 pag = radix_tree_delete(&mp->m_perag_tree, index); in xfs_initialize_perag()
365 struct xfs_mount *mp, in xfs_get_aghdr_buf() argument
374 error = xfs_buf_get_uncached(mp->m_ddev_targp, numblks, 0, &bp); in xfs_get_aghdr_buf()
390 struct xfs_mount *mp, in xfs_btroot_init() argument
394 xfs_btree_init_block(mp, bp, id->type, 0, 0, id->agno); in xfs_btroot_init()
400 struct xfs_mount *mp, in xfs_freesp_init_recs() argument
407 arec = XFS_ALLOC_REC_ADDR(mp, XFS_BUF_TO_BLOCK(bp), 1); in xfs_freesp_init_recs()
408 arec->ar_startblock = cpu_to_be32(mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
410 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_freesp_init_recs()
412 xfs_agblock_t start = XFS_FSB_TO_AGBNO(mp, in xfs_freesp_init_recs()
413 mp->m_sb.sb_logstart); in xfs_freesp_init_recs()
415 ASSERT(start >= mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
416 if (start != mp->m_ag_prealloc_blocks) { in xfs_freesp_init_recs()
421 mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
437 be32_add_cpu(&arec->ar_startblock, mp->m_sb.sb_logblocks); in xfs_freesp_init_recs()
457 struct xfs_mount *mp, in xfs_bnoroot_init() argument
461 xfs_btree_init_block(mp, bp, XFS_BTNUM_BNO, 0, 1, id->agno); in xfs_bnoroot_init()
462 xfs_freesp_init_recs(mp, bp, id); in xfs_bnoroot_init()
467 struct xfs_mount *mp, in xfs_cntroot_init() argument
471 xfs_btree_init_block(mp, bp, XFS_BTNUM_CNT, 0, 1, id->agno); in xfs_cntroot_init()
472 xfs_freesp_init_recs(mp, bp, id); in xfs_cntroot_init()
480 struct xfs_mount *mp, in xfs_rmaproot_init() argument
487 xfs_btree_init_block(mp, bp, XFS_BTNUM_RMAP, 0, 4, id->agno); in xfs_rmaproot_init()
500 rrec->rm_blockcount = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_rmaproot_init()
506 rrec->rm_startblock = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_rmaproot_init()
513 rrec->rm_startblock = cpu_to_be32(XFS_IBT_BLOCK(mp)); in xfs_rmaproot_init()
514 rrec->rm_blockcount = cpu_to_be32(XFS_RMAP_BLOCK(mp) - in xfs_rmaproot_init()
515 XFS_IBT_BLOCK(mp)); in xfs_rmaproot_init()
521 rrec->rm_startblock = cpu_to_be32(XFS_RMAP_BLOCK(mp)); in xfs_rmaproot_init()
527 if (xfs_has_reflink(mp)) { in xfs_rmaproot_init()
529 rrec->rm_startblock = cpu_to_be32(xfs_refc_block(mp)); in xfs_rmaproot_init()
537 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_rmaproot_init()
541 XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart)); in xfs_rmaproot_init()
542 rrec->rm_blockcount = cpu_to_be32(mp->m_sb.sb_logblocks); in xfs_rmaproot_init()
559 struct xfs_mount *mp, in xfs_sbblock_init() argument
565 xfs_sb_to_disk(dsb, &mp->m_sb); in xfs_sbblock_init()
571 struct xfs_mount *mp, in xfs_agfblock_init() argument
582 agf->agf_roots[XFS_BTNUM_BNOi] = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_agfblock_init()
583 agf->agf_roots[XFS_BTNUM_CNTi] = cpu_to_be32(XFS_CNT_BLOCK(mp)); in xfs_agfblock_init()
586 if (xfs_has_rmapbt(mp)) { in xfs_agfblock_init()
588 cpu_to_be32(XFS_RMAP_BLOCK(mp)); in xfs_agfblock_init()
596 tmpsize = id->agsize - mp->m_ag_prealloc_blocks; in xfs_agfblock_init()
599 if (xfs_has_crc(mp)) in xfs_agfblock_init()
600 uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agfblock_init()
601 if (xfs_has_reflink(mp)) { in xfs_agfblock_init()
603 xfs_refc_block(mp)); in xfs_agfblock_init()
608 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_agfblock_init()
609 int64_t logblocks = mp->m_sb.sb_logblocks; in xfs_agfblock_init()
613 XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart) - logblocks); in xfs_agfblock_init()
619 struct xfs_mount *mp, in xfs_agflblock_init() argument
627 if (xfs_has_crc(mp)) { in xfs_agflblock_init()
630 uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agflblock_init()
634 for (bucket = 0; bucket < xfs_agfl_size(mp); bucket++) in xfs_agflblock_init()
640 struct xfs_mount *mp, in xfs_agiblock_init() argument
652 agi->agi_root = cpu_to_be32(XFS_IBT_BLOCK(mp)); in xfs_agiblock_init()
657 if (xfs_has_crc(mp)) in xfs_agiblock_init()
658 uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agiblock_init()
659 if (xfs_has_finobt(mp)) { in xfs_agiblock_init()
660 agi->agi_free_root = cpu_to_be32(XFS_FIBT_BLOCK(mp)); in xfs_agiblock_init()
665 if (xfs_has_inobtcounts(mp)) { in xfs_agiblock_init()
667 if (xfs_has_finobt(mp)) in xfs_agiblock_init()
672 typedef void (*aghdr_init_work_f)(struct xfs_mount *mp, struct xfs_buf *bp,
676 struct xfs_mount *mp, in xfs_ag_init_hdr() argument
684 error = xfs_get_aghdr_buf(mp, id->daddr, id->numblks, &bp, ops); in xfs_ag_init_hdr()
688 (*work)(mp, bp, id); in xfs_ag_init_hdr()
716 struct xfs_mount *mp, in xfs_ag_init_headers() argument
722 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_SB_DADDR), in xfs_ag_init_headers()
723 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
729 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGF_DADDR(mp)), in xfs_ag_init_headers()
730 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
736 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGFL_DADDR(mp)), in xfs_ag_init_headers()
737 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
743 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGI_DADDR(mp)), in xfs_ag_init_headers()
744 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
750 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_BNO_BLOCK(mp)), in xfs_ag_init_headers()
751 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
757 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_CNT_BLOCK(mp)), in xfs_ag_init_headers()
758 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
764 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_IBT_BLOCK(mp)), in xfs_ag_init_headers()
765 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
772 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_FIBT_BLOCK(mp)), in xfs_ag_init_headers()
773 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
777 .need_init = xfs_has_finobt(mp) in xfs_ag_init_headers()
780 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_RMAP_BLOCK(mp)), in xfs_ag_init_headers()
781 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
784 .need_init = xfs_has_rmapbt(mp) in xfs_ag_init_headers()
787 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, xfs_refc_block(mp)), in xfs_ag_init_headers()
788 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
792 .need_init = xfs_has_reflink(mp) in xfs_ag_init_headers()
802 id->nfree += id->agsize - mp->m_ag_prealloc_blocks; in xfs_ag_init_headers()
810 error = xfs_ag_init_hdr(mp, id, dp->work, dp->ops); in xfs_ag_init_headers()
823 struct xfs_mount *mp = pag->pag_mount; in xfs_ag_shrink_space() local
826 .mp = mp, in xfs_ag_shrink_space()
840 ASSERT(pag->pag_agno == mp->m_sb.sb_agcount - 1); in xfs_ag_shrink_space()
854 if (XFS_IS_CORRUPT(mp, agf->agf_length != agi->agi_length)) in xfs_ag_shrink_space()
859 args.fsbno = XFS_AGB_TO_FSB(mp, pag->pag_agno, aglen - delta); in xfs_ag_shrink_space()
933 xfs_warn(mp, "Error %d reserving per-AG metadata reserve pool.", err2); in xfs_ag_shrink_space()
934 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_ag_shrink_space()