Lines Matching refs:mp
65 struct xfs_mount *mp) in xfs_uuid_mount() argument
67 uuid_t *uuid = &mp->m_sb.sb_uuid; in xfs_uuid_mount()
71 super_set_uuid(mp->m_super, uuid->b, sizeof(*uuid)); in xfs_uuid_mount()
73 if (xfs_has_nouuid(mp)) in xfs_uuid_mount()
77 xfs_warn(mp, "Filesystem has null UUID - can't mount"); in xfs_uuid_mount()
104 xfs_warn(mp, "Filesystem has duplicate UUID %pU - can't mount", uuid); in xfs_uuid_mount()
110 struct xfs_mount *mp) in xfs_uuid_unmount() argument
112 uuid_t *uuid = &mp->m_sb.sb_uuid; in xfs_uuid_unmount()
115 if (xfs_has_nouuid(mp)) in xfs_uuid_unmount()
160 struct xfs_mount *mp, in xfs_readsb() argument
165 struct xfs_sb *sbp = &mp->m_sb; in xfs_readsb()
170 ASSERT(mp->m_sb_bp == NULL); in xfs_readsb()
171 ASSERT(mp->m_ddev_targp != NULL); in xfs_readsb()
181 sector_size = mp->m_ddev_targp->bt_logical_sectorsize; in xfs_readsb()
185 error = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR, in xfs_readsb()
189 xfs_warn(mp, "SB validate failed with error %d.", error); in xfs_readsb()
207 xfs_warn(mp, "Invalid superblock magic number"); in xfs_readsb()
217 xfs_warn(mp, "device supports %u byte sectors (not %u)", in xfs_readsb()
234 mp->m_features |= xfs_sb_version_to_features(sbp); in xfs_readsb()
235 xfs_reinit_percpu_counters(mp); in xfs_readsb()
241 if (xfs_sb_version_haslogxattrs(&mp->m_sb)) in xfs_readsb()
242 xfs_set_using_logged_xattrs(mp); in xfs_readsb()
251 mp->m_sb_bp = bp; in xfs_readsb()
268 struct xfs_mount *mp, in xfs_check_new_dalign() argument
272 struct xfs_sb *sbp = &mp->m_sb; in xfs_check_new_dalign()
275 calc_ino = xfs_ialloc_calc_rootino(mp, new_dalign); in xfs_check_new_dalign()
276 trace_xfs_check_new_dalign(mp, new_dalign, calc_ino); in xfs_check_new_dalign()
283 xfs_warn(mp, in xfs_check_new_dalign()
291 xfs_warn(mp, "Skipping superblock stripe alignment update."); in xfs_check_new_dalign()
304 struct xfs_mount *mp) in xfs_validate_new_dalign() argument
306 if (mp->m_dalign == 0) in xfs_validate_new_dalign()
313 if ((BBTOB(mp->m_dalign) & mp->m_blockmask) || in xfs_validate_new_dalign()
314 (BBTOB(mp->m_swidth) & mp->m_blockmask)) { in xfs_validate_new_dalign()
315 xfs_warn(mp, in xfs_validate_new_dalign()
317 mp->m_sb.sb_blocksize); in xfs_validate_new_dalign()
324 mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign); in xfs_validate_new_dalign()
325 if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) { in xfs_validate_new_dalign()
326 xfs_warn(mp, in xfs_validate_new_dalign()
328 mp->m_sb.sb_agblocks); in xfs_validate_new_dalign()
332 if (!mp->m_dalign) { in xfs_validate_new_dalign()
333 xfs_warn(mp, in xfs_validate_new_dalign()
335 mp->m_dalign, mp->m_sb.sb_blocksize); in xfs_validate_new_dalign()
339 mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth); in xfs_validate_new_dalign()
341 if (!xfs_has_dalign(mp)) { in xfs_validate_new_dalign()
342 xfs_warn(mp, in xfs_validate_new_dalign()
353 struct xfs_mount *mp) in xfs_update_alignment() argument
355 struct xfs_sb *sbp = &mp->m_sb; in xfs_update_alignment()
357 if (mp->m_dalign) { in xfs_update_alignment()
361 if (sbp->sb_unit == mp->m_dalign && in xfs_update_alignment()
362 sbp->sb_width == mp->m_swidth) in xfs_update_alignment()
365 error = xfs_check_new_dalign(mp, mp->m_dalign, &update_sb); in xfs_update_alignment()
369 sbp->sb_unit = mp->m_dalign; in xfs_update_alignment()
370 sbp->sb_width = mp->m_swidth; in xfs_update_alignment()
371 mp->m_update_sb = true; in xfs_update_alignment()
372 } else if (!xfs_has_noalign(mp) && xfs_has_dalign(mp)) { in xfs_update_alignment()
373 mp->m_dalign = sbp->sb_unit; in xfs_update_alignment()
374 mp->m_swidth = sbp->sb_width; in xfs_update_alignment()
385 struct xfs_mount *mp) in xfs_set_low_space_thresholds() argument
387 uint64_t dblocks = mp->m_sb.sb_dblocks; in xfs_set_low_space_thresholds()
388 uint64_t rtexts = mp->m_sb.sb_rextents; in xfs_set_low_space_thresholds()
395 mp->m_low_space[i] = dblocks * (i + 1); in xfs_set_low_space_thresholds()
396 mp->m_low_rtexts[i] = rtexts * (i + 1); in xfs_set_low_space_thresholds()
405 struct xfs_mount *mp) in xfs_check_sizes() argument
411 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); in xfs_check_sizes()
412 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { in xfs_check_sizes()
413 xfs_warn(mp, "filesystem size mismatch detected"); in xfs_check_sizes()
416 error = xfs_buf_read_uncached(mp->m_ddev_targp, in xfs_check_sizes()
417 d - XFS_FSS_TO_BB(mp, 1), in xfs_check_sizes()
418 XFS_FSS_TO_BB(mp, 1), &bp, NULL); in xfs_check_sizes()
420 xfs_warn(mp, "last sector read failed"); in xfs_check_sizes()
425 if (mp->m_logdev_targp == mp->m_ddev_targp) in xfs_check_sizes()
428 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); in xfs_check_sizes()
429 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { in xfs_check_sizes()
430 xfs_warn(mp, "log size mismatch detected"); in xfs_check_sizes()
433 error = xfs_buf_read_uncached(mp->m_logdev_targp, in xfs_check_sizes()
434 d - XFS_FSB_TO_BB(mp, 1), in xfs_check_sizes()
435 XFS_FSB_TO_BB(mp, 1), &bp, NULL); in xfs_check_sizes()
437 xfs_warn(mp, "log device read failed"); in xfs_check_sizes()
449 struct xfs_mount *mp) in xfs_mount_reset_sbqflags() argument
451 mp->m_qflags = 0; in xfs_mount_reset_sbqflags()
454 if (mp->m_sb.sb_qflags == 0) in xfs_mount_reset_sbqflags()
456 spin_lock(&mp->m_sb_lock); in xfs_mount_reset_sbqflags()
457 mp->m_sb.sb_qflags = 0; in xfs_mount_reset_sbqflags()
458 spin_unlock(&mp->m_sb_lock); in xfs_mount_reset_sbqflags()
460 if (!xfs_fs_writable(mp, SB_FREEZE_WRITE)) in xfs_mount_reset_sbqflags()
463 return xfs_sync_sb(mp, false); in xfs_mount_reset_sbqflags()
474 struct xfs_mount *mp, in xfs_default_resblks() argument
488 return min(div_u64(mp->m_sb.sb_dblocks, 20), 8192ULL); in xfs_default_resblks()
491 if (IS_ENABLED(CONFIG_XFS_RT) && xfs_has_zoned(mp)) in xfs_default_resblks()
492 return xfs_zoned_default_resblks(mp, ctr); in xfs_default_resblks()
503 struct xfs_mount *mp) in xfs_check_summary_counts() argument
511 if (mp->m_sb.sb_inprogress) { in xfs_check_summary_counts()
512 xfs_err(mp, "sb_inprogress set after log recovery??"); in xfs_check_summary_counts()
528 if (xfs_is_clean(mp) && in xfs_check_summary_counts()
529 (mp->m_sb.sb_fdblocks > mp->m_sb.sb_dblocks || in xfs_check_summary_counts()
530 !xfs_verify_icount(mp, mp->m_sb.sb_icount) || in xfs_check_summary_counts()
531 mp->m_sb.sb_ifree > mp->m_sb.sb_icount)) in xfs_check_summary_counts()
532 xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS); in xfs_check_summary_counts()
545 if ((xfs_has_lazysbcount(mp) && !xfs_is_clean(mp)) || in xfs_check_summary_counts()
546 xfs_fs_has_sickness(mp, XFS_SICK_FS_COUNTERS)) { in xfs_check_summary_counts()
547 error = xfs_initialize_perag_data(mp, mp->m_sb.sb_agcount); in xfs_check_summary_counts()
564 if (xfs_has_realtime(mp) && !xfs_has_zoned(mp) && !xfs_is_clean(mp)) { in xfs_check_summary_counts()
565 error = xfs_rtalloc_reinit_frextents(mp); in xfs_check_summary_counts()
575 struct xfs_mount *mp) in xfs_unmount_check() argument
577 if (xfs_is_shutdown(mp)) in xfs_unmount_check()
580 if (percpu_counter_sum(&mp->m_ifree) > in xfs_unmount_check()
581 percpu_counter_sum(&mp->m_icount)) { in xfs_unmount_check()
582 xfs_alert(mp, "ifree/icount mismatch at unmount"); in xfs_unmount_check()
583 xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS); in xfs_unmount_check()
615 struct xfs_mount *mp) in xfs_unmount_flush_inodes() argument
617 xfs_log_force(mp, XFS_LOG_SYNC); in xfs_unmount_flush_inodes()
618 xfs_extent_busy_wait_all(mp); in xfs_unmount_flush_inodes()
621 xfs_set_unmounting(mp); in xfs_unmount_flush_inodes()
623 xfs_ail_push_all_sync(mp->m_ail); in xfs_unmount_flush_inodes()
624 xfs_inodegc_stop(mp); in xfs_unmount_flush_inodes()
625 cancel_delayed_work_sync(&mp->m_reclaim_work); in xfs_unmount_flush_inodes()
626 xfs_reclaim_inodes(mp); in xfs_unmount_flush_inodes()
627 xfs_health_unmount(mp); in xfs_unmount_flush_inodes()
632 struct xfs_mount *mp) in xfs_mount_setup_inode_geom() argument
634 struct xfs_ino_geometry *igeo = M_IGEO(mp); in xfs_mount_setup_inode_geom()
636 igeo->attr_fork_offset = xfs_bmap_compute_attr_offset(mp); in xfs_mount_setup_inode_geom()
637 ASSERT(igeo->attr_fork_offset < XFS_LITINO(mp)); in xfs_mount_setup_inode_geom()
639 xfs_ialloc_setup_geometry(mp); in xfs_mount_setup_inode_geom()
645 struct xfs_mount *mp) in xfs_mount_setup_metadir() argument
650 error = xfs_metafile_iget(mp, mp->m_sb.sb_metadirino, XFS_METAFILE_DIR, in xfs_mount_setup_metadir()
651 &mp->m_metadirip); in xfs_mount_setup_metadir()
653 xfs_warn(mp, "Failed to load metadir root directory, error %d", in xfs_mount_setup_metadir()
661 struct xfs_mount *mp) in xfs_agbtree_compute_maxlevels() argument
665 levels = max(mp->m_alloc_maxlevels, M_IGEO(mp)->inobt_maxlevels); in xfs_agbtree_compute_maxlevels()
666 levels = max(levels, mp->m_rmap_maxlevels); in xfs_agbtree_compute_maxlevels()
667 mp->m_agbtree_maxlevels = max(levels, mp->m_refc_maxlevels); in xfs_agbtree_compute_maxlevels()
671 static inline xfs_extlen_t xfs_calc_atomic_write_max(struct xfs_mount *mp) in xfs_calc_atomic_write_max() argument
673 return rounddown_pow_of_two(XFS_B_TO_FSB(mp, MAX_RW_COUNT)); in xfs_calc_atomic_write_max()
689 struct xfs_mount *mp, in xfs_calc_group_awu_max() argument
692 struct xfs_groups *g = &mp->m_groups[type]; in xfs_calc_group_awu_max()
693 struct xfs_buftarg *btp = xfs_group_type_buftarg(mp, type); in xfs_calc_group_awu_max()
705 struct xfs_mount *mp, in xfs_calc_atomic_write_unit_max() argument
708 struct xfs_groups *g = &mp->m_groups[type]; in xfs_calc_atomic_write_unit_max()
710 const xfs_extlen_t max_write = xfs_calc_atomic_write_max(mp); in xfs_calc_atomic_write_unit_max()
711 const xfs_extlen_t max_ioend = xfs_reflink_max_atomic_cow(mp); in xfs_calc_atomic_write_unit_max()
712 const xfs_extlen_t max_gsize = xfs_calc_group_awu_max(mp, type); in xfs_calc_atomic_write_unit_max()
715 trace_xfs_calc_atomic_write_unit_max(mp, type, max_write, max_ioend, in xfs_calc_atomic_write_unit_max()
725 struct xfs_mount *mp, in xfs_set_max_atomic_write_opt() argument
728 const xfs_filblks_t new_max_fsbs = XFS_B_TO_FSBT(mp, new_max_bytes); in xfs_set_max_atomic_write_opt()
729 const xfs_extlen_t max_write = xfs_calc_atomic_write_max(mp); in xfs_set_max_atomic_write_opt()
731 max(mp->m_groups[XG_TYPE_AG].blocks, in xfs_set_max_atomic_write_opt()
732 mp->m_groups[XG_TYPE_RTG].blocks); in xfs_set_max_atomic_write_opt()
734 max(xfs_calc_group_awu_max(mp, XG_TYPE_AG), in xfs_set_max_atomic_write_opt()
735 xfs_calc_group_awu_max(mp, XG_TYPE_RTG)); in xfs_set_max_atomic_write_opt()
745 xfs_warn(mp, in xfs_set_max_atomic_write_opt()
751 if (new_max_bytes & mp->m_blockmask) { in xfs_set_max_atomic_write_opt()
752 xfs_warn(mp, in xfs_set_max_atomic_write_opt()
759 xfs_warn(mp, in xfs_set_max_atomic_write_opt()
762 XFS_FSB_TO_B(mp, max_write) >> 10); in xfs_set_max_atomic_write_opt()
767 xfs_warn(mp, in xfs_set_max_atomic_write_opt()
770 XFS_FSB_TO_B(mp, max_group) >> 10); in xfs_set_max_atomic_write_opt()
775 xfs_warn(mp, in xfs_set_max_atomic_write_opt()
778 XFS_FSB_TO_B(mp, max_group_write) >> 10); in xfs_set_max_atomic_write_opt()
782 if (xfs_has_reflink(mp)) in xfs_set_max_atomic_write_opt()
786 if (mp->m_ddev_targp->bt_awu_max || in xfs_set_max_atomic_write_opt()
787 (mp->m_rtdev_targp && mp->m_rtdev_targp->bt_awu_max)) { in xfs_set_max_atomic_write_opt()
789 xfs_warn(mp, in xfs_set_max_atomic_write_opt()
795 xfs_warn(mp, in xfs_set_max_atomic_write_opt()
802 error = xfs_calc_atomic_write_reservation(mp, new_max_fsbs); in xfs_set_max_atomic_write_opt()
804 xfs_warn(mp, in xfs_set_max_atomic_write_opt()
810 xfs_calc_atomic_write_unit_max(mp, XG_TYPE_AG); in xfs_set_max_atomic_write_opt()
811 xfs_calc_atomic_write_unit_max(mp, XG_TYPE_RTG); in xfs_set_max_atomic_write_opt()
812 mp->m_awu_max_bytes = new_max_bytes; in xfs_set_max_atomic_write_opt()
819 struct xfs_mount *mp) in xfs_rtbtree_compute_maxlevels() argument
821 mp->m_rtbtree_maxlevels = max(mp->m_rtrmap_maxlevels, in xfs_rtbtree_compute_maxlevels()
822 mp->m_rtrefc_maxlevels); in xfs_rtbtree_compute_maxlevels()
837 struct xfs_mount *mp) in xfs_mountfs() argument
839 struct xfs_sb *sbp = &(mp->m_sb); in xfs_mountfs()
841 struct xfs_ino_geometry *igeo = M_IGEO(mp); in xfs_mountfs()
847 xfs_sb_mount_common(mp, sbp); in xfs_mountfs()
866 xfs_warn(mp, "correcting sb_features alignment problem"); in xfs_mountfs()
868 mp->m_update_sb = true; in xfs_mountfs()
873 if (!(mp->m_sb.sb_versionnum & XFS_SB_VERSION_NLINKBIT)) { in xfs_mountfs()
874 mp->m_sb.sb_versionnum |= XFS_SB_VERSION_NLINKBIT; in xfs_mountfs()
875 mp->m_features |= XFS_FEAT_NLINK; in xfs_mountfs()
876 mp->m_update_sb = true; in xfs_mountfs()
885 error = xfs_validate_new_dalign(mp); in xfs_mountfs()
889 xfs_alloc_compute_maxlevels(mp); in xfs_mountfs()
890 xfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK); in xfs_mountfs()
891 xfs_bmap_compute_maxlevels(mp, XFS_ATTR_FORK); in xfs_mountfs()
892 xfs_mount_setup_inode_geom(mp); in xfs_mountfs()
893 xfs_rmapbt_compute_maxlevels(mp); in xfs_mountfs()
894 xfs_rtrmapbt_compute_maxlevels(mp); in xfs_mountfs()
895 xfs_refcountbt_compute_maxlevels(mp); in xfs_mountfs()
896 xfs_rtrefcountbt_compute_maxlevels(mp); in xfs_mountfs()
898 xfs_agbtree_compute_maxlevels(mp); in xfs_mountfs()
899 xfs_rtbtree_compute_maxlevels(mp); in xfs_mountfs()
908 error = xfs_update_alignment(mp); in xfs_mountfs()
913 mp->m_fail_unmount = true; in xfs_mountfs()
915 error = xfs_mount_sysfs_init(mp); in xfs_mountfs()
919 xchk_stats_register(mp->m_scrub_stats, mp->m_debugfs); in xfs_mountfs()
921 error = xfs_errortag_init(mp); in xfs_mountfs()
925 error = xfs_uuid_mount(mp); in xfs_mountfs()
933 mp->m_allocsize_log = in xfs_mountfs()
934 max_t(uint32_t, sbp->sb_blocklog, mp->m_allocsize_log); in xfs_mountfs()
935 mp->m_allocsize_blocks = 1U << (mp->m_allocsize_log - sbp->sb_blocklog); in xfs_mountfs()
938 xfs_set_low_space_thresholds(mp); in xfs_mountfs()
945 if (xfs_has_sparseinodes(mp) && in xfs_mountfs()
946 mp->m_sb.sb_spino_align != in xfs_mountfs()
947 XFS_B_TO_FSBT(mp, igeo->inode_cluster_size_raw)) { in xfs_mountfs()
948 xfs_warn(mp, in xfs_mountfs()
950 mp->m_sb.sb_spino_align, in xfs_mountfs()
951 XFS_B_TO_FSBT(mp, igeo->inode_cluster_size_raw)); in xfs_mountfs()
959 error = xfs_check_sizes(mp); in xfs_mountfs()
966 error = xfs_rtmount_init(mp); in xfs_mountfs()
968 xfs_warn(mp, "RT mount failed"); in xfs_mountfs()
976 mp->m_fixedfsid[0] = in xfs_mountfs()
979 mp->m_fixedfsid[1] = get_unaligned_be32(&sbp->sb_uuid.b[0]); in xfs_mountfs()
981 error = xfs_da_mount(mp); in xfs_mountfs()
983 xfs_warn(mp, "Failed dir/attr init: %d", error); in xfs_mountfs()
990 xfs_trans_init(mp); in xfs_mountfs()
995 error = xfs_initialize_perag(mp, 0, sbp->sb_agcount, in xfs_mountfs()
996 mp->m_sb.sb_dblocks, &mp->m_maxagi); in xfs_mountfs()
998 xfs_warn(mp, "Failed per-ag init: %d", error); in xfs_mountfs()
1002 error = xfs_initialize_rtgroups(mp, 0, sbp->sb_rgcount, in xfs_mountfs()
1003 mp->m_sb.sb_rextents); in xfs_mountfs()
1005 xfs_warn(mp, "Failed rtgroup init: %d", error); in xfs_mountfs()
1009 if (XFS_IS_CORRUPT(mp, !sbp->sb_logblocks)) { in xfs_mountfs()
1010 xfs_warn(mp, "no log defined"); in xfs_mountfs()
1015 error = xfs_inodegc_register_shrinker(mp); in xfs_mountfs()
1023 if (xfs_is_resuming_quotaon(mp)) in xfs_mountfs()
1024 xfs_qm_resume_quotaon(mp); in xfs_mountfs()
1031 error = xfs_log_mount(mp, mp->m_logdev_targp, in xfs_mountfs()
1032 XFS_FSB_TO_DADDR(mp, sbp->sb_logstart), in xfs_mountfs()
1033 XFS_FSB_TO_BB(mp, sbp->sb_logblocks)); in xfs_mountfs()
1035 xfs_warn(mp, "log mount failed"); in xfs_mountfs()
1044 if (xfs_clear_resuming_quotaon(mp) && xlog_recovery_needed(mp->m_log)) in xfs_mountfs()
1045 xfs_qm_resume_quotaon(mp); in xfs_mountfs()
1051 if (xfs_sb_version_haslogxattrs(&mp->m_sb)) in xfs_mountfs()
1052 xfs_set_using_logged_xattrs(mp); in xfs_mountfs()
1054 xfs_clear_using_logged_xattrs(mp); in xfs_mountfs()
1057 xfs_inodegc_start(mp); in xfs_mountfs()
1058 xfs_blockgc_start(mp); in xfs_mountfs()
1060 if (xfs_has_metadir(mp)) { in xfs_mountfs()
1061 error = xfs_mount_setup_metadir(mp); in xfs_mountfs()
1070 error = xfs_iget(mp, NULL, sbp->sb_rootino, XFS_IGET_UNTRUSTED, in xfs_mountfs()
1073 xfs_warn(mp, in xfs_mountfs()
1081 if (XFS_IS_CORRUPT(mp, !S_ISDIR(VFS_I(rip)->i_mode))) { in xfs_mountfs()
1082 xfs_warn(mp, "corrupted root inode %llu: not a directory", in xfs_mountfs()
1088 mp->m_rootip = rip; /* save it */ in xfs_mountfs()
1095 error = xfs_rtmount_inodes(mp); in xfs_mountfs()
1100 xfs_warn(mp, "failed to read RT inodes"); in xfs_mountfs()
1105 error = xfs_check_summary_counts(mp); in xfs_mountfs()
1114 if (mp->m_update_sb && !xfs_is_readonly(mp)) { in xfs_mountfs()
1115 error = xfs_sync_sb(mp, false); in xfs_mountfs()
1117 xfs_warn(mp, "failed to write sb changes"); in xfs_mountfs()
1125 if (XFS_IS_QUOTA_ON(mp)) { in xfs_mountfs()
1126 error = xfs_qm_newmount(mp, "amount, "aflags); in xfs_mountfs()
1135 if (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT) { in xfs_mountfs()
1136 xfs_notice(mp, "resetting quota flags"); in xfs_mountfs()
1137 error = xfs_mount_reset_sbqflags(mp); in xfs_mountfs()
1151 error = xfs_fs_reserve_ag_blocks(mp); in xfs_mountfs()
1153 xfs_warn(mp, in xfs_mountfs()
1155 error = xfs_log_mount_finish(mp); in xfs_mountfs()
1156 xfs_fs_unreserve_ag_blocks(mp); in xfs_mountfs()
1158 xfs_warn(mp, "log mount finish failed"); in xfs_mountfs()
1171 if (xfs_is_readonly(mp) && !xfs_has_norecovery(mp)) in xfs_mountfs()
1172 xfs_log_clean(mp); in xfs_mountfs()
1174 if (xfs_has_zoned(mp)) { in xfs_mountfs()
1175 error = xfs_mount_zones(mp); in xfs_mountfs()
1184 ASSERT(mp->m_qflags == 0); in xfs_mountfs()
1185 mp->m_qflags = quotaflags; in xfs_mountfs()
1187 xfs_qm_mount_quotas(mp); in xfs_mountfs()
1201 if (!xfs_is_readonly(mp)) { in xfs_mountfs()
1203 error = xfs_reserve_blocks(mp, i, in xfs_mountfs()
1204 xfs_default_resblks(mp, i)); in xfs_mountfs()
1206 xfs_warn(mp, in xfs_mountfs()
1212 error = xfs_fs_reserve_ag_blocks(mp); in xfs_mountfs()
1216 xfs_zone_gc_start(mp); in xfs_mountfs()
1224 error = xfs_set_max_atomic_write_opt(mp, mp->m_awu_max_bytes); in xfs_mountfs()
1231 xfs_fs_unreserve_ag_blocks(mp); in xfs_mountfs()
1232 xfs_qm_unmount_quotas(mp); in xfs_mountfs()
1233 if (xfs_has_zoned(mp)) in xfs_mountfs()
1234 xfs_unmount_zones(mp); in xfs_mountfs()
1236 xfs_rtunmount_inodes(mp); in xfs_mountfs()
1240 xfs_qm_unmount(mp); in xfs_mountfs()
1242 if (mp->m_metadirip) in xfs_mountfs()
1243 xfs_irele(mp->m_metadirip); in xfs_mountfs()
1251 xfs_inodegc_flush(mp); in xfs_mountfs()
1264 xfs_unmount_flush_inodes(mp); in xfs_mountfs()
1265 xfs_log_mount_cancel(mp); in xfs_mountfs()
1267 shrinker_free(mp->m_inodegc_shrinker); in xfs_mountfs()
1269 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) in xfs_mountfs()
1270 xfs_buftarg_drain(mp->m_logdev_targp); in xfs_mountfs()
1271 xfs_buftarg_drain(mp->m_ddev_targp); in xfs_mountfs()
1273 xfs_free_rtgroups(mp, 0, mp->m_sb.sb_rgcount); in xfs_mountfs()
1275 xfs_free_perag_range(mp, 0, mp->m_sb.sb_agcount); in xfs_mountfs()
1277 xfs_da_unmount(mp); in xfs_mountfs()
1279 xfs_uuid_unmount(mp); in xfs_mountfs()
1281 xfs_errortag_del(mp); in xfs_mountfs()
1283 xfs_mount_sysfs_del(mp); in xfs_mountfs()
1285 xchk_stats_unregister(mp->m_scrub_stats); in xfs_mountfs()
1296 struct xfs_mount *mp) in xfs_unmountfs() argument
1308 xfs_inodegc_flush(mp); in xfs_unmountfs()
1310 xfs_blockgc_stop(mp); in xfs_unmountfs()
1311 if (!test_bit(XFS_OPSTATE_READONLY, &mp->m_opstate)) in xfs_unmountfs()
1312 xfs_zone_gc_stop(mp); in xfs_unmountfs()
1313 xfs_fs_unreserve_ag_blocks(mp); in xfs_unmountfs()
1314 xfs_qm_unmount_quotas(mp); in xfs_unmountfs()
1315 if (xfs_has_zoned(mp)) in xfs_unmountfs()
1316 xfs_unmount_zones(mp); in xfs_unmountfs()
1317 xfs_rtunmount_inodes(mp); in xfs_unmountfs()
1318 xfs_irele(mp->m_rootip); in xfs_unmountfs()
1319 if (mp->m_metadirip) in xfs_unmountfs()
1320 xfs_irele(mp->m_metadirip); in xfs_unmountfs()
1322 xfs_unmount_flush_inodes(mp); in xfs_unmountfs()
1324 xfs_qm_unmount(mp); in xfs_unmountfs()
1340 error = xfs_reserve_blocks(mp, XC_FREE_BLOCKS, 0); in xfs_unmountfs()
1342 xfs_warn(mp, "Unable to free reserved block pool. " in xfs_unmountfs()
1344 xfs_unmount_check(mp); in xfs_unmountfs()
1350 xfs_set_done_with_log_incompat(mp); in xfs_unmountfs()
1351 xfs_log_unmount(mp); in xfs_unmountfs()
1352 xfs_da_unmount(mp); in xfs_unmountfs()
1353 xfs_uuid_unmount(mp); in xfs_unmountfs()
1356 xfs_errortag_clearall(mp); in xfs_unmountfs()
1358 shrinker_free(mp->m_inodegc_shrinker); in xfs_unmountfs()
1359 xfs_free_rtgroups(mp, 0, mp->m_sb.sb_rgcount); in xfs_unmountfs()
1360 xfs_free_perag_range(mp, 0, mp->m_sb.sb_agcount); in xfs_unmountfs()
1361 xfs_errortag_del(mp); in xfs_unmountfs()
1362 xchk_stats_unregister(mp->m_scrub_stats); in xfs_unmountfs()
1363 xfs_mount_sysfs_del(mp); in xfs_unmountfs()
1374 struct xfs_mount *mp, in xfs_fs_writable() argument
1378 if ((mp->m_super->s_writers.frozen >= level) || in xfs_fs_writable()
1379 xfs_is_shutdown(mp) || xfs_is_readonly(mp)) in xfs_fs_writable()
1395 struct xfs_mount *mp, in xfs_freecounter_unavailable() argument
1400 return mp->m_alloc_set_aside + atomic64_read(&mp->m_allocbt_blks); in xfs_freecounter_unavailable()
1405 struct xfs_mount *mp, in xfs_add_freecounter() argument
1409 struct xfs_freecounter *counter = &mp->m_free[ctr]; in xfs_add_freecounter()
1421 spin_lock(&mp->m_sb_lock); in xfs_add_freecounter()
1430 spin_unlock(&mp->m_sb_lock); in xfs_add_freecounter()
1437 struct xfs_mount *mp, in xfs_dec_freecounter() argument
1442 struct xfs_freecounter *counter = &mp->m_free[ctr]; in xfs_dec_freecounter()
1474 xfs_freecounter_unavailable(mp, ctr), in xfs_dec_freecounter()
1480 spin_lock(&mp->m_sb_lock); in xfs_dec_freecounter()
1486 xfs_warn_once(mp, in xfs_dec_freecounter()
1491 trace_xfs_freecounter_reserved(mp, ctr, delta, _RET_IP_); in xfs_dec_freecounter()
1492 spin_unlock(&mp->m_sb_lock); in xfs_dec_freecounter()
1499 trace_xfs_freecounter_enospc(mp, ctr, delta, _RET_IP_); in xfs_dec_freecounter()
1500 spin_unlock(&mp->m_sb_lock); in xfs_dec_freecounter()
1509 struct xfs_mount *mp) in xfs_freesb() argument
1511 struct xfs_buf *bp = mp->m_sb_bp; in xfs_freesb()
1514 mp->m_sb_bp = NULL; in xfs_freesb()
1524 struct xfs_mount *mp, in xfs_dev_is_read_only() argument
1527 if (xfs_readonly_buftarg(mp->m_ddev_targp) || in xfs_dev_is_read_only()
1528 xfs_readonly_buftarg(mp->m_logdev_targp) || in xfs_dev_is_read_only()
1529 (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) { in xfs_dev_is_read_only()
1530 xfs_notice(mp, "%s required on read-only device.", message); in xfs_dev_is_read_only()
1531 xfs_notice(mp, "write access unavailable, cannot proceed."); in xfs_dev_is_read_only()
1540 struct xfs_mount *mp) in xfs_force_summary_recalc() argument
1542 if (!xfs_has_lazysbcount(mp)) in xfs_force_summary_recalc()
1545 xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS); in xfs_force_summary_recalc()
1554 struct xfs_mount *mp, in xfs_add_incompat_log_feature() argument
1569 error = xfs_log_force(mp, XFS_LOG_SYNC); in xfs_add_incompat_log_feature()
1572 xfs_ail_push_all(mp->m_ail); in xfs_add_incompat_log_feature()
1578 xfs_buf_lock(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1579 xfs_buf_hold(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1581 if (xfs_is_shutdown(mp)) { in xfs_add_incompat_log_feature()
1586 if (xfs_sb_has_incompat_log_feature(&mp->m_sb, feature)) in xfs_add_incompat_log_feature()
1594 dsb = mp->m_sb_bp->b_addr; in xfs_add_incompat_log_feature()
1595 xfs_sb_to_disk(dsb, &mp->m_sb); in xfs_add_incompat_log_feature()
1597 error = xfs_bwrite(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1605 xfs_sb_add_incompat_log_features(&mp->m_sb, feature); in xfs_add_incompat_log_feature()
1606 xfs_buf_relse(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1609 return xfs_sync_sb(mp, false); in xfs_add_incompat_log_feature()
1611 xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); in xfs_add_incompat_log_feature()
1613 xfs_buf_relse(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1629 struct xfs_mount *mp) in xfs_clear_incompat_log_features() argument
1633 if (!xfs_has_crc(mp) || in xfs_clear_incompat_log_features()
1634 !xfs_sb_has_incompat_log_feature(&mp->m_sb, in xfs_clear_incompat_log_features()
1636 xfs_is_shutdown(mp) || in xfs_clear_incompat_log_features()
1637 !xfs_is_done_with_log_incompat(mp)) in xfs_clear_incompat_log_features()
1645 xfs_buf_lock(mp->m_sb_bp); in xfs_clear_incompat_log_features()
1646 xfs_buf_hold(mp->m_sb_bp); in xfs_clear_incompat_log_features()
1648 if (xfs_sb_has_incompat_log_feature(&mp->m_sb, in xfs_clear_incompat_log_features()
1650 xfs_sb_remove_incompat_log_features(&mp->m_sb); in xfs_clear_incompat_log_features()
1654 xfs_buf_relse(mp->m_sb_bp); in xfs_clear_incompat_log_features()
1676 struct xfs_mount *mp = ip->i_mount; in xfs_mod_delalloc() local
1679 percpu_counter_add_batch(&mp->m_delalloc_rtextents, in xfs_mod_delalloc()
1680 xfs_blen_to_rtbxlen(mp, data_delta), in xfs_mod_delalloc()
1686 percpu_counter_add_batch(&mp->m_delalloc_blks, data_delta + ind_delta, in xfs_mod_delalloc()