Lines Matching full:mp

64 	struct xfs_mount	*mp)  in xfs_uuid_mount()  argument
66 uuid_t *uuid = &mp->m_sb.sb_uuid; in xfs_uuid_mount()
70 super_set_uuid(mp->m_super, uuid->b, sizeof(*uuid)); in xfs_uuid_mount()
72 if (xfs_has_nouuid(mp)) in xfs_uuid_mount()
76 xfs_warn(mp, "Filesystem has null UUID - can't mount"); in xfs_uuid_mount()
103 xfs_warn(mp, "Filesystem has duplicate UUID %pU - can't mount", uuid); in xfs_uuid_mount()
109 struct xfs_mount *mp) in xfs_uuid_unmount() argument
111 uuid_t *uuid = &mp->m_sb.sb_uuid; in xfs_uuid_unmount()
114 if (xfs_has_nouuid(mp)) in xfs_uuid_unmount()
159 struct xfs_mount *mp, in xfs_readsb() argument
164 struct xfs_sb *sbp = &mp->m_sb; in xfs_readsb()
169 ASSERT(mp->m_sb_bp == NULL); in xfs_readsb()
170 ASSERT(mp->m_ddev_targp != NULL); in xfs_readsb()
179 sector_size = xfs_getsize_buftarg(mp->m_ddev_targp); in xfs_readsb()
187 error = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR, in xfs_readsb()
191 xfs_warn(mp, "SB validate failed with error %d.", error); in xfs_readsb()
209 xfs_warn(mp, "Invalid superblock magic number"); in xfs_readsb()
219 xfs_warn(mp, "device supports %u byte sectors (not %u)", in xfs_readsb()
236 mp->m_features |= xfs_sb_version_to_features(sbp); in xfs_readsb()
237 xfs_reinit_percpu_counters(mp); in xfs_readsb()
243 if (xfs_sb_version_haslogxattrs(&mp->m_sb)) in xfs_readsb()
244 xfs_set_using_logged_xattrs(mp); in xfs_readsb()
249 mp->m_sb_bp = bp; in xfs_readsb()
266 struct xfs_mount *mp, in xfs_check_new_dalign() argument
270 struct xfs_sb *sbp = &mp->m_sb; in xfs_check_new_dalign()
273 calc_ino = xfs_ialloc_calc_rootino(mp, new_dalign); in xfs_check_new_dalign()
274 trace_xfs_check_new_dalign(mp, new_dalign, calc_ino); in xfs_check_new_dalign()
281 xfs_warn(mp, in xfs_check_new_dalign()
289 xfs_warn(mp, "Skipping superblock stripe alignment update."); in xfs_check_new_dalign()
302 struct xfs_mount *mp) in xfs_validate_new_dalign() argument
304 if (mp->m_dalign == 0) in xfs_validate_new_dalign()
311 if ((BBTOB(mp->m_dalign) & mp->m_blockmask) || in xfs_validate_new_dalign()
312 (BBTOB(mp->m_swidth) & mp->m_blockmask)) { in xfs_validate_new_dalign()
313 xfs_warn(mp, in xfs_validate_new_dalign()
315 mp->m_sb.sb_blocksize); in xfs_validate_new_dalign()
322 mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign); in xfs_validate_new_dalign()
323 if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) { in xfs_validate_new_dalign()
324 xfs_warn(mp, in xfs_validate_new_dalign()
326 mp->m_sb.sb_agblocks); in xfs_validate_new_dalign()
330 if (!mp->m_dalign) { in xfs_validate_new_dalign()
331 xfs_warn(mp, in xfs_validate_new_dalign()
333 mp->m_dalign, mp->m_sb.sb_blocksize); in xfs_validate_new_dalign()
337 mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth); in xfs_validate_new_dalign()
339 if (!xfs_has_dalign(mp)) { in xfs_validate_new_dalign()
340 xfs_warn(mp, in xfs_validate_new_dalign()
351 struct xfs_mount *mp) in xfs_update_alignment() argument
353 struct xfs_sb *sbp = &mp->m_sb; in xfs_update_alignment()
355 if (mp->m_dalign) { in xfs_update_alignment()
359 if (sbp->sb_unit == mp->m_dalign && in xfs_update_alignment()
360 sbp->sb_width == mp->m_swidth) in xfs_update_alignment()
363 error = xfs_check_new_dalign(mp, mp->m_dalign, &update_sb); in xfs_update_alignment()
367 sbp->sb_unit = mp->m_dalign; in xfs_update_alignment()
368 sbp->sb_width = mp->m_swidth; in xfs_update_alignment()
369 mp->m_update_sb = true; in xfs_update_alignment()
370 } else if (!xfs_has_noalign(mp) && xfs_has_dalign(mp)) { in xfs_update_alignment()
371 mp->m_dalign = sbp->sb_unit; in xfs_update_alignment()
372 mp->m_swidth = sbp->sb_width; in xfs_update_alignment()
383 struct xfs_mount *mp) in xfs_set_low_space_thresholds() argument
385 uint64_t dblocks = mp->m_sb.sb_dblocks; in xfs_set_low_space_thresholds()
386 uint64_t rtexts = mp->m_sb.sb_rextents; in xfs_set_low_space_thresholds()
393 mp->m_low_space[i] = dblocks * (i + 1); in xfs_set_low_space_thresholds()
394 mp->m_low_rtexts[i] = rtexts * (i + 1); in xfs_set_low_space_thresholds()
403 struct xfs_mount *mp) in xfs_check_sizes() argument
409 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); in xfs_check_sizes()
410 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { in xfs_check_sizes()
411 xfs_warn(mp, "filesystem size mismatch detected"); in xfs_check_sizes()
414 error = xfs_buf_read_uncached(mp->m_ddev_targp, in xfs_check_sizes()
415 d - XFS_FSS_TO_BB(mp, 1), in xfs_check_sizes()
416 XFS_FSS_TO_BB(mp, 1), 0, &bp, NULL); in xfs_check_sizes()
418 xfs_warn(mp, "last sector read failed"); in xfs_check_sizes()
423 if (mp->m_logdev_targp == mp->m_ddev_targp) in xfs_check_sizes()
426 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); in xfs_check_sizes()
427 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { in xfs_check_sizes()
428 xfs_warn(mp, "log size mismatch detected"); in xfs_check_sizes()
431 error = xfs_buf_read_uncached(mp->m_logdev_targp, in xfs_check_sizes()
432 d - XFS_FSB_TO_BB(mp, 1), in xfs_check_sizes()
433 XFS_FSB_TO_BB(mp, 1), 0, &bp, NULL); in xfs_check_sizes()
435 xfs_warn(mp, "log device read failed"); in xfs_check_sizes()
447 struct xfs_mount *mp) in xfs_mount_reset_sbqflags() argument
449 mp->m_qflags = 0; in xfs_mount_reset_sbqflags()
452 if (mp->m_sb.sb_qflags == 0) in xfs_mount_reset_sbqflags()
454 spin_lock(&mp->m_sb_lock); in xfs_mount_reset_sbqflags()
455 mp->m_sb.sb_qflags = 0; in xfs_mount_reset_sbqflags()
456 spin_unlock(&mp->m_sb_lock); in xfs_mount_reset_sbqflags()
458 if (!xfs_fs_writable(mp, SB_FREEZE_WRITE)) in xfs_mount_reset_sbqflags()
461 return xfs_sync_sb(mp, false); in xfs_mount_reset_sbqflags()
465 xfs_default_resblks(xfs_mount_t *mp) in xfs_default_resblks() argument
476 resblks = mp->m_sb.sb_dblocks; in xfs_default_resblks()
485 struct xfs_mount *mp) in xfs_check_summary_counts() argument
493 if (mp->m_sb.sb_inprogress) { in xfs_check_summary_counts()
494 xfs_err(mp, "sb_inprogress set after log recovery??"); in xfs_check_summary_counts()
510 if (xfs_is_clean(mp) && in xfs_check_summary_counts()
511 (mp->m_sb.sb_fdblocks > mp->m_sb.sb_dblocks || in xfs_check_summary_counts()
512 !xfs_verify_icount(mp, mp->m_sb.sb_icount) || in xfs_check_summary_counts()
513 mp->m_sb.sb_ifree > mp->m_sb.sb_icount)) in xfs_check_summary_counts()
514 xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS); in xfs_check_summary_counts()
527 if ((xfs_has_lazysbcount(mp) && !xfs_is_clean(mp)) || in xfs_check_summary_counts()
528 xfs_fs_has_sickness(mp, XFS_SICK_FS_COUNTERS)) { in xfs_check_summary_counts()
529 error = xfs_initialize_perag_data(mp, mp->m_sb.sb_agcount); in xfs_check_summary_counts()
546 if (xfs_has_realtime(mp) && !xfs_is_clean(mp)) { in xfs_check_summary_counts()
547 error = xfs_rtalloc_reinit_frextents(mp); in xfs_check_summary_counts()
557 struct xfs_mount *mp) in xfs_unmount_check() argument
559 if (xfs_is_shutdown(mp)) in xfs_unmount_check()
562 if (percpu_counter_sum(&mp->m_ifree) > in xfs_unmount_check()
563 percpu_counter_sum(&mp->m_icount)) { in xfs_unmount_check()
564 xfs_alert(mp, "ifree/icount mismatch at unmount"); in xfs_unmount_check()
565 xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS); in xfs_unmount_check()
597 struct xfs_mount *mp) in xfs_unmount_flush_inodes() argument
599 xfs_log_force(mp, XFS_LOG_SYNC); in xfs_unmount_flush_inodes()
600 xfs_extent_busy_wait_all(mp); in xfs_unmount_flush_inodes()
603 xfs_set_unmounting(mp); in xfs_unmount_flush_inodes()
605 xfs_ail_push_all_sync(mp->m_ail); in xfs_unmount_flush_inodes()
606 xfs_inodegc_stop(mp); in xfs_unmount_flush_inodes()
607 cancel_delayed_work_sync(&mp->m_reclaim_work); in xfs_unmount_flush_inodes()
608 xfs_reclaim_inodes(mp); in xfs_unmount_flush_inodes()
609 xfs_health_unmount(mp); in xfs_unmount_flush_inodes()
614 struct xfs_mount *mp) in xfs_mount_setup_inode_geom() argument
616 struct xfs_ino_geometry *igeo = M_IGEO(mp); in xfs_mount_setup_inode_geom()
618 igeo->attr_fork_offset = xfs_bmap_compute_attr_offset(mp); in xfs_mount_setup_inode_geom()
619 ASSERT(igeo->attr_fork_offset < XFS_LITINO(mp)); in xfs_mount_setup_inode_geom()
621 xfs_ialloc_setup_geometry(mp); in xfs_mount_setup_inode_geom()
627 struct xfs_mount *mp) in xfs_mount_setup_metadir() argument
632 error = xfs_metafile_iget(mp, mp->m_sb.sb_metadirino, XFS_METAFILE_DIR, in xfs_mount_setup_metadir()
633 &mp->m_metadirip); in xfs_mount_setup_metadir()
635 xfs_warn(mp, "Failed to load metadir root directory, error %d", in xfs_mount_setup_metadir()
643 struct xfs_mount *mp) in xfs_agbtree_compute_maxlevels() argument
647 levels = max(mp->m_alloc_maxlevels, M_IGEO(mp)->inobt_maxlevels); in xfs_agbtree_compute_maxlevels()
648 levels = max(levels, mp->m_rmap_maxlevels); in xfs_agbtree_compute_maxlevels()
649 mp->m_agbtree_maxlevels = max(levels, mp->m_refc_maxlevels); in xfs_agbtree_compute_maxlevels()
655 struct xfs_mount *mp) in xfs_rtbtree_compute_maxlevels() argument
657 mp->m_rtbtree_maxlevels = max(mp->m_rtrmap_maxlevels, in xfs_rtbtree_compute_maxlevels()
658 mp->m_rtrefc_maxlevels); in xfs_rtbtree_compute_maxlevels()
673 struct xfs_mount *mp) in xfs_mountfs() argument
675 struct xfs_sb *sbp = &(mp->m_sb); in xfs_mountfs()
677 struct xfs_ino_geometry *igeo = M_IGEO(mp); in xfs_mountfs()
682 xfs_sb_mount_common(mp, sbp); in xfs_mountfs()
701 xfs_warn(mp, "correcting sb_features alignment problem"); in xfs_mountfs()
703 mp->m_update_sb = true; in xfs_mountfs()
708 if (!(mp->m_sb.sb_versionnum & XFS_SB_VERSION_NLINKBIT)) { in xfs_mountfs()
709 mp->m_sb.sb_versionnum |= XFS_SB_VERSION_NLINKBIT; in xfs_mountfs()
710 mp->m_features |= XFS_FEAT_NLINK; in xfs_mountfs()
711 mp->m_update_sb = true; in xfs_mountfs()
720 error = xfs_validate_new_dalign(mp); in xfs_mountfs()
724 xfs_alloc_compute_maxlevels(mp); in xfs_mountfs()
725 xfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK); in xfs_mountfs()
726 xfs_bmap_compute_maxlevels(mp, XFS_ATTR_FORK); in xfs_mountfs()
727 xfs_mount_setup_inode_geom(mp); in xfs_mountfs()
728 xfs_rmapbt_compute_maxlevels(mp); in xfs_mountfs()
729 xfs_rtrmapbt_compute_maxlevels(mp); in xfs_mountfs()
730 xfs_refcountbt_compute_maxlevels(mp); in xfs_mountfs()
731 xfs_rtrefcountbt_compute_maxlevels(mp); in xfs_mountfs()
733 xfs_agbtree_compute_maxlevels(mp); in xfs_mountfs()
734 xfs_rtbtree_compute_maxlevels(mp); in xfs_mountfs()
743 error = xfs_update_alignment(mp); in xfs_mountfs()
748 mp->m_fail_unmount = true; in xfs_mountfs()
750 super_set_sysfs_name_id(mp->m_super); in xfs_mountfs()
752 error = xfs_sysfs_init(&mp->m_kobj, &xfs_mp_ktype, in xfs_mountfs()
753 NULL, mp->m_super->s_id); in xfs_mountfs()
757 error = xfs_sysfs_init(&mp->m_stats.xs_kobj, &xfs_stats_ktype, in xfs_mountfs()
758 &mp->m_kobj, "stats"); in xfs_mountfs()
762 xchk_stats_register(mp->m_scrub_stats, mp->m_debugfs); in xfs_mountfs()
764 error = xfs_error_sysfs_init(mp); in xfs_mountfs()
768 error = xfs_errortag_init(mp); in xfs_mountfs()
772 error = xfs_uuid_mount(mp); in xfs_mountfs()
780 mp->m_allocsize_log = in xfs_mountfs()
781 max_t(uint32_t, sbp->sb_blocklog, mp->m_allocsize_log); in xfs_mountfs()
782 mp->m_allocsize_blocks = 1U << (mp->m_allocsize_log - sbp->sb_blocklog); in xfs_mountfs()
785 xfs_set_low_space_thresholds(mp); in xfs_mountfs()
792 if (xfs_has_sparseinodes(mp) && in xfs_mountfs()
793 mp->m_sb.sb_spino_align != in xfs_mountfs()
794 XFS_B_TO_FSBT(mp, igeo->inode_cluster_size_raw)) { in xfs_mountfs()
795 xfs_warn(mp, in xfs_mountfs()
797 mp->m_sb.sb_spino_align, in xfs_mountfs()
798 XFS_B_TO_FSBT(mp, igeo->inode_cluster_size_raw)); in xfs_mountfs()
806 error = xfs_check_sizes(mp); in xfs_mountfs()
813 error = xfs_rtmount_init(mp); in xfs_mountfs()
815 xfs_warn(mp, "RT mount failed"); in xfs_mountfs()
823 mp->m_fixedfsid[0] = in xfs_mountfs()
826 mp->m_fixedfsid[1] = get_unaligned_be32(&sbp->sb_uuid.b[0]); in xfs_mountfs()
828 error = xfs_da_mount(mp); in xfs_mountfs()
830 xfs_warn(mp, "Failed dir/attr init: %d", error); in xfs_mountfs()
837 xfs_trans_init(mp); in xfs_mountfs()
842 error = xfs_initialize_perag(mp, 0, sbp->sb_agcount, in xfs_mountfs()
843 mp->m_sb.sb_dblocks, &mp->m_maxagi); in xfs_mountfs()
845 xfs_warn(mp, "Failed per-ag init: %d", error); in xfs_mountfs()
849 error = xfs_initialize_rtgroups(mp, 0, sbp->sb_rgcount, in xfs_mountfs()
850 mp->m_sb.sb_rextents); in xfs_mountfs()
852 xfs_warn(mp, "Failed rtgroup init: %d", error); in xfs_mountfs()
856 if (XFS_IS_CORRUPT(mp, !sbp->sb_logblocks)) { in xfs_mountfs()
857 xfs_warn(mp, "no log defined"); in xfs_mountfs()
862 error = xfs_inodegc_register_shrinker(mp); in xfs_mountfs()
870 if (xfs_is_resuming_quotaon(mp)) in xfs_mountfs()
871 xfs_qm_resume_quotaon(mp); in xfs_mountfs()
878 error = xfs_log_mount(mp, mp->m_logdev_targp, in xfs_mountfs()
879 XFS_FSB_TO_DADDR(mp, sbp->sb_logstart), in xfs_mountfs()
880 XFS_FSB_TO_BB(mp, sbp->sb_logblocks)); in xfs_mountfs()
882 xfs_warn(mp, "log mount failed"); in xfs_mountfs()
891 if (xfs_clear_resuming_quotaon(mp) && xlog_recovery_needed(mp->m_log)) in xfs_mountfs()
892 xfs_qm_resume_quotaon(mp); in xfs_mountfs()
898 if (xfs_sb_version_haslogxattrs(&mp->m_sb)) in xfs_mountfs()
899 xfs_set_using_logged_xattrs(mp); in xfs_mountfs()
901 xfs_clear_using_logged_xattrs(mp); in xfs_mountfs()
904 xfs_inodegc_start(mp); in xfs_mountfs()
905 xfs_blockgc_start(mp); in xfs_mountfs()
913 if (xfs_has_noattr2(mp)) { in xfs_mountfs()
914 mp->m_features &= ~XFS_FEAT_ATTR2; in xfs_mountfs()
915 } else if (!xfs_has_attr2(mp) && in xfs_mountfs()
916 (mp->m_sb.sb_features2 & XFS_SB_VERSION2_ATTR2BIT)) { in xfs_mountfs()
917 mp->m_features |= XFS_FEAT_ATTR2; in xfs_mountfs()
920 if (xfs_has_metadir(mp)) { in xfs_mountfs()
921 error = xfs_mount_setup_metadir(mp); in xfs_mountfs()
930 error = xfs_iget(mp, NULL, sbp->sb_rootino, XFS_IGET_UNTRUSTED, in xfs_mountfs()
933 xfs_warn(mp, in xfs_mountfs()
941 if (XFS_IS_CORRUPT(mp, !S_ISDIR(VFS_I(rip)->i_mode))) { in xfs_mountfs()
942 xfs_warn(mp, "corrupted root inode %llu: not a directory", in xfs_mountfs()
948 mp->m_rootip = rip; /* save it */ in xfs_mountfs()
955 error = xfs_rtmount_inodes(mp); in xfs_mountfs()
960 xfs_warn(mp, "failed to read RT inodes"); in xfs_mountfs()
965 error = xfs_check_summary_counts(mp); in xfs_mountfs()
974 if (mp->m_update_sb && !xfs_is_readonly(mp)) { in xfs_mountfs()
975 error = xfs_sync_sb(mp, false); in xfs_mountfs()
977 xfs_warn(mp, "failed to write sb changes"); in xfs_mountfs()
985 if (XFS_IS_QUOTA_ON(mp)) { in xfs_mountfs()
986 error = xfs_qm_newmount(mp, &quotamount, &quotaflags); in xfs_mountfs()
995 if (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT) { in xfs_mountfs()
996 xfs_notice(mp, "resetting quota flags"); in xfs_mountfs()
997 error = xfs_mount_reset_sbqflags(mp); in xfs_mountfs()
1011 error = xfs_fs_reserve_ag_blocks(mp); in xfs_mountfs()
1013 xfs_warn(mp, in xfs_mountfs()
1015 error = xfs_log_mount_finish(mp); in xfs_mountfs()
1016 xfs_fs_unreserve_ag_blocks(mp); in xfs_mountfs()
1018 xfs_warn(mp, "log mount finish failed"); in xfs_mountfs()
1031 if (xfs_is_readonly(mp) && !xfs_has_norecovery(mp)) in xfs_mountfs()
1032 xfs_log_clean(mp); in xfs_mountfs()
1038 ASSERT(mp->m_qflags == 0); in xfs_mountfs()
1039 mp->m_qflags = quotaflags; in xfs_mountfs()
1041 xfs_qm_mount_quotas(mp); in xfs_mountfs()
1055 if (!xfs_is_readonly(mp)) { in xfs_mountfs()
1056 error = xfs_reserve_blocks(mp, xfs_default_resblks(mp)); in xfs_mountfs()
1058 xfs_warn(mp, in xfs_mountfs()
1062 error = xfs_fs_reserve_ag_blocks(mp); in xfs_mountfs()
1070 xfs_fs_unreserve_ag_blocks(mp); in xfs_mountfs()
1071 xfs_qm_unmount_quotas(mp); in xfs_mountfs()
1073 xfs_rtunmount_inodes(mp); in xfs_mountfs()
1077 xfs_qm_unmount(mp); in xfs_mountfs()
1079 if (mp->m_metadirip) in xfs_mountfs()
1080 xfs_irele(mp->m_metadirip); in xfs_mountfs()
1088 xfs_inodegc_flush(mp); in xfs_mountfs()
1101 xfs_unmount_flush_inodes(mp); in xfs_mountfs()
1102 xfs_log_mount_cancel(mp); in xfs_mountfs()
1104 shrinker_free(mp->m_inodegc_shrinker); in xfs_mountfs()
1106 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) in xfs_mountfs()
1107 xfs_buftarg_drain(mp->m_logdev_targp); in xfs_mountfs()
1108 xfs_buftarg_drain(mp->m_ddev_targp); in xfs_mountfs()
1110 xfs_free_rtgroups(mp, 0, mp->m_sb.sb_rgcount); in xfs_mountfs()
1112 xfs_free_perag_range(mp, 0, mp->m_sb.sb_agcount); in xfs_mountfs()
1114 xfs_da_unmount(mp); in xfs_mountfs()
1116 xfs_uuid_unmount(mp); in xfs_mountfs()
1118 xfs_errortag_del(mp); in xfs_mountfs()
1120 xfs_error_sysfs_del(mp); in xfs_mountfs()
1122 xchk_stats_unregister(mp->m_scrub_stats); in xfs_mountfs()
1123 xfs_sysfs_del(&mp->m_stats.xs_kobj); in xfs_mountfs()
1125 xfs_sysfs_del(&mp->m_kobj); in xfs_mountfs()
1136 struct xfs_mount *mp) in xfs_unmountfs() argument
1148 xfs_inodegc_flush(mp); in xfs_unmountfs()
1150 xfs_blockgc_stop(mp); in xfs_unmountfs()
1151 xfs_fs_unreserve_ag_blocks(mp); in xfs_unmountfs()
1152 xfs_qm_unmount_quotas(mp); in xfs_unmountfs()
1153 xfs_rtunmount_inodes(mp); in xfs_unmountfs()
1154 xfs_irele(mp->m_rootip); in xfs_unmountfs()
1155 if (mp->m_metadirip) in xfs_unmountfs()
1156 xfs_irele(mp->m_metadirip); in xfs_unmountfs()
1158 xfs_unmount_flush_inodes(mp); in xfs_unmountfs()
1160 xfs_qm_unmount(mp); in xfs_unmountfs()
1176 error = xfs_reserve_blocks(mp, 0); in xfs_unmountfs()
1178 xfs_warn(mp, "Unable to free reserved block pool. " in xfs_unmountfs()
1180 xfs_unmount_check(mp); in xfs_unmountfs()
1186 xfs_set_done_with_log_incompat(mp); in xfs_unmountfs()
1187 xfs_log_unmount(mp); in xfs_unmountfs()
1188 xfs_da_unmount(mp); in xfs_unmountfs()
1189 xfs_uuid_unmount(mp); in xfs_unmountfs()
1192 xfs_errortag_clearall(mp); in xfs_unmountfs()
1194 shrinker_free(mp->m_inodegc_shrinker); in xfs_unmountfs()
1195 xfs_free_rtgroups(mp, 0, mp->m_sb.sb_rgcount); in xfs_unmountfs()
1196 xfs_free_perag_range(mp, 0, mp->m_sb.sb_agcount); in xfs_unmountfs()
1197 xfs_errortag_del(mp); in xfs_unmountfs()
1198 xfs_error_sysfs_del(mp); in xfs_unmountfs()
1199 xchk_stats_unregister(mp->m_scrub_stats); in xfs_unmountfs()
1200 xfs_sysfs_del(&mp->m_stats.xs_kobj); in xfs_unmountfs()
1201 xfs_sysfs_del(&mp->m_kobj); in xfs_unmountfs()
1212 struct xfs_mount *mp, in xfs_fs_writable() argument
1216 if ((mp->m_super->s_writers.frozen >= level) || in xfs_fs_writable()
1217 xfs_is_shutdown(mp) || xfs_is_readonly(mp)) in xfs_fs_writable()
1225 struct xfs_mount *mp, in xfs_add_freecounter() argument
1229 bool has_resv_pool = (counter == &mp->m_fdblocks); in xfs_add_freecounter()
1236 if (!has_resv_pool || mp->m_resblks == mp->m_resblks_avail) { in xfs_add_freecounter()
1241 spin_lock(&mp->m_sb_lock); in xfs_add_freecounter()
1242 res_used = mp->m_resblks - mp->m_resblks_avail; in xfs_add_freecounter()
1244 mp->m_resblks_avail += delta; in xfs_add_freecounter()
1247 mp->m_resblks_avail = mp->m_resblks; in xfs_add_freecounter()
1250 spin_unlock(&mp->m_sb_lock); in xfs_add_freecounter()
1255 struct xfs_mount *mp, in xfs_dec_freecounter() argument
1265 ASSERT(counter == &mp->m_fdblocks || counter == &mp->m_frextents); in xfs_dec_freecounter()
1266 has_resv_pool = (counter == &mp->m_fdblocks); in xfs_dec_freecounter()
1296 set_aside = xfs_fdblocks_unavailable(mp); in xfs_dec_freecounter()
1308 spin_lock(&mp->m_sb_lock); in xfs_dec_freecounter()
1313 lcounter = (long long)mp->m_resblks_avail - delta; in xfs_dec_freecounter()
1315 mp->m_resblks_avail = lcounter; in xfs_dec_freecounter()
1316 spin_unlock(&mp->m_sb_lock); in xfs_dec_freecounter()
1319 xfs_warn_once(mp, in xfs_dec_freecounter()
1323 spin_unlock(&mp->m_sb_lock); in xfs_dec_freecounter()
1332 struct xfs_mount *mp) in xfs_freesb() argument
1334 struct xfs_buf *bp = mp->m_sb_bp; in xfs_freesb()
1337 mp->m_sb_bp = NULL; in xfs_freesb()
1347 struct xfs_mount *mp, in xfs_dev_is_read_only() argument
1350 if (xfs_readonly_buftarg(mp->m_ddev_targp) || in xfs_dev_is_read_only()
1351 xfs_readonly_buftarg(mp->m_logdev_targp) || in xfs_dev_is_read_only()
1352 (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) { in xfs_dev_is_read_only()
1353 xfs_notice(mp, "%s required on read-only device.", message); in xfs_dev_is_read_only()
1354 xfs_notice(mp, "write access unavailable, cannot proceed."); in xfs_dev_is_read_only()
1363 struct xfs_mount *mp) in xfs_force_summary_recalc() argument
1365 if (!xfs_has_lazysbcount(mp)) in xfs_force_summary_recalc()
1368 xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS); in xfs_force_summary_recalc()
1377 struct xfs_mount *mp, in xfs_add_incompat_log_feature() argument
1392 error = xfs_log_force(mp, XFS_LOG_SYNC); in xfs_add_incompat_log_feature()
1395 xfs_ail_push_all(mp->m_ail); in xfs_add_incompat_log_feature()
1401 xfs_buf_lock(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1402 xfs_buf_hold(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1404 if (xfs_is_shutdown(mp)) { in xfs_add_incompat_log_feature()
1409 if (xfs_sb_has_incompat_log_feature(&mp->m_sb, feature)) in xfs_add_incompat_log_feature()
1417 dsb = mp->m_sb_bp->b_addr; in xfs_add_incompat_log_feature()
1418 xfs_sb_to_disk(dsb, &mp->m_sb); in xfs_add_incompat_log_feature()
1420 error = xfs_bwrite(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1428 xfs_sb_add_incompat_log_features(&mp->m_sb, feature); in xfs_add_incompat_log_feature()
1429 xfs_buf_relse(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1432 return xfs_sync_sb(mp, false); in xfs_add_incompat_log_feature()
1434 xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); in xfs_add_incompat_log_feature()
1436 xfs_buf_relse(mp->m_sb_bp); in xfs_add_incompat_log_feature()
1452 struct xfs_mount *mp) in xfs_clear_incompat_log_features() argument
1456 if (!xfs_has_crc(mp) || in xfs_clear_incompat_log_features()
1457 !xfs_sb_has_incompat_log_feature(&mp->m_sb, in xfs_clear_incompat_log_features()
1459 xfs_is_shutdown(mp) || in xfs_clear_incompat_log_features()
1460 !xfs_is_done_with_log_incompat(mp)) in xfs_clear_incompat_log_features()
1468 xfs_buf_lock(mp->m_sb_bp); in xfs_clear_incompat_log_features()
1469 xfs_buf_hold(mp->m_sb_bp); in xfs_clear_incompat_log_features()
1471 if (xfs_sb_has_incompat_log_feature(&mp->m_sb, in xfs_clear_incompat_log_features()
1473 xfs_sb_remove_incompat_log_features(&mp->m_sb); in xfs_clear_incompat_log_features()
1477 xfs_buf_relse(mp->m_sb_bp); in xfs_clear_incompat_log_features()
1499 struct xfs_mount *mp = ip->i_mount; in xfs_mod_delalloc() local
1502 percpu_counter_add_batch(&mp->m_delalloc_rtextents, in xfs_mod_delalloc()
1503 xfs_blen_to_rtbxlen(mp, data_delta), in xfs_mod_delalloc()
1509 percpu_counter_add_batch(&mp->m_delalloc_blks, data_delta + ind_delta, in xfs_mod_delalloc()