Lines Matching refs:mp
47 struct xfs_mount *mp = tp->t_mountp; in xfs_resizefs_init_new_ags() local
48 xfs_rfsblock_t nb = mp->m_sb.sb_dblocks + delta; in xfs_resizefs_init_new_ags()
60 (xfs_rfsblock_t)mp->m_sb.sb_agblocks); in xfs_resizefs_init_new_ags()
62 id->agsize = mp->m_sb.sb_agblocks; in xfs_resizefs_init_new_ags()
64 error = xfs_ag_init_headers(mp, id); in xfs_resizefs_init_new_ags()
87 struct xfs_mount *mp, /* mount point for filesystem */ in xfs_growfs_data_private() argument
103 error = xfs_sb_validate_fsb_count(&mp->m_sb, nb); in xfs_growfs_data_private()
107 if (nb > mp->m_sb.sb_dblocks) { in xfs_growfs_data_private()
108 error = xfs_buf_read_uncached(mp->m_ddev_targp, in xfs_growfs_data_private()
109 XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1), in xfs_growfs_data_private()
110 XFS_FSS_TO_BB(mp, 1), 0, &bp, NULL); in xfs_growfs_data_private()
117 nb_mod = do_div(nb_div, mp->m_sb.sb_agblocks); in xfs_growfs_data_private()
121 nb = nb_div * mp->m_sb.sb_agblocks; in xfs_growfs_data_private()
125 nb = nb_div * mp->m_sb.sb_agblocks; in xfs_growfs_data_private()
128 delta = nb - mp->m_sb.sb_dblocks; in xfs_growfs_data_private()
141 oagcount = mp->m_sb.sb_agcount; in xfs_growfs_data_private()
144 error = xfs_initialize_perag(mp, nagcount, nb, &nagimax); in xfs_growfs_data_private()
153 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, in xfs_growfs_data_private()
154 XFS_GROWFS_SPACE_RES(mp), 0, XFS_TRANS_RESERVE, in xfs_growfs_data_private()
157 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, -delta, 0, in xfs_growfs_data_private()
162 last_pag = xfs_perag_get(mp, oagcount - 1); in xfs_growfs_data_private()
167 xfs_warn_mount(mp, XFS_OPSTATE_WARNED_SHRINK, in xfs_growfs_data_private()
193 if (xfs_has_lazysbcount(mp)) in xfs_growfs_data_private()
203 mp->m_maxagi = nagimax; in xfs_growfs_data_private()
204 xfs_set_low_space_thresholds(mp); in xfs_growfs_data_private()
205 mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); in xfs_growfs_data_private()
215 pag = xfs_perag_get(mp, id.agno); in xfs_growfs_data_private()
226 error = xfs_fs_reserve_ag_blocks(mp); in xfs_growfs_data_private()
236 xfs_free_unused_perag_range(mp, oagcount, nagcount); in xfs_growfs_data_private()
242 struct xfs_mount *mp, /* mount point for filesystem */ in xfs_growfs_log_private() argument
248 if (nb < XFS_MIN_LOG_BLOCKS || nb < XFS_B_TO_FSB(mp, XFS_MIN_LOG_BYTES)) in xfs_growfs_log_private()
250 if (nb == mp->m_sb.sb_logblocks && in xfs_growfs_log_private()
251 in->isint == (mp->m_sb.sb_logstart != 0)) in xfs_growfs_log_private()
264 struct xfs_mount *mp, in xfs_growfs_imaxpct() argument
274 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, in xfs_growfs_imaxpct()
275 XFS_GROWFS_SPACE_RES(mp), 0, XFS_TRANS_RESERVE, &tp); in xfs_growfs_imaxpct()
279 dpct = imaxpct - mp->m_sb.sb_imax_pct; in xfs_growfs_imaxpct()
292 struct xfs_mount *mp, in xfs_growfs_data() argument
299 if (!mutex_trylock(&mp->m_growlock)) in xfs_growfs_data()
303 if (in->imaxpct != mp->m_sb.sb_imax_pct) { in xfs_growfs_data()
304 error = xfs_growfs_imaxpct(mp, in->imaxpct); in xfs_growfs_data()
309 if (in->newblocks != mp->m_sb.sb_dblocks) { in xfs_growfs_data()
310 error = xfs_growfs_data_private(mp, in); in xfs_growfs_data()
316 if (mp->m_sb.sb_imax_pct) { in xfs_growfs_data()
317 uint64_t icount = mp->m_sb.sb_dblocks * mp->m_sb.sb_imax_pct; in xfs_growfs_data()
319 M_IGEO(mp)->maxicount = XFS_FSB_TO_INO(mp, icount); in xfs_growfs_data()
321 M_IGEO(mp)->maxicount = 0; in xfs_growfs_data()
324 error = xfs_update_secondary_sbs(mp); in xfs_growfs_data()
332 mp->m_generation++; in xfs_growfs_data()
333 mutex_unlock(&mp->m_growlock); in xfs_growfs_data()
339 xfs_mount_t *mp, in xfs_growfs_log() argument
346 if (!mutex_trylock(&mp->m_growlock)) in xfs_growfs_log()
348 error = xfs_growfs_log_private(mp, in); in xfs_growfs_log()
349 mutex_unlock(&mp->m_growlock); in xfs_growfs_log()
359 xfs_mount_t *mp, in xfs_fs_counts() argument
362 cnt->allocino = percpu_counter_read_positive(&mp->m_icount); in xfs_fs_counts()
363 cnt->freeino = percpu_counter_read_positive(&mp->m_ifree); in xfs_fs_counts()
364 cnt->freedata = percpu_counter_read_positive(&mp->m_fdblocks) - in xfs_fs_counts()
365 xfs_fdblocks_unavailable(mp); in xfs_fs_counts()
366 cnt->freertx = percpu_counter_read_positive(&mp->m_frextents); in xfs_fs_counts()
386 xfs_mount_t *mp, in xfs_reserve_blocks() argument
400 outval->resblks = mp->m_resblks; in xfs_reserve_blocks()
401 outval->resblks_avail = mp->m_resblks_avail; in xfs_reserve_blocks()
417 spin_lock(&mp->m_sb_lock); in xfs_reserve_blocks()
425 if (mp->m_resblks > request) { in xfs_reserve_blocks()
426 lcounter = mp->m_resblks_avail - request; in xfs_reserve_blocks()
429 mp->m_resblks_avail -= lcounter; in xfs_reserve_blocks()
431 mp->m_resblks = request; in xfs_reserve_blocks()
433 spin_unlock(&mp->m_sb_lock); in xfs_reserve_blocks()
434 error = xfs_mod_fdblocks(mp, fdblks_delta, 0); in xfs_reserve_blocks()
435 spin_lock(&mp->m_sb_lock); in xfs_reserve_blocks()
453 free = percpu_counter_sum(&mp->m_fdblocks) - in xfs_reserve_blocks()
454 xfs_fdblocks_unavailable(mp); in xfs_reserve_blocks()
455 delta = request - mp->m_resblks; in xfs_reserve_blocks()
456 mp->m_resblks = request; in xfs_reserve_blocks()
469 spin_unlock(&mp->m_sb_lock); in xfs_reserve_blocks()
470 error = xfs_mod_fdblocks(mp, -fdblks_delta, 0); in xfs_reserve_blocks()
472 xfs_mod_fdblocks(mp, fdblks_delta, 0); in xfs_reserve_blocks()
473 spin_lock(&mp->m_sb_lock); in xfs_reserve_blocks()
477 outval->resblks = mp->m_resblks; in xfs_reserve_blocks()
478 outval->resblks_avail = mp->m_resblks_avail; in xfs_reserve_blocks()
481 spin_unlock(&mp->m_sb_lock); in xfs_reserve_blocks()
487 xfs_mount_t *mp, in xfs_fs_goingdown() argument
492 if (!freeze_bdev(mp->m_super->s_bdev)) { in xfs_fs_goingdown()
493 xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT); in xfs_fs_goingdown()
494 thaw_bdev(mp->m_super->s_bdev); in xfs_fs_goingdown()
499 xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT); in xfs_fs_goingdown()
502 xfs_force_shutdown(mp, in xfs_fs_goingdown()
525 struct xfs_mount *mp, in xfs_do_force_shutdown() argument
534 if (test_and_set_bit(XFS_OPSTATE_SHUTDOWN, &mp->m_opstate)) { in xfs_do_force_shutdown()
535 xlog_shutdown_wait(mp->m_log); in xfs_do_force_shutdown()
538 if (mp->m_sb_bp) in xfs_do_force_shutdown()
539 mp->m_sb_bp->b_flags |= XBF_DONE; in xfs_do_force_shutdown()
542 xfs_alert(mp, "User initiated shutdown received."); in xfs_do_force_shutdown()
544 if (xlog_force_shutdown(mp->m_log, flags)) { in xfs_do_force_shutdown()
561 trace_xfs_force_shutdown(mp, tag, flags, fname, lnnum); in xfs_do_force_shutdown()
563 xfs_alert_tag(mp, tag, in xfs_do_force_shutdown()
566 xfs_alert(mp, in xfs_do_force_shutdown()
577 struct xfs_mount *mp) in xfs_fs_reserve_ag_blocks() argument
584 mp->m_finobt_nores = false; in xfs_fs_reserve_ag_blocks()
585 for_each_perag(mp, agno, pag) { in xfs_fs_reserve_ag_blocks()
592 xfs_warn(mp, in xfs_fs_reserve_ag_blocks()
594 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_fs_reserve_ag_blocks()
605 struct xfs_mount *mp) in xfs_fs_unreserve_ag_blocks() argument
612 for_each_perag(mp, agno, pag) { in xfs_fs_unreserve_ag_blocks()
619 xfs_warn(mp, in xfs_fs_unreserve_ag_blocks()