Lines Matching refs:mp

76 	struct xfs_mount	*mp,  in xfs_mount_set_dax_mode()  argument
81 mp->m_features &= ~(XFS_FEAT_DAX_ALWAYS | XFS_FEAT_DAX_NEVER); in xfs_mount_set_dax_mode()
84 mp->m_features |= XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
85 mp->m_features &= ~XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
88 mp->m_features |= XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
89 mp->m_features &= ~XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
202 struct xfs_mount *mp = XFS_M(root->d_sb); in xfs_fs_show_options() local
206 if (mp->m_features & xfs_infop->flag) in xfs_fs_show_options()
210 seq_printf(m, ",inode%d", xfs_has_small_inums(mp) ? 32 : 64); in xfs_fs_show_options()
212 if (xfs_has_allocsize(mp)) in xfs_fs_show_options()
214 (1 << mp->m_allocsize_log) >> 10); in xfs_fs_show_options()
216 if (mp->m_logbufs > 0) in xfs_fs_show_options()
217 seq_printf(m, ",logbufs=%d", mp->m_logbufs); in xfs_fs_show_options()
218 if (mp->m_logbsize > 0) in xfs_fs_show_options()
219 seq_printf(m, ",logbsize=%dk", mp->m_logbsize >> 10); in xfs_fs_show_options()
221 if (mp->m_logname) in xfs_fs_show_options()
222 seq_show_option(m, "logdev", mp->m_logname); in xfs_fs_show_options()
223 if (mp->m_rtname) in xfs_fs_show_options()
224 seq_show_option(m, "rtdev", mp->m_rtname); in xfs_fs_show_options()
226 if (mp->m_dalign > 0) in xfs_fs_show_options()
228 (int)XFS_FSB_TO_BB(mp, mp->m_dalign)); in xfs_fs_show_options()
229 if (mp->m_swidth > 0) in xfs_fs_show_options()
231 (int)XFS_FSB_TO_BB(mp, mp->m_swidth)); in xfs_fs_show_options()
233 if (mp->m_qflags & XFS_UQUOTA_ENFD) in xfs_fs_show_options()
235 else if (mp->m_qflags & XFS_UQUOTA_ACCT) in xfs_fs_show_options()
238 if (mp->m_qflags & XFS_PQUOTA_ENFD) in xfs_fs_show_options()
240 else if (mp->m_qflags & XFS_PQUOTA_ACCT) in xfs_fs_show_options()
243 if (mp->m_qflags & XFS_GQUOTA_ENFD) in xfs_fs_show_options()
245 else if (mp->m_qflags & XFS_GQUOTA_ACCT) in xfs_fs_show_options()
248 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) in xfs_fs_show_options()
251 if (mp->m_max_open_zones) in xfs_fs_show_options()
252 seq_printf(m, ",max_open_zones=%u", mp->m_max_open_zones); in xfs_fs_show_options()
253 if (mp->m_awu_max_bytes) in xfs_fs_show_options()
255 mp->m_awu_max_bytes >> 10); in xfs_fs_show_options()
303 struct xfs_mount *mp, in xfs_set_inode_alloc() argument
308 xfs_sb_t *sbp = &mp->m_sb; in xfs_set_inode_alloc()
317 if (M_IGEO(mp)->maxicount) { in xfs_set_inode_alloc()
330 agino = XFS_AGB_TO_AGINO(mp, sbp->sb_agblocks - 1); in xfs_set_inode_alloc()
331 ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino); in xfs_set_inode_alloc()
338 if (xfs_has_small_inums(mp) && ino > XFS_MAXINUMBER_32) in xfs_set_inode_alloc()
339 xfs_set_inode32(mp); in xfs_set_inode_alloc()
341 xfs_clear_inode32(mp); in xfs_set_inode_alloc()
346 ino = XFS_AGINO_TO_INO(mp, index, agino); in xfs_set_inode_alloc()
348 pag = xfs_perag_get(mp, index); in xfs_set_inode_alloc()
354 return xfs_is_inode32(mp) ? maxagi : agcount; in xfs_set_inode_alloc()
359 struct xfs_mount *mp) in xfs_setup_dax_always() argument
361 if (!mp->m_ddev_targp->bt_daxdev && in xfs_setup_dax_always()
362 (!mp->m_rtdev_targp || !mp->m_rtdev_targp->bt_daxdev)) { in xfs_setup_dax_always()
363 xfs_alert(mp, in xfs_setup_dax_always()
368 if (mp->m_super->s_blocksize != PAGE_SIZE) { in xfs_setup_dax_always()
369 xfs_alert(mp, in xfs_setup_dax_always()
374 if (xfs_has_reflink(mp) && in xfs_setup_dax_always()
375 bdev_is_partition(mp->m_ddev_targp->bt_bdev)) { in xfs_setup_dax_always()
376 xfs_alert(mp, in xfs_setup_dax_always()
384 xfs_mount_set_dax_mode(mp, XFS_DAX_NEVER); in xfs_setup_dax_always()
390 xfs_mount_t *mp, in xfs_blkdev_get() argument
397 mode = sb_open_mode(mp->m_super->s_flags); in xfs_blkdev_get()
399 mp->m_super, &fs_holder_ops); in xfs_blkdev_get()
403 xfs_warn(mp, "Invalid device [%s], error=%d", name, error); in xfs_blkdev_get()
411 struct xfs_mount *mp) in xfs_shutdown_devices() argument
439 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_shutdown_devices()
440 blkdev_issue_flush(mp->m_logdev_targp->bt_bdev); in xfs_shutdown_devices()
441 invalidate_bdev(mp->m_logdev_targp->bt_bdev); in xfs_shutdown_devices()
443 if (mp->m_rtdev_targp) { in xfs_shutdown_devices()
444 blkdev_issue_flush(mp->m_rtdev_targp->bt_bdev); in xfs_shutdown_devices()
445 invalidate_bdev(mp->m_rtdev_targp->bt_bdev); in xfs_shutdown_devices()
447 blkdev_issue_flush(mp->m_ddev_targp->bt_bdev); in xfs_shutdown_devices()
448 invalidate_bdev(mp->m_ddev_targp->bt_bdev); in xfs_shutdown_devices()
463 struct xfs_mount *mp) in xfs_open_devices() argument
465 struct super_block *sb = mp->m_super; in xfs_open_devices()
473 if (mp->m_logname) { in xfs_open_devices()
474 error = xfs_blkdev_get(mp, mp->m_logname, &logdev_file); in xfs_open_devices()
479 if (mp->m_rtname) { in xfs_open_devices()
480 error = xfs_blkdev_get(mp, mp->m_rtname, &rtdev_file); in xfs_open_devices()
487 xfs_warn(mp, in xfs_open_devices()
497 mp->m_ddev_targp = xfs_alloc_buftarg(mp, sb->s_bdev_file); in xfs_open_devices()
498 if (IS_ERR(mp->m_ddev_targp)) { in xfs_open_devices()
499 error = PTR_ERR(mp->m_ddev_targp); in xfs_open_devices()
500 mp->m_ddev_targp = NULL; in xfs_open_devices()
505 mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev_file); in xfs_open_devices()
506 if (IS_ERR(mp->m_rtdev_targp)) { in xfs_open_devices()
507 error = PTR_ERR(mp->m_rtdev_targp); in xfs_open_devices()
508 mp->m_rtdev_targp = NULL; in xfs_open_devices()
514 mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev_file); in xfs_open_devices()
515 if (IS_ERR(mp->m_logdev_targp)) { in xfs_open_devices()
516 error = PTR_ERR(mp->m_logdev_targp); in xfs_open_devices()
517 mp->m_logdev_targp = NULL; in xfs_open_devices()
521 mp->m_logdev_targp = mp->m_ddev_targp; in xfs_open_devices()
530 if (mp->m_rtdev_targp) in xfs_open_devices()
531 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_open_devices()
533 xfs_free_buftarg(mp->m_ddev_targp); in xfs_open_devices()
548 struct xfs_mount *mp) in xfs_setup_devices() argument
552 error = xfs_configure_buftarg(mp->m_ddev_targp, mp->m_sb.sb_sectsize, in xfs_setup_devices()
553 mp->m_sb.sb_dblocks); in xfs_setup_devices()
557 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_setup_devices()
560 if (xfs_has_sector(mp)) in xfs_setup_devices()
561 log_sector_size = mp->m_sb.sb_logsectsize; in xfs_setup_devices()
562 error = xfs_configure_buftarg(mp->m_logdev_targp, in xfs_setup_devices()
563 log_sector_size, mp->m_sb.sb_logblocks); in xfs_setup_devices()
568 if (mp->m_sb.sb_rtstart) { in xfs_setup_devices()
569 if (mp->m_rtdev_targp) { in xfs_setup_devices()
570 xfs_warn(mp, in xfs_setup_devices()
574 mp->m_rtdev_targp = mp->m_ddev_targp; in xfs_setup_devices()
575 } else if (mp->m_rtname) { in xfs_setup_devices()
576 error = xfs_configure_buftarg(mp->m_rtdev_targp, in xfs_setup_devices()
577 mp->m_sb.sb_sectsize, mp->m_sb.sb_rblocks); in xfs_setup_devices()
587 struct xfs_mount *mp) in xfs_init_mount_workqueues() argument
589 mp->m_buf_workqueue = alloc_workqueue("xfs-buf/%s", in xfs_init_mount_workqueues()
591 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
592 if (!mp->m_buf_workqueue) in xfs_init_mount_workqueues()
595 mp->m_unwritten_workqueue = alloc_workqueue("xfs-conv/%s", in xfs_init_mount_workqueues()
597 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
598 if (!mp->m_unwritten_workqueue) in xfs_init_mount_workqueues()
601 mp->m_reclaim_workqueue = alloc_workqueue("xfs-reclaim/%s", in xfs_init_mount_workqueues()
603 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
604 if (!mp->m_reclaim_workqueue) in xfs_init_mount_workqueues()
607 mp->m_blockgc_wq = alloc_workqueue("xfs-blockgc/%s", in xfs_init_mount_workqueues()
609 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
610 if (!mp->m_blockgc_wq) in xfs_init_mount_workqueues()
613 mp->m_inodegc_wq = alloc_workqueue("xfs-inodegc/%s", in xfs_init_mount_workqueues()
615 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
616 if (!mp->m_inodegc_wq) in xfs_init_mount_workqueues()
619 mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s", in xfs_init_mount_workqueues()
621 mp->m_super->s_id); in xfs_init_mount_workqueues()
622 if (!mp->m_sync_workqueue) in xfs_init_mount_workqueues()
628 destroy_workqueue(mp->m_inodegc_wq); in xfs_init_mount_workqueues()
630 destroy_workqueue(mp->m_blockgc_wq); in xfs_init_mount_workqueues()
632 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_init_mount_workqueues()
634 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_init_mount_workqueues()
636 destroy_workqueue(mp->m_buf_workqueue); in xfs_init_mount_workqueues()
643 struct xfs_mount *mp) in xfs_destroy_mount_workqueues() argument
645 destroy_workqueue(mp->m_sync_workqueue); in xfs_destroy_mount_workqueues()
646 destroy_workqueue(mp->m_blockgc_wq); in xfs_destroy_mount_workqueues()
647 destroy_workqueue(mp->m_inodegc_wq); in xfs_destroy_mount_workqueues()
648 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_destroy_mount_workqueues()
649 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_destroy_mount_workqueues()
650 destroy_workqueue(mp->m_buf_workqueue); in xfs_destroy_mount_workqueues()
657 struct xfs_mount *mp = container_of(work, struct xfs_mount, in xfs_flush_inodes_worker() local
659 struct super_block *sb = mp->m_super; in xfs_flush_inodes_worker()
675 struct xfs_mount *mp) in xfs_flush_inodes() argument
681 if (flush_work(&mp->m_flush_inodes_work)) in xfs_flush_inodes()
684 queue_work(mp->m_sync_workqueue, &mp->m_flush_inodes_work); in xfs_flush_inodes()
685 flush_work(&mp->m_flush_inodes_work); in xfs_flush_inodes()
721 struct xfs_mount *mp = ip->i_mount; in xfs_fs_dirty_inode() local
735 if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) in xfs_fs_dirty_inode()
813 struct xfs_mount *mp) in xfs_mount_free() argument
815 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) in xfs_mount_free()
816 xfs_free_buftarg(mp->m_logdev_targp); in xfs_mount_free()
817 if (mp->m_rtdev_targp && mp->m_rtdev_targp != mp->m_ddev_targp) in xfs_mount_free()
818 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_mount_free()
819 if (mp->m_ddev_targp) in xfs_mount_free()
820 xfs_free_buftarg(mp->m_ddev_targp); in xfs_mount_free()
822 debugfs_remove(mp->m_debugfs); in xfs_mount_free()
823 kfree(mp->m_rtname); in xfs_mount_free()
824 kfree(mp->m_logname); in xfs_mount_free()
825 kfree(mp); in xfs_mount_free()
833 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_sync_fs() local
836 trace_xfs_fs_sync_fs(mp, __return_address); in xfs_fs_sync_fs()
844 error = xfs_log_force(mp, XFS_LOG_SYNC); in xfs_fs_sync_fs()
854 flush_delayed_work(&mp->m_log->l_work); in xfs_fs_sync_fs()
872 xfs_inodegc_stop(mp); in xfs_fs_sync_fs()
873 xfs_blockgc_stop(mp); in xfs_fs_sync_fs()
874 xfs_zone_gc_stop(mp); in xfs_fs_sync_fs()
882 struct xfs_mount *mp) in xfs_internal_log_size() argument
884 if (!mp->m_sb.sb_logstart) in xfs_internal_log_size()
886 return mp->m_sb.sb_logblocks; in xfs_internal_log_size()
891 struct xfs_mount *mp, in xfs_statfs_data() argument
895 xfs_sum_freecounter(mp, XC_FREE_BLOCKS); in xfs_statfs_data()
899 fdblocks - xfs_freecounter_unavailable(mp, XC_FREE_BLOCKS)); in xfs_statfs_data()
905 st->f_blocks = mp->m_sb.sb_dblocks - xfs_internal_log_size(mp); in xfs_statfs_data()
915 struct xfs_mount *mp, in xfs_statfs_rt() argument
918 st->f_bfree = xfs_rtbxlen_to_blen(mp, in xfs_statfs_rt()
919 xfs_sum_freecounter(mp, XC_FREE_RTEXTENTS)); in xfs_statfs_rt()
920 st->f_blocks = mp->m_sb.sb_rblocks - xfs_rtbxlen_to_blen(mp, in xfs_statfs_rt()
921 mp->m_free[XC_FREE_RTEXTENTS].res_total); in xfs_statfs_rt()
926 struct xfs_mount *mp, in xfs_statfs_inodes() argument
929 uint64_t icount = percpu_counter_sum(&mp->m_icount); in xfs_statfs_inodes()
930 uint64_t ifree = percpu_counter_sum(&mp->m_ifree); in xfs_statfs_inodes()
931 uint64_t fakeinos = XFS_FSB_TO_INO(mp, st->f_bfree); in xfs_statfs_inodes()
934 if (M_IGEO(mp)->maxicount) in xfs_statfs_inodes()
936 M_IGEO(mp)->maxicount); in xfs_statfs_inodes()
940 mp->m_sb.sb_icount); in xfs_statfs_inodes()
951 struct xfs_mount *mp = XFS_M(dentry->d_sb); in xfs_fs_statfs() local
958 xfs_inodegc_push(mp); in xfs_fs_statfs()
962 st->f_bsize = mp->m_sb.sb_blocksize; in xfs_fs_statfs()
963 st->f_fsid = u64_to_fsid(huge_encode_dev(mp->m_ddev_targp->bt_dev)); in xfs_fs_statfs()
965 xfs_statfs_data(mp, st); in xfs_fs_statfs()
966 xfs_statfs_inodes(mp, st); in xfs_fs_statfs()
968 if (XFS_IS_REALTIME_MOUNT(mp) && in xfs_fs_statfs()
970 xfs_statfs_rt(mp, st); in xfs_fs_statfs()
973 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
987 struct xfs_mount *mp) in xfs_save_resvblks() argument
992 mp->m_free[i].res_saved = mp->m_free[i].res_total; in xfs_save_resvblks()
993 xfs_reserve_blocks(mp, i, 0); in xfs_save_resvblks()
999 struct xfs_mount *mp) in xfs_restore_resvblks() argument
1005 if (mp->m_free[i].res_saved) { in xfs_restore_resvblks()
1006 resblks = mp->m_free[i].res_saved; in xfs_restore_resvblks()
1007 mp->m_free[i].res_saved = 0; in xfs_restore_resvblks()
1009 resblks = xfs_default_resblks(mp, i); in xfs_restore_resvblks()
1010 xfs_reserve_blocks(mp, i, resblks); in xfs_restore_resvblks()
1024 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_freeze() local
1034 xfs_save_resvblks(mp); in xfs_fs_freeze()
1035 ret = xfs_log_quiesce(mp); in xfs_fs_freeze()
1045 if (ret && !xfs_is_readonly(mp)) { in xfs_fs_freeze()
1046 xfs_blockgc_start(mp); in xfs_fs_freeze()
1047 xfs_inodegc_start(mp); in xfs_fs_freeze()
1048 xfs_zone_gc_start(mp); in xfs_fs_freeze()
1058 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_unfreeze() local
1060 xfs_restore_resvblks(mp); in xfs_fs_unfreeze()
1061 xfs_log_work_queue(mp); in xfs_fs_unfreeze()
1069 if (!xfs_is_readonly(mp)) { in xfs_fs_unfreeze()
1070 xfs_zone_gc_start(mp); in xfs_fs_unfreeze()
1071 xfs_blockgc_start(mp); in xfs_fs_unfreeze()
1072 xfs_inodegc_start(mp); in xfs_fs_unfreeze()
1084 struct xfs_mount *mp) in xfs_finish_flags() argument
1087 if (xfs_has_logv2(mp)) { in xfs_finish_flags()
1088 if (mp->m_logbsize <= 0 && in xfs_finish_flags()
1089 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
1090 mp->m_logbsize = mp->m_sb.sb_logsunit; in xfs_finish_flags()
1091 } else if (mp->m_logbsize > 0 && in xfs_finish_flags()
1092 mp->m_logbsize < mp->m_sb.sb_logsunit) { in xfs_finish_flags()
1093 xfs_warn(mp, in xfs_finish_flags()
1099 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
1100 xfs_warn(mp, in xfs_finish_flags()
1109 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
1110 xfs_warn(mp, in xfs_finish_flags()
1115 if ((mp->m_qflags & XFS_GQUOTA_ACCT) && in xfs_finish_flags()
1116 (mp->m_qflags & XFS_PQUOTA_ACCT) && in xfs_finish_flags()
1117 !xfs_has_pquotino(mp)) { in xfs_finish_flags()
1118 xfs_warn(mp, in xfs_finish_flags()
1123 if (!xfs_has_zoned(mp)) { in xfs_finish_flags()
1124 if (mp->m_max_open_zones) { in xfs_finish_flags()
1125 xfs_warn(mp, in xfs_finish_flags()
1129 if (mp->m_features & XFS_FEAT_NOLIFETIME) { in xfs_finish_flags()
1130 xfs_warn(mp, in xfs_finish_flags()
1141 struct xfs_mount *mp) in xfs_init_percpu_counters() argument
1146 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1150 error = percpu_counter_init(&mp->m_ifree, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1154 error = percpu_counter_init(&mp->m_delalloc_blks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1158 error = percpu_counter_init(&mp->m_delalloc_rtextents, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1163 error = percpu_counter_init(&mp->m_free[i].count, 0, in xfs_init_percpu_counters()
1173 percpu_counter_destroy(&mp->m_free[i].count); in xfs_init_percpu_counters()
1174 percpu_counter_destroy(&mp->m_delalloc_rtextents); in xfs_init_percpu_counters()
1176 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_init_percpu_counters()
1178 percpu_counter_destroy(&mp->m_ifree); in xfs_init_percpu_counters()
1180 percpu_counter_destroy(&mp->m_icount); in xfs_init_percpu_counters()
1186 struct xfs_mount *mp) in xfs_reinit_percpu_counters() argument
1188 percpu_counter_set(&mp->m_icount, mp->m_sb.sb_icount); in xfs_reinit_percpu_counters()
1189 percpu_counter_set(&mp->m_ifree, mp->m_sb.sb_ifree); in xfs_reinit_percpu_counters()
1190 xfs_set_freecounter(mp, XC_FREE_BLOCKS, mp->m_sb.sb_fdblocks); in xfs_reinit_percpu_counters()
1191 if (!xfs_has_zoned(mp)) in xfs_reinit_percpu_counters()
1192 xfs_set_freecounter(mp, XC_FREE_RTEXTENTS, in xfs_reinit_percpu_counters()
1193 mp->m_sb.sb_frextents); in xfs_reinit_percpu_counters()
1198 struct xfs_mount *mp) in xfs_destroy_percpu_counters() argument
1203 percpu_counter_destroy(&mp->m_free[i].count); in xfs_destroy_percpu_counters()
1204 percpu_counter_destroy(&mp->m_icount); in xfs_destroy_percpu_counters()
1205 percpu_counter_destroy(&mp->m_ifree); in xfs_destroy_percpu_counters()
1206 ASSERT(xfs_is_shutdown(mp) || in xfs_destroy_percpu_counters()
1207 percpu_counter_sum(&mp->m_delalloc_rtextents) == 0); in xfs_destroy_percpu_counters()
1208 percpu_counter_destroy(&mp->m_delalloc_rtextents); in xfs_destroy_percpu_counters()
1209 ASSERT(xfs_is_shutdown(mp) || in xfs_destroy_percpu_counters()
1210 percpu_counter_sum(&mp->m_delalloc_blks) == 0); in xfs_destroy_percpu_counters()
1211 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_destroy_percpu_counters()
1216 struct xfs_mount *mp) in xfs_inodegc_init_percpu() argument
1221 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1222 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1226 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1228 gc->mp = mp; in xfs_inodegc_init_percpu()
1239 struct xfs_mount *mp) in xfs_inodegc_free_percpu() argument
1241 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1243 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1250 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_put_super() local
1252 xfs_notice(mp, "Unmounting Filesystem %pU", &mp->m_sb.sb_uuid); in xfs_fs_put_super()
1253 xfs_filestream_unmount(mp); in xfs_fs_put_super()
1254 xfs_unmountfs(mp); in xfs_fs_put_super()
1256 xfs_rtmount_freesb(mp); in xfs_fs_put_super()
1257 xfs_freesb(mp); in xfs_fs_put_super()
1258 xchk_mount_stats_free(mp); in xfs_fs_put_super()
1259 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1260 xfs_inodegc_free_percpu(mp); in xfs_fs_put_super()
1261 xfs_destroy_percpu_counters(mp); in xfs_fs_put_super()
1262 xfs_destroy_mount_workqueues(mp); in xfs_fs_put_super()
1263 xfs_shutdown_devices(mp); in xfs_fs_put_super()
1297 struct xfs_mount *mp = XFS_M(root->d_sb); in xfs_fs_show_stats() local
1299 if (xfs_has_zoned(mp) && IS_ENABLED(CONFIG_XFS_RT)) in xfs_fs_show_stats()
1300 xfs_zoned_show_stats(m, mp); in xfs_fs_show_stats()
1590 struct xfs_mount *mp) in xfs_fs_validate_params() argument
1593 if (xfs_has_norecovery(mp) && !xfs_is_readonly(mp)) { in xfs_fs_validate_params()
1594 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1598 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1599 xfs_warn(mp, in xfs_fs_validate_params()
1605 (mp->m_qflags & ~XFS_QFLAGS_MNTOPTS)) { in xfs_fs_validate_params()
1606 xfs_warn(mp, "quota support not available in this kernel."); in xfs_fs_validate_params()
1610 if ((mp->m_dalign && !mp->m_swidth) || in xfs_fs_validate_params()
1611 (!mp->m_dalign && mp->m_swidth)) { in xfs_fs_validate_params()
1612 xfs_warn(mp, "sunit and swidth must be specified together"); in xfs_fs_validate_params()
1616 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1617 xfs_warn(mp, in xfs_fs_validate_params()
1619 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1623 if (mp->m_logbufs != -1 && in xfs_fs_validate_params()
1624 mp->m_logbufs != 0 && in xfs_fs_validate_params()
1625 (mp->m_logbufs < XLOG_MIN_ICLOGS || in xfs_fs_validate_params()
1626 mp->m_logbufs > XLOG_MAX_ICLOGS)) { in xfs_fs_validate_params()
1627 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", in xfs_fs_validate_params()
1628 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); in xfs_fs_validate_params()
1632 if (mp->m_logbsize != -1 && in xfs_fs_validate_params()
1633 mp->m_logbsize != 0 && in xfs_fs_validate_params()
1634 (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE || in xfs_fs_validate_params()
1635 mp->m_logbsize > XLOG_MAX_RECORD_BSIZE || in xfs_fs_validate_params()
1636 !is_power_of_2(mp->m_logbsize))) { in xfs_fs_validate_params()
1637 xfs_warn(mp, in xfs_fs_validate_params()
1639 mp->m_logbsize); in xfs_fs_validate_params()
1643 if (xfs_has_allocsize(mp) && in xfs_fs_validate_params()
1644 (mp->m_allocsize_log > XFS_MAX_IO_LOG || in xfs_fs_validate_params()
1645 mp->m_allocsize_log < XFS_MIN_IO_LOG)) { in xfs_fs_validate_params()
1646 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", in xfs_fs_validate_params()
1647 mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG); in xfs_fs_validate_params()
1674 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super() local
1678 mp->m_super = sb; in xfs_fs_fill_super()
1686 xfs_set_readonly(mp); in xfs_fs_fill_super()
1688 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_fs_fill_super()
1690 mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_fill_super()
1692 error = xfs_fs_validate_params(mp); in xfs_fs_fill_super()
1711 xfs_notice(mp, "Delaying mount for %d seconds.", in xfs_fs_fill_super()
1719 error = xfs_open_devices(mp); in xfs_fs_fill_super()
1724 mp->m_debugfs = xfs_debugfs_mkdir(mp->m_super->s_id, in xfs_fs_fill_super()
1727 mp->m_debugfs = NULL; in xfs_fs_fill_super()
1730 error = xfs_init_mount_workqueues(mp); in xfs_fs_fill_super()
1734 error = xfs_init_percpu_counters(mp); in xfs_fs_fill_super()
1738 error = xfs_inodegc_init_percpu(mp); in xfs_fs_fill_super()
1743 mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); in xfs_fs_fill_super()
1744 if (!mp->m_stats.xs_stats) { in xfs_fs_fill_super()
1749 error = xchk_mount_stats_alloc(mp); in xfs_fs_fill_super()
1753 error = xfs_readsb(mp, flags); in xfs_fs_fill_super()
1757 error = xfs_finish_flags(mp); in xfs_fs_fill_super()
1761 error = xfs_setup_devices(mp); in xfs_fs_fill_super()
1771 if (!(mp->m_features & XFS_FEAT_CRC)) { in xfs_fs_fill_super()
1773 xfs_warn(mp, in xfs_fs_fill_super()
1778 xfs_warn_once(mp, in xfs_fs_fill_super()
1783 if (xfs_has_asciici(mp)) { in xfs_fs_fill_super()
1785 xfs_warn_once(mp, in xfs_fs_fill_super()
1788 xfs_warn(mp, in xfs_fs_fill_super()
1800 if (xfs_has_needsrepair(mp) && !xfs_has_norecovery(mp)) { in xfs_fs_fill_super()
1801 xfs_warn(mp, "Filesystem needs repair. Please run xfs_repair."); in xfs_fs_fill_super()
1811 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1812 xfs_warn(mp, "Offline file system operation in progress!"); in xfs_fs_fill_super()
1817 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1820 if (!xfs_has_crc(mp)) { in xfs_fs_fill_super()
1821 xfs_warn(mp, in xfs_fs_fill_super()
1823 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1828 if (mp->m_sb.sb_blocksize > max_folio_size) { in xfs_fs_fill_super()
1829 xfs_warn(mp, in xfs_fs_fill_super()
1831 mp->m_sb.sb_blocksize, max_folio_size); in xfs_fs_fill_super()
1836 xfs_warn_experimental(mp, XFS_EXPERIMENTAL_LBS); in xfs_fs_fill_super()
1840 if (xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_dblocks) || in xfs_fs_fill_super()
1841 xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_rblocks)) { in xfs_fs_fill_super()
1842 xfs_warn(mp, in xfs_fs_fill_super()
1859 if (!xfs_verify_fileoff(mp, XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE))) { in xfs_fs_fill_super()
1860 xfs_warn(mp, in xfs_fs_fill_super()
1862 XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE), in xfs_fs_fill_super()
1868 error = xfs_rtmount_readsb(mp); in xfs_fs_fill_super()
1872 error = xfs_filestream_mount(mp); in xfs_fs_fill_super()
1881 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1886 if (xfs_has_bigtime(mp)) { in xfs_fs_fill_super()
1893 trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max); in xfs_fs_fill_super()
1899 if (xfs_has_crc(mp)) in xfs_fs_fill_super()
1902 if (xfs_has_dax_always(mp)) { in xfs_fs_fill_super()
1903 error = xfs_setup_dax_always(mp); in xfs_fs_fill_super()
1908 if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { in xfs_fs_fill_super()
1909 xfs_warn(mp, in xfs_fs_fill_super()
1911 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1914 if (xfs_has_zoned(mp)) { in xfs_fs_fill_super()
1915 if (!xfs_has_metadir(mp)) { in xfs_fs_fill_super()
1916 xfs_alert(mp, in xfs_fs_fill_super()
1921 xfs_warn_experimental(mp, XFS_EXPERIMENTAL_ZONED); in xfs_fs_fill_super()
1922 } else if (xfs_has_metadir(mp)) { in xfs_fs_fill_super()
1923 xfs_warn_experimental(mp, XFS_EXPERIMENTAL_METADIR); in xfs_fs_fill_super()
1926 if (xfs_has_reflink(mp)) { in xfs_fs_fill_super()
1927 if (xfs_has_realtime(mp) && in xfs_fs_fill_super()
1928 !xfs_reflink_supports_rextsize(mp, mp->m_sb.sb_rextsize)) { in xfs_fs_fill_super()
1929 xfs_alert(mp, in xfs_fs_fill_super()
1931 mp->m_sb.sb_rextsize); in xfs_fs_fill_super()
1936 if (xfs_has_zoned(mp)) { in xfs_fs_fill_super()
1937 xfs_alert(mp, in xfs_fs_fill_super()
1944 xfs_info(mp, "using DEBUG-only always_cow mode."); in xfs_fs_fill_super()
1945 mp->m_always_cow = true; in xfs_fs_fill_super()
1953 if (!(mp->m_qflags & XFS_QFLAGS_MNTOPTS)) in xfs_fs_fill_super()
1954 xfs_set_resuming_quotaon(mp); in xfs_fs_fill_super()
1955 mp->m_qflags &= ~XFS_QFLAGS_MNTOPTS; in xfs_fs_fill_super()
1957 error = xfs_mountfs(mp); in xfs_fs_fill_super()
1961 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1975 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1977 xfs_rtmount_freesb(mp); in xfs_fs_fill_super()
1979 xfs_freesb(mp); in xfs_fs_fill_super()
1981 xchk_mount_stats_free(mp); in xfs_fs_fill_super()
1983 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1985 xfs_inodegc_free_percpu(mp); in xfs_fs_fill_super()
1987 xfs_destroy_percpu_counters(mp); in xfs_fs_fill_super()
1989 xfs_destroy_mount_workqueues(mp); in xfs_fs_fill_super()
1991 xfs_shutdown_devices(mp); in xfs_fs_fill_super()
1995 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1996 xfs_unmountfs(mp); in xfs_fs_fill_super()
2009 struct xfs_mount *mp) in xfs_remount_rw() argument
2011 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
2014 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp && in xfs_remount_rw()
2015 xfs_readonly_buftarg(mp->m_logdev_targp)) { in xfs_remount_rw()
2016 xfs_warn(mp, in xfs_remount_rw()
2021 if (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp)) { in xfs_remount_rw()
2022 xfs_warn(mp, in xfs_remount_rw()
2027 if (xfs_has_norecovery(mp)) { in xfs_remount_rw()
2028 xfs_warn(mp, in xfs_remount_rw()
2035 xfs_warn(mp, in xfs_remount_rw()
2042 xfs_clear_readonly(mp); in xfs_remount_rw()
2048 if (mp->m_update_sb) { in xfs_remount_rw()
2049 error = xfs_sync_sb(mp, false); in xfs_remount_rw()
2051 xfs_warn(mp, "failed to write sb changes"); in xfs_remount_rw()
2054 mp->m_update_sb = false; in xfs_remount_rw()
2061 xfs_restore_resvblks(mp); in xfs_remount_rw()
2062 xfs_log_work_queue(mp); in xfs_remount_rw()
2063 xfs_blockgc_start(mp); in xfs_remount_rw()
2066 error = xfs_fs_reserve_ag_blocks(mp); in xfs_remount_rw()
2071 xfs_inodegc_start(mp); in xfs_remount_rw()
2074 xfs_zone_gc_start(mp); in xfs_remount_rw()
2081 struct xfs_mount *mp) in xfs_remount_ro() argument
2089 error = sync_filesystem(mp->m_super); in xfs_remount_ro()
2097 xfs_blockgc_stop(mp); in xfs_remount_ro()
2105 error = xfs_blockgc_free_space(mp, &icw); in xfs_remount_ro()
2107 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_remount_ro()
2118 xfs_inodegc_stop(mp); in xfs_remount_ro()
2121 xfs_zone_gc_stop(mp); in xfs_remount_ro()
2124 xfs_fs_unreserve_ag_blocks(mp); in xfs_remount_ro()
2133 xfs_save_resvblks(mp); in xfs_remount_ro()
2135 xfs_log_clean(mp); in xfs_remount_ro()
2136 xfs_set_readonly(mp); in xfs_remount_ro()
2157 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure() local
2165 if (xfs_has_crc(mp)) in xfs_fs_reconfigure()
2173 if (mp->m_awu_max_bytes != new_mp->m_awu_max_bytes) { in xfs_fs_reconfigure()
2174 error = xfs_set_max_atomic_write_opt(mp, in xfs_fs_reconfigure()
2181 if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
2182 mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
2183 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
2187 if (!xfs_has_small_inums(mp) && xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
2188 mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
2189 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
2199 error = xfs_finish_flags(mp); in xfs_fs_reconfigure()
2204 if (xfs_is_readonly(mp) && !(flags & SB_RDONLY)) { in xfs_fs_reconfigure()
2205 error = xfs_remount_rw(mp); in xfs_fs_reconfigure()
2211 if (!xfs_is_readonly(mp) && (flags & SB_RDONLY)) { in xfs_fs_reconfigure()
2212 error = xfs_remount_ro(mp); in xfs_fs_reconfigure()
2224 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free() local
2232 if (mp) in xfs_fs_free()
2233 xfs_mount_free(mp); in xfs_fs_free()
2252 struct xfs_mount *mp; in xfs_init_fs_context() local
2255 mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL); in xfs_init_fs_context()
2256 if (!mp) in xfs_init_fs_context()
2259 spin_lock_init(&mp->m_sb_lock); in xfs_init_fs_context()
2261 xa_init(&mp->m_groups[i].xa); in xfs_init_fs_context()
2262 mutex_init(&mp->m_growlock); in xfs_init_fs_context()
2263 mutex_init(&mp->m_metafile_resv_lock); in xfs_init_fs_context()
2264 INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); in xfs_init_fs_context()
2265 INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); in xfs_init_fs_context()
2266 mp->m_kobj.kobject.kset = xfs_kset; in xfs_init_fs_context()
2273 mp->m_finobt_nores = true; in xfs_init_fs_context()
2278 mp->m_logbufs = -1; in xfs_init_fs_context()
2279 mp->m_logbsize = -1; in xfs_init_fs_context()
2280 mp->m_allocsize_log = 16; /* 64k */ in xfs_init_fs_context()
2282 xfs_hooks_init(&mp->m_dir_update_hooks); in xfs_init_fs_context()
2284 fc->s_fs_info = mp; in xfs_init_fs_context()