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()
137 oagcount = mp->m_sb.sb_agcount; in xfs_growfs_data_private()
140 error = xfs_initialize_perag(mp, nagcount, nb, &nagimax); in xfs_growfs_data_private()
149 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, in xfs_growfs_data_private()
150 XFS_GROWFS_SPACE_RES(mp), 0, XFS_TRANS_RESERVE, in xfs_growfs_data_private()
153 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, -delta, 0, in xfs_growfs_data_private()
158 last_pag = xfs_perag_get(mp, oagcount - 1); in xfs_growfs_data_private()
163 xfs_warn_mount(mp, XFS_OPSTATE_WARNED_SHRINK, in xfs_growfs_data_private()
189 if (xfs_has_lazysbcount(mp)) in xfs_growfs_data_private()
199 mp->m_maxagi = nagimax; in xfs_growfs_data_private()
200 xfs_set_low_space_thresholds(mp); in xfs_growfs_data_private()
201 mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); in xfs_growfs_data_private()
211 pag = xfs_perag_get(mp, id.agno); in xfs_growfs_data_private()
222 error = xfs_fs_reserve_ag_blocks(mp); in xfs_growfs_data_private()
235 struct xfs_mount *mp, /* mount point for filesystem */ in xfs_growfs_log_private() argument
241 if (nb < XFS_MIN_LOG_BLOCKS || nb < XFS_B_TO_FSB(mp, XFS_MIN_LOG_BYTES)) in xfs_growfs_log_private()
243 if (nb == mp->m_sb.sb_logblocks && in xfs_growfs_log_private()
244 in->isint == (mp->m_sb.sb_logstart != 0)) in xfs_growfs_log_private()
257 struct xfs_mount *mp, in xfs_growfs_imaxpct() argument
267 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, in xfs_growfs_imaxpct()
268 XFS_GROWFS_SPACE_RES(mp), 0, XFS_TRANS_RESERVE, &tp); in xfs_growfs_imaxpct()
272 dpct = imaxpct - mp->m_sb.sb_imax_pct; in xfs_growfs_imaxpct()
285 struct xfs_mount *mp, in xfs_growfs_data() argument
292 if (!mutex_trylock(&mp->m_growlock)) in xfs_growfs_data()
296 if (in->imaxpct != mp->m_sb.sb_imax_pct) { in xfs_growfs_data()
297 error = xfs_growfs_imaxpct(mp, in->imaxpct); in xfs_growfs_data()
302 if (in->newblocks != mp->m_sb.sb_dblocks) { in xfs_growfs_data()
303 error = xfs_growfs_data_private(mp, in); in xfs_growfs_data()
309 if (mp->m_sb.sb_imax_pct) { in xfs_growfs_data()
310 uint64_t icount = mp->m_sb.sb_dblocks * mp->m_sb.sb_imax_pct; in xfs_growfs_data()
312 M_IGEO(mp)->maxicount = XFS_FSB_TO_INO(mp, icount); in xfs_growfs_data()
314 M_IGEO(mp)->maxicount = 0; in xfs_growfs_data()
317 error = xfs_update_secondary_sbs(mp); in xfs_growfs_data()
325 mp->m_generation++; in xfs_growfs_data()
326 mutex_unlock(&mp->m_growlock); in xfs_growfs_data()
332 xfs_mount_t *mp, in xfs_growfs_log() argument
339 if (!mutex_trylock(&mp->m_growlock)) in xfs_growfs_log()
341 error = xfs_growfs_log_private(mp, in); in xfs_growfs_log()
342 mutex_unlock(&mp->m_growlock); in xfs_growfs_log()
352 xfs_mount_t *mp, in xfs_fs_counts() argument
355 cnt->allocino = percpu_counter_read_positive(&mp->m_icount); in xfs_fs_counts()
356 cnt->freeino = percpu_counter_read_positive(&mp->m_ifree); in xfs_fs_counts()
357 cnt->freedata = percpu_counter_read_positive(&mp->m_fdblocks) - in xfs_fs_counts()
358 xfs_fdblocks_unavailable(mp); in xfs_fs_counts()
359 cnt->freertx = percpu_counter_read_positive(&mp->m_frextents); in xfs_fs_counts()
379 xfs_mount_t *mp, in xfs_reserve_blocks() argument
393 outval->resblks = mp->m_resblks; in xfs_reserve_blocks()
394 outval->resblks_avail = mp->m_resblks_avail; in xfs_reserve_blocks()
410 spin_lock(&mp->m_sb_lock); in xfs_reserve_blocks()
418 if (mp->m_resblks > request) { in xfs_reserve_blocks()
419 lcounter = mp->m_resblks_avail - request; in xfs_reserve_blocks()
422 mp->m_resblks_avail -= lcounter; in xfs_reserve_blocks()
424 mp->m_resblks = request; in xfs_reserve_blocks()
426 spin_unlock(&mp->m_sb_lock); in xfs_reserve_blocks()
427 error = xfs_mod_fdblocks(mp, fdblks_delta, 0); in xfs_reserve_blocks()
428 spin_lock(&mp->m_sb_lock); in xfs_reserve_blocks()
446 free = percpu_counter_sum(&mp->m_fdblocks) - in xfs_reserve_blocks()
447 xfs_fdblocks_unavailable(mp); in xfs_reserve_blocks()
448 delta = request - mp->m_resblks; in xfs_reserve_blocks()
449 mp->m_resblks = request; in xfs_reserve_blocks()
462 spin_unlock(&mp->m_sb_lock); in xfs_reserve_blocks()
463 error = xfs_mod_fdblocks(mp, -fdblks_delta, 0); in xfs_reserve_blocks()
465 xfs_mod_fdblocks(mp, fdblks_delta, 0); in xfs_reserve_blocks()
466 spin_lock(&mp->m_sb_lock); in xfs_reserve_blocks()
470 outval->resblks = mp->m_resblks; in xfs_reserve_blocks()
471 outval->resblks_avail = mp->m_resblks_avail; in xfs_reserve_blocks()
474 spin_unlock(&mp->m_sb_lock); in xfs_reserve_blocks()
480 xfs_mount_t *mp, in xfs_fs_goingdown() argument
485 if (!freeze_bdev(mp->m_super->s_bdev)) { in xfs_fs_goingdown()
486 xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT); in xfs_fs_goingdown()
487 thaw_bdev(mp->m_super->s_bdev); in xfs_fs_goingdown()
492 xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT); in xfs_fs_goingdown()
495 xfs_force_shutdown(mp, in xfs_fs_goingdown()
518 struct xfs_mount *mp, in xfs_do_force_shutdown() argument
527 if (test_and_set_bit(XFS_OPSTATE_SHUTDOWN, &mp->m_opstate)) { in xfs_do_force_shutdown()
528 xlog_shutdown_wait(mp->m_log); in xfs_do_force_shutdown()
531 if (mp->m_sb_bp) in xfs_do_force_shutdown()
532 mp->m_sb_bp->b_flags |= XBF_DONE; in xfs_do_force_shutdown()
535 xfs_alert(mp, "User initiated shutdown received."); in xfs_do_force_shutdown()
537 if (xlog_force_shutdown(mp->m_log, flags)) { in xfs_do_force_shutdown()
554 trace_xfs_force_shutdown(mp, tag, flags, fname, lnnum); in xfs_do_force_shutdown()
556 xfs_alert_tag(mp, tag, in xfs_do_force_shutdown()
559 xfs_alert(mp, in xfs_do_force_shutdown()
570 struct xfs_mount *mp) in xfs_fs_reserve_ag_blocks() argument
577 mp->m_finobt_nores = false; in xfs_fs_reserve_ag_blocks()
578 for_each_perag(mp, agno, pag) { in xfs_fs_reserve_ag_blocks()
585 xfs_warn(mp, in xfs_fs_reserve_ag_blocks()
587 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_fs_reserve_ag_blocks()
598 struct xfs_mount *mp) in xfs_fs_unreserve_ag_blocks() argument
605 for_each_perag(mp, agno, pag) { in xfs_fs_unreserve_ag_blocks()
612 xfs_warn(mp, in xfs_fs_unreserve_ag_blocks()