Lines Matching refs:mp

43 	struct xfs_mount	*mp,  in xfs_perag_get()  argument
49 pag = radix_tree_lookup(&mp->m_perag_tree, agno); in xfs_perag_get()
64 struct xfs_mount *mp, in xfs_perag_get_tag() argument
72 found = radix_tree_gang_lookup_tag(&mp->m_perag_tree, in xfs_perag_get_tag()
114 struct xfs_mount *mp, in xfs_perag_grab() argument
120 pag = radix_tree_lookup(&mp->m_perag_tree, agno); in xfs_perag_grab()
135 struct xfs_mount *mp, in xfs_perag_grab_tag() argument
143 found = radix_tree_gang_lookup_tag(&mp->m_perag_tree, in xfs_perag_grab_tag()
175 struct xfs_mount *mp, in xfs_initialize_perag_data() argument
180 struct xfs_sb *sbp = &mp->m_sb; in xfs_initialize_perag_data()
194 pag = xfs_perag_get(mp, index); in xfs_initialize_perag_data()
219 xfs_alert(mp, "AGF corruption. Please run xfs_repair."); in xfs_initialize_perag_data()
225 spin_lock(&mp->m_sb_lock); in xfs_initialize_perag_data()
229 spin_unlock(&mp->m_sb_lock); in xfs_initialize_perag_data()
231 xfs_reinit_percpu_counters(mp); in xfs_initialize_perag_data()
233 xfs_fs_mark_healthy(mp, XFS_SICK_FS_COUNTERS); in xfs_initialize_perag_data()
252 struct xfs_mount *mp) in xfs_free_perag() argument
257 for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) { in xfs_free_perag()
258 spin_lock(&mp->m_perag_lock); in xfs_free_perag()
259 pag = radix_tree_delete(&mp->m_perag_tree, agno); in xfs_free_perag()
260 spin_unlock(&mp->m_perag_lock); in xfs_free_perag()
279 struct xfs_mount *mp, in __xfs_ag_block_count() argument
287 return mp->m_sb.sb_agblocks; in __xfs_ag_block_count()
288 return dblocks - (agno * mp->m_sb.sb_agblocks); in __xfs_ag_block_count()
293 struct xfs_mount *mp, in xfs_ag_block_count() argument
296 return __xfs_ag_block_count(mp, agno, mp->m_sb.sb_agcount, in xfs_ag_block_count()
297 mp->m_sb.sb_dblocks); in xfs_ag_block_count()
303 struct xfs_mount *mp, in __xfs_agino_range() argument
314 bno = round_up(XFS_AGFL_BLOCK(mp) + 1, M_IGEO(mp)->cluster_align); in __xfs_agino_range()
315 *first = XFS_AGB_TO_AGINO(mp, bno); in __xfs_agino_range()
321 bno = round_down(eoag, M_IGEO(mp)->cluster_align); in __xfs_agino_range()
322 *last = XFS_AGB_TO_AGINO(mp, bno) - 1; in __xfs_agino_range()
327 struct xfs_mount *mp, in xfs_agino_range() argument
332 return __xfs_agino_range(mp, xfs_ag_block_count(mp, agno), first, last); in xfs_agino_range()
341 struct xfs_mount *mp, in xfs_free_unused_perag_range() argument
349 spin_lock(&mp->m_perag_lock); in xfs_free_unused_perag_range()
350 pag = radix_tree_delete(&mp->m_perag_tree, index); in xfs_free_unused_perag_range()
351 spin_unlock(&mp->m_perag_lock); in xfs_free_unused_perag_range()
362 struct xfs_mount *mp, in xfs_initialize_perag() argument
378 pag = xfs_perag_get(mp, index); in xfs_initialize_perag()
390 pag->pag_mount = mp; in xfs_initialize_perag()
396 spin_lock(&mp->m_perag_lock); in xfs_initialize_perag()
397 if (radix_tree_insert(&mp->m_perag_tree, index, pag)) { in xfs_initialize_perag()
399 spin_unlock(&mp->m_perag_lock); in xfs_initialize_perag()
404 spin_unlock(&mp->m_perag_lock); in xfs_initialize_perag()
435 pag->block_count = __xfs_ag_block_count(mp, index, agcount, in xfs_initialize_perag()
437 pag->min_block = XFS_AGFL_BLOCK(mp); in xfs_initialize_perag()
438 __xfs_agino_range(mp, pag->block_count, &pag->agino_min, in xfs_initialize_perag()
442 index = xfs_set_inode_alloc(mp, agcount); in xfs_initialize_perag()
447 mp->m_ag_prealloc_blocks = xfs_prealloc_blocks(mp); in xfs_initialize_perag()
452 spin_lock(&mp->m_perag_lock); in xfs_initialize_perag()
453 radix_tree_delete(&mp->m_perag_tree, index); in xfs_initialize_perag()
454 spin_unlock(&mp->m_perag_lock); in xfs_initialize_perag()
459 xfs_free_unused_perag_range(mp, first_initialised, agcount); in xfs_initialize_perag()
465 struct xfs_mount *mp, in xfs_get_aghdr_buf() argument
474 error = xfs_buf_get_uncached(mp->m_ddev_targp, numblks, 0, &bp); in xfs_get_aghdr_buf()
490 struct xfs_mount *mp, in xfs_btroot_init() argument
494 xfs_btree_init_block(mp, bp, id->type, 0, 0, id->agno); in xfs_btroot_init()
500 struct xfs_mount *mp, in xfs_freesp_init_recs() argument
507 arec = XFS_ALLOC_REC_ADDR(mp, XFS_BUF_TO_BLOCK(bp), 1); in xfs_freesp_init_recs()
508 arec->ar_startblock = cpu_to_be32(mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
510 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_freesp_init_recs()
512 xfs_agblock_t start = XFS_FSB_TO_AGBNO(mp, in xfs_freesp_init_recs()
513 mp->m_sb.sb_logstart); in xfs_freesp_init_recs()
515 ASSERT(start >= mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
516 if (start != mp->m_ag_prealloc_blocks) { in xfs_freesp_init_recs()
522 mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
538 be32_add_cpu(&arec->ar_startblock, mp->m_sb.sb_logblocks); in xfs_freesp_init_recs()
556 struct xfs_mount *mp, in xfs_bnoroot_init() argument
560 xfs_btree_init_block(mp, bp, XFS_BTNUM_BNO, 0, 0, id->agno); in xfs_bnoroot_init()
561 xfs_freesp_init_recs(mp, bp, id); in xfs_bnoroot_init()
566 struct xfs_mount *mp, in xfs_cntroot_init() argument
570 xfs_btree_init_block(mp, bp, XFS_BTNUM_CNT, 0, 0, id->agno); in xfs_cntroot_init()
571 xfs_freesp_init_recs(mp, bp, id); in xfs_cntroot_init()
579 struct xfs_mount *mp, in xfs_rmaproot_init() argument
586 xfs_btree_init_block(mp, bp, XFS_BTNUM_RMAP, 0, 4, id->agno); in xfs_rmaproot_init()
599 rrec->rm_blockcount = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_rmaproot_init()
605 rrec->rm_startblock = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_rmaproot_init()
612 rrec->rm_startblock = cpu_to_be32(XFS_IBT_BLOCK(mp)); in xfs_rmaproot_init()
613 rrec->rm_blockcount = cpu_to_be32(XFS_RMAP_BLOCK(mp) - in xfs_rmaproot_init()
614 XFS_IBT_BLOCK(mp)); in xfs_rmaproot_init()
620 rrec->rm_startblock = cpu_to_be32(XFS_RMAP_BLOCK(mp)); in xfs_rmaproot_init()
626 if (xfs_has_reflink(mp)) { in xfs_rmaproot_init()
628 rrec->rm_startblock = cpu_to_be32(xfs_refc_block(mp)); in xfs_rmaproot_init()
636 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_rmaproot_init()
640 XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart)); in xfs_rmaproot_init()
641 rrec->rm_blockcount = cpu_to_be32(mp->m_sb.sb_logblocks); in xfs_rmaproot_init()
658 struct xfs_mount *mp, in xfs_sbblock_init() argument
664 xfs_sb_to_disk(dsb, &mp->m_sb); in xfs_sbblock_init()
670 struct xfs_mount *mp, in xfs_agfblock_init() argument
681 agf->agf_roots[XFS_BTNUM_BNOi] = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_agfblock_init()
682 agf->agf_roots[XFS_BTNUM_CNTi] = cpu_to_be32(XFS_CNT_BLOCK(mp)); in xfs_agfblock_init()
685 if (xfs_has_rmapbt(mp)) { in xfs_agfblock_init()
687 cpu_to_be32(XFS_RMAP_BLOCK(mp)); in xfs_agfblock_init()
695 tmpsize = id->agsize - mp->m_ag_prealloc_blocks; in xfs_agfblock_init()
698 if (xfs_has_crc(mp)) in xfs_agfblock_init()
699 uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agfblock_init()
700 if (xfs_has_reflink(mp)) { in xfs_agfblock_init()
702 xfs_refc_block(mp)); in xfs_agfblock_init()
707 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_agfblock_init()
708 int64_t logblocks = mp->m_sb.sb_logblocks; in xfs_agfblock_init()
712 XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart) - logblocks); in xfs_agfblock_init()
718 struct xfs_mount *mp, in xfs_agflblock_init() argument
726 if (xfs_has_crc(mp)) { in xfs_agflblock_init()
729 uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agflblock_init()
733 for (bucket = 0; bucket < xfs_agfl_size(mp); bucket++) in xfs_agflblock_init()
739 struct xfs_mount *mp, in xfs_agiblock_init() argument
751 agi->agi_root = cpu_to_be32(XFS_IBT_BLOCK(mp)); in xfs_agiblock_init()
756 if (xfs_has_crc(mp)) in xfs_agiblock_init()
757 uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agiblock_init()
758 if (xfs_has_finobt(mp)) { in xfs_agiblock_init()
759 agi->agi_free_root = cpu_to_be32(XFS_FIBT_BLOCK(mp)); in xfs_agiblock_init()
764 if (xfs_has_inobtcounts(mp)) { in xfs_agiblock_init()
766 if (xfs_has_finobt(mp)) in xfs_agiblock_init()
771 typedef void (*aghdr_init_work_f)(struct xfs_mount *mp, struct xfs_buf *bp,
775 struct xfs_mount *mp, in xfs_ag_init_hdr() argument
783 error = xfs_get_aghdr_buf(mp, id->daddr, id->numblks, &bp, ops); in xfs_ag_init_hdr()
787 (*work)(mp, bp, id); in xfs_ag_init_hdr()
815 struct xfs_mount *mp, in xfs_ag_init_headers() argument
821 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_SB_DADDR), in xfs_ag_init_headers()
822 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
828 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGF_DADDR(mp)), in xfs_ag_init_headers()
829 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
835 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGFL_DADDR(mp)), in xfs_ag_init_headers()
836 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
842 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGI_DADDR(mp)), in xfs_ag_init_headers()
843 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
849 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_BNO_BLOCK(mp)), in xfs_ag_init_headers()
850 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
856 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_CNT_BLOCK(mp)), in xfs_ag_init_headers()
857 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
863 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_IBT_BLOCK(mp)), in xfs_ag_init_headers()
864 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
871 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_FIBT_BLOCK(mp)), in xfs_ag_init_headers()
872 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
876 .need_init = xfs_has_finobt(mp) in xfs_ag_init_headers()
879 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_RMAP_BLOCK(mp)), in xfs_ag_init_headers()
880 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
883 .need_init = xfs_has_rmapbt(mp) in xfs_ag_init_headers()
886 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, xfs_refc_block(mp)), in xfs_ag_init_headers()
887 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
891 .need_init = xfs_has_reflink(mp) in xfs_ag_init_headers()
901 id->nfree += id->agsize - mp->m_ag_prealloc_blocks; in xfs_ag_init_headers()
909 error = xfs_ag_init_hdr(mp, id, dp->work, dp->ops); in xfs_ag_init_headers()
922 struct xfs_mount *mp = pag->pag_mount; in xfs_ag_shrink_space() local
925 .mp = mp, in xfs_ag_shrink_space()
939 ASSERT(pag->pag_agno == mp->m_sb.sb_agcount - 1); in xfs_ag_shrink_space()
953 if (XFS_IS_CORRUPT(mp, agf->agf_length != agi->agi_length)) in xfs_ag_shrink_space()
976 XFS_AGB_TO_FSB(mp, pag->pag_agno, aglen - delta)); in xfs_ag_shrink_space()
1048 xfs_warn(mp, "Error %d reserving per-AG metadata reserve pool.", err2); in xfs_ag_shrink_space()
1049 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_ag_shrink_space()