Lines Matching full:mp
43 struct xfs_mount *mp, in xfs_perag_get() argument
49 pag = xa_load(&mp->m_perags, agno); in xfs_perag_get()
89 struct xfs_mount *mp, in xfs_perag_grab() argument
95 pag = xa_load(&mp->m_perags, agno); in xfs_perag_grab()
124 struct xfs_mount *mp, in xfs_initialize_perag_data() argument
129 struct xfs_sb *sbp = &mp->m_sb; in xfs_initialize_perag_data()
143 pag = xfs_perag_get(mp, index); in xfs_initialize_perag_data()
168 xfs_alert(mp, "AGF corruption. Please run xfs_repair."); in xfs_initialize_perag_data()
169 xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS); in xfs_initialize_perag_data()
175 spin_lock(&mp->m_sb_lock); in xfs_initialize_perag_data()
179 spin_unlock(&mp->m_sb_lock); in xfs_initialize_perag_data()
181 xfs_reinit_percpu_counters(mp); in xfs_initialize_perag_data()
183 xfs_fs_mark_healthy(mp, XFS_SICK_FS_COUNTERS); in xfs_initialize_perag_data()
192 struct xfs_mount *mp, in xfs_free_perag_range() argument
200 struct xfs_perag *pag = xa_erase(&mp->m_perags, agno); in xfs_free_perag_range()
220 struct xfs_mount *mp, in __xfs_ag_block_count() argument
228 return mp->m_sb.sb_agblocks; in __xfs_ag_block_count()
229 return dblocks - (agno * mp->m_sb.sb_agblocks); in __xfs_ag_block_count()
234 struct xfs_mount *mp, in xfs_ag_block_count() argument
237 return __xfs_ag_block_count(mp, agno, mp->m_sb.sb_agcount, in xfs_ag_block_count()
238 mp->m_sb.sb_dblocks); in xfs_ag_block_count()
244 struct xfs_mount *mp, in __xfs_agino_range() argument
255 bno = round_up(XFS_AGFL_BLOCK(mp) + 1, M_IGEO(mp)->cluster_align); in __xfs_agino_range()
256 *first = XFS_AGB_TO_AGINO(mp, bno); in __xfs_agino_range()
262 bno = round_down(eoag, M_IGEO(mp)->cluster_align); in __xfs_agino_range()
263 *last = XFS_AGB_TO_AGINO(mp, bno) - 1; in __xfs_agino_range()
268 struct xfs_mount *mp, in xfs_agino_range() argument
273 return __xfs_agino_range(mp, xfs_ag_block_count(mp, agno), first, last); in xfs_agino_range()
278 struct xfs_mount *mp, in xfs_update_last_ag_size() argument
281 struct xfs_perag *pag = xfs_perag_grab(mp, prev_agcount - 1); in xfs_update_last_ag_size()
285 pag->block_count = __xfs_ag_block_count(mp, prev_agcount - 1, in xfs_update_last_ag_size()
286 mp->m_sb.sb_agcount, mp->m_sb.sb_dblocks); in xfs_update_last_ag_size()
287 __xfs_agino_range(mp, pag->block_count, &pag->agino_min, in xfs_update_last_ag_size()
295 struct xfs_mount *mp, in xfs_initialize_perag() argument
312 pag->pag_mount = mp; in xfs_initialize_perag()
314 error = xa_insert(&mp->m_perags, index, pag, GFP_KERNEL); in xfs_initialize_perag()
345 pag->block_count = __xfs_ag_block_count(mp, index, new_agcount, in xfs_initialize_perag()
347 pag->min_block = XFS_AGFL_BLOCK(mp); in xfs_initialize_perag()
348 __xfs_agino_range(mp, pag->block_count, &pag->agino_min, in xfs_initialize_perag()
352 index = xfs_set_inode_alloc(mp, new_agcount); in xfs_initialize_perag()
357 mp->m_ag_prealloc_blocks = xfs_prealloc_blocks(mp); in xfs_initialize_perag()
362 pag = xa_erase(&mp->m_perags, index); in xfs_initialize_perag()
366 xfs_free_perag_range(mp, old_agcount, index); in xfs_initialize_perag()
372 struct xfs_mount *mp, in xfs_get_aghdr_buf() argument
381 error = xfs_buf_get_uncached(mp->m_ddev_targp, numblks, 0, &bp); in xfs_get_aghdr_buf()
397 struct xfs_mount *mp, in xfs_btroot_init() argument
401 xfs_btree_init_buf(mp, bp, id->bc_ops, 0, 0, id->agno); in xfs_btroot_init()
407 struct xfs_mount *mp, in xfs_freesp_init_recs() argument
414 arec = XFS_ALLOC_REC_ADDR(mp, XFS_BUF_TO_BLOCK(bp), 1); in xfs_freesp_init_recs()
415 arec->ar_startblock = cpu_to_be32(mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
417 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_freesp_init_recs()
419 xfs_agblock_t start = XFS_FSB_TO_AGBNO(mp, in xfs_freesp_init_recs()
420 mp->m_sb.sb_logstart); in xfs_freesp_init_recs()
422 ASSERT(start >= mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
423 if (start != mp->m_ag_prealloc_blocks) { in xfs_freesp_init_recs()
429 mp->m_ag_prealloc_blocks); in xfs_freesp_init_recs()
445 be32_add_cpu(&arec->ar_startblock, mp->m_sb.sb_logblocks); in xfs_freesp_init_recs()
463 struct xfs_mount *mp, in xfs_bnoroot_init() argument
467 xfs_btree_init_buf(mp, bp, id->bc_ops, 0, 0, id->agno); in xfs_bnoroot_init()
468 xfs_freesp_init_recs(mp, bp, id); in xfs_bnoroot_init()
476 struct xfs_mount *mp, in xfs_rmaproot_init() argument
483 xfs_btree_init_buf(mp, bp, id->bc_ops, 0, 4, id->agno); in xfs_rmaproot_init()
496 rrec->rm_blockcount = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_rmaproot_init()
502 rrec->rm_startblock = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_rmaproot_init()
509 rrec->rm_startblock = cpu_to_be32(XFS_IBT_BLOCK(mp)); in xfs_rmaproot_init()
510 rrec->rm_blockcount = cpu_to_be32(XFS_RMAP_BLOCK(mp) - in xfs_rmaproot_init()
511 XFS_IBT_BLOCK(mp)); in xfs_rmaproot_init()
517 rrec->rm_startblock = cpu_to_be32(XFS_RMAP_BLOCK(mp)); in xfs_rmaproot_init()
523 if (xfs_has_reflink(mp)) { in xfs_rmaproot_init()
525 rrec->rm_startblock = cpu_to_be32(xfs_refc_block(mp)); in xfs_rmaproot_init()
533 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_rmaproot_init()
537 XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart)); in xfs_rmaproot_init()
538 rrec->rm_blockcount = cpu_to_be32(mp->m_sb.sb_logblocks); in xfs_rmaproot_init()
555 struct xfs_mount *mp, in xfs_sbblock_init() argument
561 xfs_sb_to_disk(dsb, &mp->m_sb); in xfs_sbblock_init()
567 struct xfs_mount *mp, in xfs_agfblock_init() argument
578 agf->agf_bno_root = cpu_to_be32(XFS_BNO_BLOCK(mp)); in xfs_agfblock_init()
579 agf->agf_cnt_root = cpu_to_be32(XFS_CNT_BLOCK(mp)); in xfs_agfblock_init()
582 if (xfs_has_rmapbt(mp)) { in xfs_agfblock_init()
583 agf->agf_rmap_root = cpu_to_be32(XFS_RMAP_BLOCK(mp)); in xfs_agfblock_init()
591 tmpsize = id->agsize - mp->m_ag_prealloc_blocks; in xfs_agfblock_init()
594 if (xfs_has_crc(mp)) in xfs_agfblock_init()
595 uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agfblock_init()
596 if (xfs_has_reflink(mp)) { in xfs_agfblock_init()
598 xfs_refc_block(mp)); in xfs_agfblock_init()
603 if (xfs_ag_contains_log(mp, id->agno)) { in xfs_agfblock_init()
604 int64_t logblocks = mp->m_sb.sb_logblocks; in xfs_agfblock_init()
608 XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart) - logblocks); in xfs_agfblock_init()
614 struct xfs_mount *mp, in xfs_agflblock_init() argument
622 if (xfs_has_crc(mp)) { in xfs_agflblock_init()
625 uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agflblock_init()
629 for (bucket = 0; bucket < xfs_agfl_size(mp); bucket++) in xfs_agflblock_init()
635 struct xfs_mount *mp, in xfs_agiblock_init() argument
647 agi->agi_root = cpu_to_be32(XFS_IBT_BLOCK(mp)); in xfs_agiblock_init()
652 if (xfs_has_crc(mp)) in xfs_agiblock_init()
653 uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); in xfs_agiblock_init()
654 if (xfs_has_finobt(mp)) { in xfs_agiblock_init()
655 agi->agi_free_root = cpu_to_be32(XFS_FIBT_BLOCK(mp)); in xfs_agiblock_init()
660 if (xfs_has_inobtcounts(mp)) { in xfs_agiblock_init()
662 if (xfs_has_finobt(mp)) in xfs_agiblock_init()
667 typedef void (*aghdr_init_work_f)(struct xfs_mount *mp, struct xfs_buf *bp,
671 struct xfs_mount *mp, in xfs_ag_init_hdr() argument
679 error = xfs_get_aghdr_buf(mp, id->daddr, id->numblks, &bp, ops); in xfs_ag_init_hdr()
683 (*work)(mp, bp, id); in xfs_ag_init_hdr()
711 struct xfs_mount *mp, in xfs_ag_init_headers() argument
717 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_SB_DADDR), in xfs_ag_init_headers()
718 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
724 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGF_DADDR(mp)), in xfs_ag_init_headers()
725 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
731 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGFL_DADDR(mp)), in xfs_ag_init_headers()
732 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
738 .daddr = XFS_AG_DADDR(mp, id->agno, XFS_AGI_DADDR(mp)), in xfs_ag_init_headers()
739 .numblks = XFS_FSS_TO_BB(mp, 1), in xfs_ag_init_headers()
745 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_BNO_BLOCK(mp)), in xfs_ag_init_headers()
746 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
753 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_CNT_BLOCK(mp)), in xfs_ag_init_headers()
754 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
761 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_IBT_BLOCK(mp)), in xfs_ag_init_headers()
762 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
769 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_FIBT_BLOCK(mp)), in xfs_ag_init_headers()
770 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
774 .need_init = xfs_has_finobt(mp) in xfs_ag_init_headers()
777 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_RMAP_BLOCK(mp)), in xfs_ag_init_headers()
778 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
782 .need_init = xfs_has_rmapbt(mp) in xfs_ag_init_headers()
785 .daddr = XFS_AGB_TO_DADDR(mp, id->agno, xfs_refc_block(mp)), in xfs_ag_init_headers()
786 .numblks = BTOBB(mp->m_sb.sb_blocksize), in xfs_ag_init_headers()
790 .need_init = xfs_has_reflink(mp) in xfs_ag_init_headers()
800 id->nfree += id->agsize - mp->m_ag_prealloc_blocks; in xfs_ag_init_headers()
808 error = xfs_ag_init_hdr(mp, id, dp->work, dp->ops); in xfs_ag_init_headers()
821 struct xfs_mount *mp = pag->pag_mount; in xfs_ag_shrink_space() local
824 .mp = mp, in xfs_ag_shrink_space()
838 ASSERT(pag->pag_agno == mp->m_sb.sb_agcount - 1); in xfs_ag_shrink_space()
852 if (XFS_IS_CORRUPT(mp, agf->agf_length != agi->agi_length)) { in xfs_ag_shrink_space()
875 XFS_AGB_TO_FSB(mp, pag->pag_agno, aglen - delta)); in xfs_ag_shrink_space()
947 xfs_warn(mp, "Error %d reserving per-AG metadata reserve pool.", err2); in xfs_ag_shrink_space()
948 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_ag_shrink_space()