Lines Matching full:mp

75 	struct xfs_mount	*mp,  in xfs_mount_set_dax_mode()  argument
80 mp->m_features &= ~(XFS_FEAT_DAX_ALWAYS | XFS_FEAT_DAX_NEVER); in xfs_mount_set_dax_mode()
83 mp->m_features |= XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
84 mp->m_features &= ~XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
87 mp->m_features |= XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
88 mp->m_features &= ~XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
187 struct xfs_mount *mp = XFS_M(root->d_sb); in xfs_fs_show_options() local
191 if (mp->m_features & xfs_infop->flag) in xfs_fs_show_options()
195 seq_printf(m, ",inode%d", xfs_has_small_inums(mp) ? 32 : 64); in xfs_fs_show_options()
197 if (xfs_has_allocsize(mp)) in xfs_fs_show_options()
199 (1 << mp->m_allocsize_log) >> 10); in xfs_fs_show_options()
201 if (mp->m_logbufs > 0) in xfs_fs_show_options()
202 seq_printf(m, ",logbufs=%d", mp->m_logbufs); in xfs_fs_show_options()
203 if (mp->m_logbsize > 0) in xfs_fs_show_options()
204 seq_printf(m, ",logbsize=%dk", mp->m_logbsize >> 10); in xfs_fs_show_options()
206 if (mp->m_logname) in xfs_fs_show_options()
207 seq_show_option(m, "logdev", mp->m_logname); in xfs_fs_show_options()
208 if (mp->m_rtname) in xfs_fs_show_options()
209 seq_show_option(m, "rtdev", mp->m_rtname); in xfs_fs_show_options()
211 if (mp->m_dalign > 0) in xfs_fs_show_options()
213 (int)XFS_FSB_TO_BB(mp, mp->m_dalign)); in xfs_fs_show_options()
214 if (mp->m_swidth > 0) in xfs_fs_show_options()
216 (int)XFS_FSB_TO_BB(mp, mp->m_swidth)); in xfs_fs_show_options()
218 if (mp->m_qflags & XFS_UQUOTA_ENFD) in xfs_fs_show_options()
220 else if (mp->m_qflags & XFS_UQUOTA_ACCT) in xfs_fs_show_options()
223 if (mp->m_qflags & XFS_PQUOTA_ENFD) in xfs_fs_show_options()
225 else if (mp->m_qflags & XFS_PQUOTA_ACCT) in xfs_fs_show_options()
228 if (mp->m_qflags & XFS_GQUOTA_ENFD) in xfs_fs_show_options()
230 else if (mp->m_qflags & XFS_GQUOTA_ACCT) in xfs_fs_show_options()
233 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) in xfs_fs_show_options()
275 * because in the growfs case, mp->m_sb.sb_agcount is not yet updated
282 struct xfs_mount *mp, in xfs_set_inode_alloc() argument
287 xfs_sb_t *sbp = &mp->m_sb; in xfs_set_inode_alloc()
296 if (M_IGEO(mp)->maxicount) { in xfs_set_inode_alloc()
309 agino = XFS_AGB_TO_AGINO(mp, sbp->sb_agblocks - 1); in xfs_set_inode_alloc()
310 ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino); in xfs_set_inode_alloc()
317 if (xfs_has_small_inums(mp) && ino > XFS_MAXINUMBER_32) in xfs_set_inode_alloc()
318 xfs_set_inode32(mp); in xfs_set_inode_alloc()
320 xfs_clear_inode32(mp); in xfs_set_inode_alloc()
325 ino = XFS_AGINO_TO_INO(mp, index, agino); in xfs_set_inode_alloc()
327 pag = xfs_perag_get(mp, index); in xfs_set_inode_alloc()
333 return xfs_is_inode32(mp) ? maxagi : agcount; in xfs_set_inode_alloc()
338 struct xfs_mount *mp) in xfs_setup_dax_always() argument
340 if (!mp->m_ddev_targp->bt_daxdev && in xfs_setup_dax_always()
341 (!mp->m_rtdev_targp || !mp->m_rtdev_targp->bt_daxdev)) { in xfs_setup_dax_always()
342 xfs_alert(mp, in xfs_setup_dax_always()
347 if (mp->m_super->s_blocksize != PAGE_SIZE) { in xfs_setup_dax_always()
348 xfs_alert(mp, in xfs_setup_dax_always()
353 if (xfs_has_reflink(mp) && in xfs_setup_dax_always()
354 bdev_is_partition(mp->m_ddev_targp->bt_bdev)) { in xfs_setup_dax_always()
355 xfs_alert(mp, in xfs_setup_dax_always()
363 xfs_mount_set_dax_mode(mp, XFS_DAX_NEVER); in xfs_setup_dax_always()
369 xfs_mount_t *mp, in xfs_blkdev_get() argument
377 mp->m_super, &fs_holder_ops); in xfs_blkdev_get()
381 xfs_warn(mp, "Invalid device [%s], error=%d", name, error); in xfs_blkdev_get()
389 struct xfs_mount *mp) in xfs_shutdown_devices() argument
417 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_shutdown_devices()
418 blkdev_issue_flush(mp->m_logdev_targp->bt_bdev); in xfs_shutdown_devices()
419 invalidate_bdev(mp->m_logdev_targp->bt_bdev); in xfs_shutdown_devices()
421 if (mp->m_rtdev_targp) { in xfs_shutdown_devices()
422 blkdev_issue_flush(mp->m_rtdev_targp->bt_bdev); in xfs_shutdown_devices()
423 invalidate_bdev(mp->m_rtdev_targp->bt_bdev); in xfs_shutdown_devices()
425 blkdev_issue_flush(mp->m_ddev_targp->bt_bdev); in xfs_shutdown_devices()
426 invalidate_bdev(mp->m_ddev_targp->bt_bdev); in xfs_shutdown_devices()
441 struct xfs_mount *mp) in xfs_open_devices() argument
443 struct super_block *sb = mp->m_super; in xfs_open_devices()
451 if (mp->m_logname) { in xfs_open_devices()
452 error = xfs_blkdev_get(mp, mp->m_logname, &logdev_file); in xfs_open_devices()
457 if (mp->m_rtname) { in xfs_open_devices()
458 error = xfs_blkdev_get(mp, mp->m_rtname, &rtdev_file); in xfs_open_devices()
465 xfs_warn(mp, in xfs_open_devices()
476 mp->m_ddev_targp = xfs_alloc_buftarg(mp, sb->s_bdev_file); in xfs_open_devices()
477 if (!mp->m_ddev_targp) in xfs_open_devices()
481 mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev_file); in xfs_open_devices()
482 if (!mp->m_rtdev_targp) in xfs_open_devices()
487 mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev_file); in xfs_open_devices()
488 if (!mp->m_logdev_targp) in xfs_open_devices()
491 mp->m_logdev_targp = mp->m_ddev_targp; in xfs_open_devices()
500 if (mp->m_rtdev_targp) in xfs_open_devices()
501 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_open_devices()
503 xfs_free_buftarg(mp->m_ddev_targp); in xfs_open_devices()
518 struct xfs_mount *mp) in xfs_setup_devices() argument
522 error = xfs_setsize_buftarg(mp->m_ddev_targp, mp->m_sb.sb_sectsize); in xfs_setup_devices()
526 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_setup_devices()
529 if (xfs_has_sector(mp)) in xfs_setup_devices()
530 log_sector_size = mp->m_sb.sb_logsectsize; in xfs_setup_devices()
531 error = xfs_setsize_buftarg(mp->m_logdev_targp, in xfs_setup_devices()
536 if (mp->m_rtdev_targp) { in xfs_setup_devices()
537 error = xfs_setsize_buftarg(mp->m_rtdev_targp, in xfs_setup_devices()
538 mp->m_sb.sb_sectsize); in xfs_setup_devices()
548 struct xfs_mount *mp) in xfs_init_mount_workqueues() argument
550 mp->m_buf_workqueue = alloc_workqueue("xfs-buf/%s", in xfs_init_mount_workqueues()
552 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
553 if (!mp->m_buf_workqueue) in xfs_init_mount_workqueues()
556 mp->m_unwritten_workqueue = alloc_workqueue("xfs-conv/%s", in xfs_init_mount_workqueues()
558 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
559 if (!mp->m_unwritten_workqueue) in xfs_init_mount_workqueues()
562 mp->m_reclaim_workqueue = alloc_workqueue("xfs-reclaim/%s", in xfs_init_mount_workqueues()
564 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
565 if (!mp->m_reclaim_workqueue) in xfs_init_mount_workqueues()
568 mp->m_blockgc_wq = alloc_workqueue("xfs-blockgc/%s", in xfs_init_mount_workqueues()
570 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
571 if (!mp->m_blockgc_wq) in xfs_init_mount_workqueues()
574 mp->m_inodegc_wq = alloc_workqueue("xfs-inodegc/%s", in xfs_init_mount_workqueues()
576 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
577 if (!mp->m_inodegc_wq) in xfs_init_mount_workqueues()
580 mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s", in xfs_init_mount_workqueues()
581 XFS_WQFLAGS(WQ_FREEZABLE), 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
582 if (!mp->m_sync_workqueue) in xfs_init_mount_workqueues()
588 destroy_workqueue(mp->m_inodegc_wq); in xfs_init_mount_workqueues()
590 destroy_workqueue(mp->m_blockgc_wq); in xfs_init_mount_workqueues()
592 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_init_mount_workqueues()
594 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_init_mount_workqueues()
596 destroy_workqueue(mp->m_buf_workqueue); in xfs_init_mount_workqueues()
603 struct xfs_mount *mp) in xfs_destroy_mount_workqueues() argument
605 destroy_workqueue(mp->m_sync_workqueue); in xfs_destroy_mount_workqueues()
606 destroy_workqueue(mp->m_blockgc_wq); in xfs_destroy_mount_workqueues()
607 destroy_workqueue(mp->m_inodegc_wq); in xfs_destroy_mount_workqueues()
608 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_destroy_mount_workqueues()
609 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_destroy_mount_workqueues()
610 destroy_workqueue(mp->m_buf_workqueue); in xfs_destroy_mount_workqueues()
617 struct xfs_mount *mp = container_of(work, struct xfs_mount, in xfs_flush_inodes_worker() local
619 struct super_block *sb = mp->m_super; in xfs_flush_inodes_worker()
635 struct xfs_mount *mp) in xfs_flush_inodes() argument
641 if (flush_work(&mp->m_flush_inodes_work)) in xfs_flush_inodes()
644 queue_work(mp->m_sync_workqueue, &mp->m_flush_inodes_work); in xfs_flush_inodes()
645 flush_work(&mp->m_flush_inodes_work); in xfs_flush_inodes()
681 struct xfs_mount *mp = ip->i_mount; in xfs_fs_dirty_inode() local
695 if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) in xfs_fs_dirty_inode()
756 struct xfs_mount *mp) in xfs_mount_free() argument
758 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) in xfs_mount_free()
759 xfs_free_buftarg(mp->m_logdev_targp); in xfs_mount_free()
760 if (mp->m_rtdev_targp) in xfs_mount_free()
761 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_mount_free()
762 if (mp->m_ddev_targp) in xfs_mount_free()
763 xfs_free_buftarg(mp->m_ddev_targp); in xfs_mount_free()
765 debugfs_remove(mp->m_debugfs); in xfs_mount_free()
766 kfree(mp->m_rtname); in xfs_mount_free()
767 kfree(mp->m_logname); in xfs_mount_free()
768 kfree(mp); in xfs_mount_free()
776 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_sync_fs() local
779 trace_xfs_fs_sync_fs(mp, __return_address); in xfs_fs_sync_fs()
787 error = xfs_log_force(mp, XFS_LOG_SYNC); in xfs_fs_sync_fs()
797 flush_delayed_work(&mp->m_log->l_work); in xfs_fs_sync_fs()
815 xfs_inodegc_stop(mp); in xfs_fs_sync_fs()
816 xfs_blockgc_stop(mp); in xfs_fs_sync_fs()
824 struct xfs_mount *mp) in xfs_internal_log_size() argument
826 if (!mp->m_sb.sb_logstart) in xfs_internal_log_size()
828 return mp->m_sb.sb_logblocks; in xfs_internal_log_size()
833 struct xfs_mount *mp, in xfs_statfs_data() argument
837 percpu_counter_sum(&mp->m_fdblocks); in xfs_statfs_data()
840 st->f_bfree = max(0LL, fdblocks - xfs_fdblocks_unavailable(mp)); in xfs_statfs_data()
845 st->f_blocks = mp->m_sb.sb_dblocks - xfs_internal_log_size(mp); in xfs_statfs_data()
855 struct xfs_mount *mp, in xfs_statfs_rt() argument
858 st->f_bfree = xfs_rtbxlen_to_blen(mp, in xfs_statfs_rt()
859 percpu_counter_sum_positive(&mp->m_frextents)); in xfs_statfs_rt()
860 st->f_blocks = mp->m_sb.sb_rblocks; in xfs_statfs_rt()
865 struct xfs_mount *mp, in xfs_statfs_inodes() argument
868 uint64_t icount = percpu_counter_sum(&mp->m_icount); in xfs_statfs_inodes()
869 uint64_t ifree = percpu_counter_sum(&mp->m_ifree); in xfs_statfs_inodes()
870 uint64_t fakeinos = XFS_FSB_TO_INO(mp, st->f_bfree); in xfs_statfs_inodes()
873 if (M_IGEO(mp)->maxicount) in xfs_statfs_inodes()
875 M_IGEO(mp)->maxicount); in xfs_statfs_inodes()
879 mp->m_sb.sb_icount); in xfs_statfs_inodes()
890 struct xfs_mount *mp = XFS_M(dentry->d_sb); in xfs_fs_statfs() local
897 xfs_inodegc_push(mp); in xfs_fs_statfs()
901 st->f_bsize = mp->m_sb.sb_blocksize; in xfs_fs_statfs()
902 st->f_fsid = u64_to_fsid(huge_encode_dev(mp->m_ddev_targp->bt_dev)); in xfs_fs_statfs()
904 xfs_statfs_data(mp, st); in xfs_fs_statfs()
905 xfs_statfs_inodes(mp, st); in xfs_fs_statfs()
907 if (XFS_IS_REALTIME_MOUNT(mp) && in xfs_fs_statfs()
909 xfs_statfs_rt(mp, st); in xfs_fs_statfs()
912 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
925 xfs_save_resvblks(struct xfs_mount *mp) in xfs_save_resvblks() argument
927 mp->m_resblks_save = mp->m_resblks; in xfs_save_resvblks()
928 xfs_reserve_blocks(mp, 0); in xfs_save_resvblks()
932 xfs_restore_resvblks(struct xfs_mount *mp) in xfs_restore_resvblks() argument
936 if (mp->m_resblks_save) { in xfs_restore_resvblks()
937 resblks = mp->m_resblks_save; in xfs_restore_resvblks()
938 mp->m_resblks_save = 0; in xfs_restore_resvblks()
940 resblks = xfs_default_resblks(mp); in xfs_restore_resvblks()
942 xfs_reserve_blocks(mp, resblks); in xfs_restore_resvblks()
955 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_freeze() local
965 xfs_save_resvblks(mp); in xfs_fs_freeze()
966 ret = xfs_log_quiesce(mp); in xfs_fs_freeze()
976 if (ret && !xfs_is_readonly(mp)) { in xfs_fs_freeze()
977 xfs_blockgc_start(mp); in xfs_fs_freeze()
978 xfs_inodegc_start(mp); in xfs_fs_freeze()
988 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_unfreeze() local
990 xfs_restore_resvblks(mp); in xfs_fs_unfreeze()
991 xfs_log_work_queue(mp); in xfs_fs_unfreeze()
999 if (!xfs_is_readonly(mp)) { in xfs_fs_unfreeze()
1000 xfs_blockgc_start(mp); in xfs_fs_unfreeze()
1001 xfs_inodegc_start(mp); in xfs_fs_unfreeze()
1013 struct xfs_mount *mp) in xfs_finish_flags() argument
1016 if (xfs_has_logv2(mp)) { in xfs_finish_flags()
1017 if (mp->m_logbsize <= 0 && in xfs_finish_flags()
1018 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
1019 mp->m_logbsize = mp->m_sb.sb_logsunit; in xfs_finish_flags()
1020 } else if (mp->m_logbsize > 0 && in xfs_finish_flags()
1021 mp->m_logbsize < mp->m_sb.sb_logsunit) { in xfs_finish_flags()
1022 xfs_warn(mp, in xfs_finish_flags()
1028 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
1029 xfs_warn(mp, in xfs_finish_flags()
1038 if (xfs_has_crc(mp) && xfs_has_noattr2(mp)) { in xfs_finish_flags()
1039 xfs_warn(mp, "Cannot mount a V5 filesystem as noattr2. " in xfs_finish_flags()
1047 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
1048 xfs_warn(mp, in xfs_finish_flags()
1053 if ((mp->m_qflags & XFS_GQUOTA_ACCT) && in xfs_finish_flags()
1054 (mp->m_qflags & XFS_PQUOTA_ACCT) && in xfs_finish_flags()
1055 !xfs_has_pquotino(mp)) { in xfs_finish_flags()
1056 xfs_warn(mp, in xfs_finish_flags()
1066 struct xfs_mount *mp) in xfs_init_percpu_counters() argument
1070 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1074 error = percpu_counter_init(&mp->m_ifree, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1078 error = percpu_counter_init(&mp->m_fdblocks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1082 error = percpu_counter_init(&mp->m_delalloc_blks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1086 error = percpu_counter_init(&mp->m_delalloc_rtextents, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1090 error = percpu_counter_init(&mp->m_frextents, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1097 percpu_counter_destroy(&mp->m_delalloc_rtextents); in xfs_init_percpu_counters()
1099 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_init_percpu_counters()
1101 percpu_counter_destroy(&mp->m_fdblocks); in xfs_init_percpu_counters()
1103 percpu_counter_destroy(&mp->m_ifree); in xfs_init_percpu_counters()
1105 percpu_counter_destroy(&mp->m_icount); in xfs_init_percpu_counters()
1111 struct xfs_mount *mp) in xfs_reinit_percpu_counters() argument
1113 percpu_counter_set(&mp->m_icount, mp->m_sb.sb_icount); in xfs_reinit_percpu_counters()
1114 percpu_counter_set(&mp->m_ifree, mp->m_sb.sb_ifree); in xfs_reinit_percpu_counters()
1115 percpu_counter_set(&mp->m_fdblocks, mp->m_sb.sb_fdblocks); in xfs_reinit_percpu_counters()
1116 percpu_counter_set(&mp->m_frextents, mp->m_sb.sb_frextents); in xfs_reinit_percpu_counters()
1121 struct xfs_mount *mp) in xfs_destroy_percpu_counters() argument
1123 percpu_counter_destroy(&mp->m_icount); in xfs_destroy_percpu_counters()
1124 percpu_counter_destroy(&mp->m_ifree); in xfs_destroy_percpu_counters()
1125 percpu_counter_destroy(&mp->m_fdblocks); in xfs_destroy_percpu_counters()
1126 ASSERT(xfs_is_shutdown(mp) || in xfs_destroy_percpu_counters()
1127 percpu_counter_sum(&mp->m_delalloc_rtextents) == 0); in xfs_destroy_percpu_counters()
1128 percpu_counter_destroy(&mp->m_delalloc_rtextents); in xfs_destroy_percpu_counters()
1129 ASSERT(xfs_is_shutdown(mp) || in xfs_destroy_percpu_counters()
1130 percpu_counter_sum(&mp->m_delalloc_blks) == 0); in xfs_destroy_percpu_counters()
1131 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_destroy_percpu_counters()
1132 percpu_counter_destroy(&mp->m_frextents); in xfs_destroy_percpu_counters()
1137 struct xfs_mount *mp) in xfs_inodegc_init_percpu() argument
1142 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1143 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1147 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1149 gc->mp = mp; in xfs_inodegc_init_percpu()
1160 struct xfs_mount *mp) in xfs_inodegc_free_percpu() argument
1162 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1164 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1171 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_put_super() local
1173 xfs_notice(mp, "Unmounting Filesystem %pU", &mp->m_sb.sb_uuid); in xfs_fs_put_super()
1174 xfs_filestream_unmount(mp); in xfs_fs_put_super()
1175 xfs_unmountfs(mp); in xfs_fs_put_super()
1177 xfs_rtmount_freesb(mp); in xfs_fs_put_super()
1178 xfs_freesb(mp); in xfs_fs_put_super()
1179 xchk_mount_stats_free(mp); in xfs_fs_put_super()
1180 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1181 xfs_inodegc_free_percpu(mp); in xfs_fs_put_super()
1182 xfs_destroy_percpu_counters(mp); in xfs_fs_put_super()
1183 xfs_destroy_mount_workqueues(mp); in xfs_fs_put_super()
1184 xfs_shutdown_devices(mp); in xfs_fs_put_super()
1283 * NOTE: mp->m_super is NULL here!
1449 struct xfs_mount *mp) in xfs_fs_validate_params() argument
1452 if (xfs_has_norecovery(mp) && !xfs_is_readonly(mp)) { in xfs_fs_validate_params()
1453 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1461 if (xfs_has_attr2(mp) && xfs_has_noattr2(mp)) { in xfs_fs_validate_params()
1462 xfs_warn(mp, "attr2 and noattr2 cannot both be specified."); in xfs_fs_validate_params()
1467 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1468 xfs_warn(mp, in xfs_fs_validate_params()
1474 (mp->m_qflags & ~XFS_QFLAGS_MNTOPTS)) { in xfs_fs_validate_params()
1475 xfs_warn(mp, "quota support not available in this kernel."); in xfs_fs_validate_params()
1479 if ((mp->m_dalign && !mp->m_swidth) || in xfs_fs_validate_params()
1480 (!mp->m_dalign && mp->m_swidth)) { in xfs_fs_validate_params()
1481 xfs_warn(mp, "sunit and swidth must be specified together"); in xfs_fs_validate_params()
1485 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1486 xfs_warn(mp, in xfs_fs_validate_params()
1488 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1492 if (mp->m_logbufs != -1 && in xfs_fs_validate_params()
1493 mp->m_logbufs != 0 && in xfs_fs_validate_params()
1494 (mp->m_logbufs < XLOG_MIN_ICLOGS || in xfs_fs_validate_params()
1495 mp->m_logbufs > XLOG_MAX_ICLOGS)) { in xfs_fs_validate_params()
1496 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", in xfs_fs_validate_params()
1497 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); in xfs_fs_validate_params()
1501 if (mp->m_logbsize != -1 && in xfs_fs_validate_params()
1502 mp->m_logbsize != 0 && in xfs_fs_validate_params()
1503 (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE || in xfs_fs_validate_params()
1504 mp->m_logbsize > XLOG_MAX_RECORD_BSIZE || in xfs_fs_validate_params()
1505 !is_power_of_2(mp->m_logbsize))) { in xfs_fs_validate_params()
1506 xfs_warn(mp, in xfs_fs_validate_params()
1508 mp->m_logbsize); in xfs_fs_validate_params()
1512 if (xfs_has_allocsize(mp) && in xfs_fs_validate_params()
1513 (mp->m_allocsize_log > XFS_MAX_IO_LOG || in xfs_fs_validate_params()
1514 mp->m_allocsize_log < XFS_MIN_IO_LOG)) { in xfs_fs_validate_params()
1515 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", in xfs_fs_validate_params()
1516 mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG); in xfs_fs_validate_params()
1543 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super() local
1547 mp->m_super = sb; in xfs_fs_fill_super()
1555 xfs_set_readonly(mp); in xfs_fs_fill_super()
1557 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_fs_fill_super()
1559 mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_fill_super()
1561 error = xfs_fs_validate_params(mp); in xfs_fs_fill_super()
1580 xfs_notice(mp, "Delaying mount for %d seconds.", in xfs_fs_fill_super()
1588 error = xfs_open_devices(mp); in xfs_fs_fill_super()
1593 mp->m_debugfs = xfs_debugfs_mkdir(mp->m_super->s_id, in xfs_fs_fill_super()
1596 mp->m_debugfs = NULL; in xfs_fs_fill_super()
1599 error = xfs_init_mount_workqueues(mp); in xfs_fs_fill_super()
1603 error = xfs_init_percpu_counters(mp); in xfs_fs_fill_super()
1607 error = xfs_inodegc_init_percpu(mp); in xfs_fs_fill_super()
1612 mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); in xfs_fs_fill_super()
1613 if (!mp->m_stats.xs_stats) { in xfs_fs_fill_super()
1618 error = xchk_mount_stats_alloc(mp); in xfs_fs_fill_super()
1622 error = xfs_readsb(mp, flags); in xfs_fs_fill_super()
1626 error = xfs_finish_flags(mp); in xfs_fs_fill_super()
1630 error = xfs_setup_devices(mp); in xfs_fs_fill_super()
1640 if (!(mp->m_features & XFS_FEAT_CRC)) { in xfs_fs_fill_super()
1642 xfs_warn(mp, in xfs_fs_fill_super()
1647 xfs_warn_once(mp, in xfs_fs_fill_super()
1652 if (xfs_has_asciici(mp)) { in xfs_fs_fill_super()
1654 xfs_warn_once(mp, in xfs_fs_fill_super()
1657 xfs_warn(mp, in xfs_fs_fill_super()
1669 if (xfs_has_needsrepair(mp) && !xfs_has_norecovery(mp)) { in xfs_fs_fill_super()
1670 xfs_warn(mp, "Filesystem needs repair. Please run xfs_repair."); in xfs_fs_fill_super()
1680 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1681 xfs_warn(mp, "Offline file system operation in progress!"); in xfs_fs_fill_super()
1686 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1689 if (!xfs_has_crc(mp)) { in xfs_fs_fill_super()
1690 xfs_warn(mp, in xfs_fs_fill_super()
1692 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1697 if (mp->m_sb.sb_blocksize > max_folio_size) { in xfs_fs_fill_super()
1698 xfs_warn(mp, in xfs_fs_fill_super()
1700 mp->m_sb.sb_blocksize, max_folio_size); in xfs_fs_fill_super()
1705 xfs_warn_experimental(mp, XFS_EXPERIMENTAL_LBS); in xfs_fs_fill_super()
1709 if (xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_dblocks) || in xfs_fs_fill_super()
1710 xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_rblocks)) { in xfs_fs_fill_super()
1711 xfs_warn(mp, in xfs_fs_fill_super()
1728 if (!xfs_verify_fileoff(mp, XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE))) { in xfs_fs_fill_super()
1729 xfs_warn(mp, in xfs_fs_fill_super()
1731 XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE), in xfs_fs_fill_super()
1737 error = xfs_rtmount_readsb(mp); in xfs_fs_fill_super()
1741 error = xfs_filestream_mount(mp); in xfs_fs_fill_super()
1750 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1755 if (xfs_has_bigtime(mp)) { in xfs_fs_fill_super()
1762 trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max); in xfs_fs_fill_super()
1768 if (xfs_has_crc(mp)) in xfs_fs_fill_super()
1771 if (xfs_has_dax_always(mp)) { in xfs_fs_fill_super()
1772 error = xfs_setup_dax_always(mp); in xfs_fs_fill_super()
1777 if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { in xfs_fs_fill_super()
1778 xfs_warn(mp, in xfs_fs_fill_super()
1780 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1783 if (xfs_has_metadir(mp)) in xfs_fs_fill_super()
1784 xfs_warn_experimental(mp, XFS_EXPERIMENTAL_METADIR); in xfs_fs_fill_super()
1786 if (xfs_has_reflink(mp)) { in xfs_fs_fill_super()
1787 if (xfs_has_realtime(mp) && in xfs_fs_fill_super()
1788 !xfs_reflink_supports_rextsize(mp, mp->m_sb.sb_rextsize)) { in xfs_fs_fill_super()
1789 xfs_alert(mp, in xfs_fs_fill_super()
1791 mp->m_sb.sb_rextsize); in xfs_fs_fill_super()
1797 xfs_info(mp, "using DEBUG-only always_cow mode."); in xfs_fs_fill_super()
1798 mp->m_always_cow = true; in xfs_fs_fill_super()
1803 if (xfs_has_exchange_range(mp)) in xfs_fs_fill_super()
1804 xfs_warn_experimental(mp, XFS_EXPERIMENTAL_EXCHRANGE); in xfs_fs_fill_super()
1806 if (xfs_has_parent(mp)) in xfs_fs_fill_super()
1807 xfs_warn_experimental(mp, XFS_EXPERIMENTAL_PPTR); in xfs_fs_fill_super()
1813 if (!(mp->m_qflags & XFS_QFLAGS_MNTOPTS)) in xfs_fs_fill_super()
1814 xfs_set_resuming_quotaon(mp); in xfs_fs_fill_super()
1815 mp->m_qflags &= ~XFS_QFLAGS_MNTOPTS; in xfs_fs_fill_super()
1817 error = xfs_mountfs(mp); in xfs_fs_fill_super()
1821 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1835 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1837 xfs_rtmount_freesb(mp); in xfs_fs_fill_super()
1839 xfs_freesb(mp); in xfs_fs_fill_super()
1841 xchk_mount_stats_free(mp); in xfs_fs_fill_super()
1843 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1845 xfs_inodegc_free_percpu(mp); in xfs_fs_fill_super()
1847 xfs_destroy_percpu_counters(mp); in xfs_fs_fill_super()
1849 xfs_destroy_mount_workqueues(mp); in xfs_fs_fill_super()
1851 xfs_shutdown_devices(mp); in xfs_fs_fill_super()
1855 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1856 xfs_unmountfs(mp); in xfs_fs_fill_super()
1869 struct xfs_mount *mp) in xfs_remount_rw() argument
1871 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
1874 if (xfs_has_norecovery(mp)) { in xfs_remount_rw()
1875 xfs_warn(mp, in xfs_remount_rw()
1882 xfs_warn(mp, in xfs_remount_rw()
1889 xfs_clear_readonly(mp); in xfs_remount_rw()
1895 if (mp->m_update_sb) { in xfs_remount_rw()
1896 error = xfs_sync_sb(mp, false); in xfs_remount_rw()
1898 xfs_warn(mp, "failed to write sb changes"); in xfs_remount_rw()
1901 mp->m_update_sb = false; in xfs_remount_rw()
1908 xfs_restore_resvblks(mp); in xfs_remount_rw()
1909 xfs_log_work_queue(mp); in xfs_remount_rw()
1910 xfs_blockgc_start(mp); in xfs_remount_rw()
1913 error = xfs_fs_reserve_ag_blocks(mp); in xfs_remount_rw()
1918 xfs_inodegc_start(mp); in xfs_remount_rw()
1925 struct xfs_mount *mp) in xfs_remount_ro() argument
1933 error = sync_filesystem(mp->m_super); in xfs_remount_ro()
1941 xfs_blockgc_stop(mp); in xfs_remount_ro()
1949 error = xfs_blockgc_free_space(mp, &icw); in xfs_remount_ro()
1951 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_remount_ro()
1962 xfs_inodegc_stop(mp); in xfs_remount_ro()
1965 xfs_fs_unreserve_ag_blocks(mp); in xfs_remount_ro()
1974 xfs_save_resvblks(mp); in xfs_remount_ro()
1976 xfs_log_clean(mp); in xfs_remount_ro()
1977 xfs_set_readonly(mp); in xfs_remount_ro()
1998 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure() local
2006 if (xfs_has_crc(mp)) in xfs_fs_reconfigure()
2014 if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
2015 mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
2016 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
2020 if (!xfs_has_small_inums(mp) && xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
2021 mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
2022 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
2026 if (xfs_is_readonly(mp) && !(flags & SB_RDONLY)) { in xfs_fs_reconfigure()
2027 error = xfs_remount_rw(mp); in xfs_fs_reconfigure()
2033 if (!xfs_is_readonly(mp) && (flags & SB_RDONLY)) { in xfs_fs_reconfigure()
2034 error = xfs_remount_ro(mp); in xfs_fs_reconfigure()
2046 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free() local
2049 * mp is stored in the fs_context when it is initialized. in xfs_fs_free()
2050 * mp is transferred to the superblock on a successful mount, in xfs_fs_free()
2054 if (mp) in xfs_fs_free()
2055 xfs_mount_free(mp); in xfs_fs_free()
2074 struct xfs_mount *mp; in xfs_init_fs_context() local
2077 mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL | __GFP_NOFAIL); in xfs_init_fs_context()
2078 if (!mp) in xfs_init_fs_context()
2081 spin_lock_init(&mp->m_sb_lock); in xfs_init_fs_context()
2083 xa_init(&mp->m_groups[i].xa); in xfs_init_fs_context()
2084 mutex_init(&mp->m_growlock); in xfs_init_fs_context()
2085 INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); in xfs_init_fs_context()
2086 INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); in xfs_init_fs_context()
2087 mp->m_kobj.kobject.kset = xfs_kset; in xfs_init_fs_context()
2094 mp->m_finobt_nores = true; in xfs_init_fs_context()
2099 mp->m_logbufs = -1; in xfs_init_fs_context()
2100 mp->m_logbsize = -1; in xfs_init_fs_context()
2101 mp->m_allocsize_log = 16; /* 64k */ in xfs_init_fs_context()
2103 xfs_hooks_init(&mp->m_dir_update_hooks); in xfs_init_fs_context()
2105 fc->s_fs_info = mp; in xfs_init_fs_context()