Lines Matching full:mp

71 	struct xfs_mount	*mp,  in xfs_mount_set_dax_mode()  argument
76 mp->m_features &= ~(XFS_FEAT_DAX_ALWAYS | XFS_FEAT_DAX_NEVER); in xfs_mount_set_dax_mode()
79 mp->m_features |= XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
80 mp->m_features &= ~XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
83 mp->m_features |= XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
84 mp->m_features &= ~XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
183 struct xfs_mount *mp = XFS_M(root->d_sb); in xfs_fs_show_options() local
187 if (mp->m_features & xfs_infop->flag) in xfs_fs_show_options()
191 seq_printf(m, ",inode%d", xfs_has_small_inums(mp) ? 32 : 64); in xfs_fs_show_options()
193 if (xfs_has_allocsize(mp)) in xfs_fs_show_options()
195 (1 << mp->m_allocsize_log) >> 10); in xfs_fs_show_options()
197 if (mp->m_logbufs > 0) in xfs_fs_show_options()
198 seq_printf(m, ",logbufs=%d", mp->m_logbufs); in xfs_fs_show_options()
199 if (mp->m_logbsize > 0) in xfs_fs_show_options()
200 seq_printf(m, ",logbsize=%dk", mp->m_logbsize >> 10); in xfs_fs_show_options()
202 if (mp->m_logname) in xfs_fs_show_options()
203 seq_show_option(m, "logdev", mp->m_logname); in xfs_fs_show_options()
204 if (mp->m_rtname) in xfs_fs_show_options()
205 seq_show_option(m, "rtdev", mp->m_rtname); in xfs_fs_show_options()
207 if (mp->m_dalign > 0) in xfs_fs_show_options()
209 (int)XFS_FSB_TO_BB(mp, mp->m_dalign)); in xfs_fs_show_options()
210 if (mp->m_swidth > 0) in xfs_fs_show_options()
212 (int)XFS_FSB_TO_BB(mp, mp->m_swidth)); in xfs_fs_show_options()
214 if (mp->m_qflags & XFS_UQUOTA_ENFD) in xfs_fs_show_options()
216 else if (mp->m_qflags & XFS_UQUOTA_ACCT) in xfs_fs_show_options()
219 if (mp->m_qflags & XFS_PQUOTA_ENFD) in xfs_fs_show_options()
221 else if (mp->m_qflags & XFS_PQUOTA_ACCT) in xfs_fs_show_options()
224 if (mp->m_qflags & XFS_GQUOTA_ENFD) in xfs_fs_show_options()
226 else if (mp->m_qflags & XFS_GQUOTA_ACCT) in xfs_fs_show_options()
229 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) in xfs_fs_show_options()
271 * because in the growfs case, mp->m_sb.sb_agcount is not yet updated
278 struct xfs_mount *mp, in xfs_set_inode_alloc() argument
283 xfs_sb_t *sbp = &mp->m_sb; in xfs_set_inode_alloc()
292 if (M_IGEO(mp)->maxicount) { in xfs_set_inode_alloc()
305 agino = XFS_AGB_TO_AGINO(mp, sbp->sb_agblocks - 1); in xfs_set_inode_alloc()
306 ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino); in xfs_set_inode_alloc()
313 if (xfs_has_small_inums(mp) && ino > XFS_MAXINUMBER_32) in xfs_set_inode_alloc()
314 xfs_set_inode32(mp); in xfs_set_inode_alloc()
316 xfs_clear_inode32(mp); in xfs_set_inode_alloc()
321 ino = XFS_AGINO_TO_INO(mp, index, agino); in xfs_set_inode_alloc()
323 pag = xfs_perag_get(mp, index); in xfs_set_inode_alloc()
329 return xfs_is_inode32(mp) ? maxagi : agcount; in xfs_set_inode_alloc()
334 struct xfs_mount *mp) in xfs_setup_dax_always() argument
336 if (!mp->m_ddev_targp->bt_daxdev && in xfs_setup_dax_always()
337 (!mp->m_rtdev_targp || !mp->m_rtdev_targp->bt_daxdev)) { in xfs_setup_dax_always()
338 xfs_alert(mp, in xfs_setup_dax_always()
343 if (mp->m_super->s_blocksize != PAGE_SIZE) { in xfs_setup_dax_always()
344 xfs_alert(mp, in xfs_setup_dax_always()
349 if (xfs_has_reflink(mp) && in xfs_setup_dax_always()
350 bdev_is_partition(mp->m_ddev_targp->bt_bdev)) { in xfs_setup_dax_always()
351 xfs_alert(mp, in xfs_setup_dax_always()
359 xfs_mount_set_dax_mode(mp, XFS_DAX_NEVER); in xfs_setup_dax_always()
365 xfs_mount_t *mp, in xfs_blkdev_get() argument
373 mp->m_super, &fs_holder_ops); in xfs_blkdev_get()
377 xfs_warn(mp, "Invalid device [%s], error=%d", name, error); in xfs_blkdev_get()
385 struct xfs_mount *mp) in xfs_shutdown_devices() argument
413 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_shutdown_devices()
414 blkdev_issue_flush(mp->m_logdev_targp->bt_bdev); in xfs_shutdown_devices()
415 invalidate_bdev(mp->m_logdev_targp->bt_bdev); in xfs_shutdown_devices()
417 if (mp->m_rtdev_targp) { in xfs_shutdown_devices()
418 blkdev_issue_flush(mp->m_rtdev_targp->bt_bdev); in xfs_shutdown_devices()
419 invalidate_bdev(mp->m_rtdev_targp->bt_bdev); in xfs_shutdown_devices()
421 blkdev_issue_flush(mp->m_ddev_targp->bt_bdev); in xfs_shutdown_devices()
422 invalidate_bdev(mp->m_ddev_targp->bt_bdev); in xfs_shutdown_devices()
437 struct xfs_mount *mp) in xfs_open_devices() argument
439 struct super_block *sb = mp->m_super; in xfs_open_devices()
447 if (mp->m_logname) { in xfs_open_devices()
448 error = xfs_blkdev_get(mp, mp->m_logname, &logdev_file); in xfs_open_devices()
453 if (mp->m_rtname) { in xfs_open_devices()
454 error = xfs_blkdev_get(mp, mp->m_rtname, &rtdev_file); in xfs_open_devices()
461 xfs_warn(mp, in xfs_open_devices()
472 mp->m_ddev_targp = xfs_alloc_buftarg(mp, sb->s_bdev_file); in xfs_open_devices()
473 if (!mp->m_ddev_targp) in xfs_open_devices()
477 mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev_file); in xfs_open_devices()
478 if (!mp->m_rtdev_targp) in xfs_open_devices()
483 mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev_file); in xfs_open_devices()
484 if (!mp->m_logdev_targp) in xfs_open_devices()
487 mp->m_logdev_targp = mp->m_ddev_targp; in xfs_open_devices()
496 if (mp->m_rtdev_targp) in xfs_open_devices()
497 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_open_devices()
499 xfs_free_buftarg(mp->m_ddev_targp); in xfs_open_devices()
514 struct xfs_mount *mp) in xfs_setup_devices() argument
518 error = xfs_setsize_buftarg(mp->m_ddev_targp, mp->m_sb.sb_sectsize); in xfs_setup_devices()
522 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_setup_devices()
525 if (xfs_has_sector(mp)) in xfs_setup_devices()
526 log_sector_size = mp->m_sb.sb_logsectsize; in xfs_setup_devices()
527 error = xfs_setsize_buftarg(mp->m_logdev_targp, in xfs_setup_devices()
532 if (mp->m_rtdev_targp) { in xfs_setup_devices()
533 error = xfs_setsize_buftarg(mp->m_rtdev_targp, in xfs_setup_devices()
534 mp->m_sb.sb_sectsize); in xfs_setup_devices()
544 struct xfs_mount *mp) in xfs_init_mount_workqueues() argument
546 mp->m_buf_workqueue = alloc_workqueue("xfs-buf/%s", in xfs_init_mount_workqueues()
548 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
549 if (!mp->m_buf_workqueue) in xfs_init_mount_workqueues()
552 mp->m_unwritten_workqueue = alloc_workqueue("xfs-conv/%s", in xfs_init_mount_workqueues()
554 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
555 if (!mp->m_unwritten_workqueue) in xfs_init_mount_workqueues()
558 mp->m_reclaim_workqueue = alloc_workqueue("xfs-reclaim/%s", in xfs_init_mount_workqueues()
560 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
561 if (!mp->m_reclaim_workqueue) in xfs_init_mount_workqueues()
564 mp->m_blockgc_wq = alloc_workqueue("xfs-blockgc/%s", in xfs_init_mount_workqueues()
566 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
567 if (!mp->m_blockgc_wq) in xfs_init_mount_workqueues()
570 mp->m_inodegc_wq = alloc_workqueue("xfs-inodegc/%s", in xfs_init_mount_workqueues()
572 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
573 if (!mp->m_inodegc_wq) in xfs_init_mount_workqueues()
576 mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s", in xfs_init_mount_workqueues()
577 XFS_WQFLAGS(WQ_FREEZABLE), 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
578 if (!mp->m_sync_workqueue) in xfs_init_mount_workqueues()
584 destroy_workqueue(mp->m_inodegc_wq); in xfs_init_mount_workqueues()
586 destroy_workqueue(mp->m_blockgc_wq); in xfs_init_mount_workqueues()
588 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_init_mount_workqueues()
590 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_init_mount_workqueues()
592 destroy_workqueue(mp->m_buf_workqueue); in xfs_init_mount_workqueues()
599 struct xfs_mount *mp) in xfs_destroy_mount_workqueues() argument
601 destroy_workqueue(mp->m_sync_workqueue); in xfs_destroy_mount_workqueues()
602 destroy_workqueue(mp->m_blockgc_wq); in xfs_destroy_mount_workqueues()
603 destroy_workqueue(mp->m_inodegc_wq); in xfs_destroy_mount_workqueues()
604 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_destroy_mount_workqueues()
605 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_destroy_mount_workqueues()
606 destroy_workqueue(mp->m_buf_workqueue); in xfs_destroy_mount_workqueues()
613 struct xfs_mount *mp = container_of(work, struct xfs_mount, in xfs_flush_inodes_worker() local
615 struct super_block *sb = mp->m_super; in xfs_flush_inodes_worker()
631 struct xfs_mount *mp) in xfs_flush_inodes() argument
637 if (flush_work(&mp->m_flush_inodes_work)) in xfs_flush_inodes()
640 queue_work(mp->m_sync_workqueue, &mp->m_flush_inodes_work); in xfs_flush_inodes()
641 flush_work(&mp->m_flush_inodes_work); in xfs_flush_inodes()
677 struct xfs_mount *mp = ip->i_mount; in xfs_fs_dirty_inode() local
691 if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) in xfs_fs_dirty_inode()
752 struct xfs_mount *mp) in xfs_mount_free() argument
754 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) in xfs_mount_free()
755 xfs_free_buftarg(mp->m_logdev_targp); in xfs_mount_free()
756 if (mp->m_rtdev_targp) in xfs_mount_free()
757 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_mount_free()
758 if (mp->m_ddev_targp) in xfs_mount_free()
759 xfs_free_buftarg(mp->m_ddev_targp); in xfs_mount_free()
761 debugfs_remove(mp->m_debugfs); in xfs_mount_free()
762 kfree(mp->m_rtname); in xfs_mount_free()
763 kfree(mp->m_logname); in xfs_mount_free()
764 kfree(mp); in xfs_mount_free()
772 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_sync_fs() local
775 trace_xfs_fs_sync_fs(mp, __return_address); in xfs_fs_sync_fs()
783 error = xfs_log_force(mp, XFS_LOG_SYNC); in xfs_fs_sync_fs()
793 flush_delayed_work(&mp->m_log->l_work); in xfs_fs_sync_fs()
811 xfs_inodegc_stop(mp); in xfs_fs_sync_fs()
812 xfs_blockgc_stop(mp); in xfs_fs_sync_fs()
823 struct xfs_mount *mp = XFS_M(dentry->d_sb); in xfs_fs_statfs() local
824 xfs_sb_t *sbp = &mp->m_sb; in xfs_fs_statfs()
837 xfs_inodegc_push(mp); in xfs_fs_statfs()
842 id = huge_encode_dev(mp->m_ddev_targp->bt_dev); in xfs_fs_statfs()
845 icount = percpu_counter_sum(&mp->m_icount); in xfs_fs_statfs()
846 ifree = percpu_counter_sum(&mp->m_ifree); in xfs_fs_statfs()
847 fdblocks = percpu_counter_sum(&mp->m_fdblocks); in xfs_fs_statfs()
849 spin_lock(&mp->m_sb_lock); in xfs_fs_statfs()
853 spin_unlock(&mp->m_sb_lock); in xfs_fs_statfs()
857 fdblocks - xfs_fdblocks_unavailable(mp)); in xfs_fs_statfs()
860 fakeinos = XFS_FSB_TO_INO(mp, statp->f_bfree); in xfs_fs_statfs()
862 if (M_IGEO(mp)->maxicount) in xfs_fs_statfs()
865 M_IGEO(mp)->maxicount); in xfs_fs_statfs()
878 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
882 if (XFS_IS_REALTIME_MOUNT(mp) && in xfs_fs_statfs()
887 freertx = percpu_counter_sum_positive(&mp->m_frextents); in xfs_fs_statfs()
888 statp->f_bavail = statp->f_bfree = xfs_rtx_to_rtb(mp, freertx); in xfs_fs_statfs()
895 xfs_save_resvblks(struct xfs_mount *mp) in xfs_save_resvblks() argument
897 mp->m_resblks_save = mp->m_resblks; in xfs_save_resvblks()
898 xfs_reserve_blocks(mp, 0); in xfs_save_resvblks()
902 xfs_restore_resvblks(struct xfs_mount *mp) in xfs_restore_resvblks() argument
906 if (mp->m_resblks_save) { in xfs_restore_resvblks()
907 resblks = mp->m_resblks_save; in xfs_restore_resvblks()
908 mp->m_resblks_save = 0; in xfs_restore_resvblks()
910 resblks = xfs_default_resblks(mp); in xfs_restore_resvblks()
912 xfs_reserve_blocks(mp, resblks); in xfs_restore_resvblks()
925 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_freeze() local
935 xfs_save_resvblks(mp); in xfs_fs_freeze()
936 ret = xfs_log_quiesce(mp); in xfs_fs_freeze()
946 if (ret && !xfs_is_readonly(mp)) { in xfs_fs_freeze()
947 xfs_blockgc_start(mp); in xfs_fs_freeze()
948 xfs_inodegc_start(mp); in xfs_fs_freeze()
958 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_unfreeze() local
960 xfs_restore_resvblks(mp); in xfs_fs_unfreeze()
961 xfs_log_work_queue(mp); in xfs_fs_unfreeze()
969 if (!xfs_is_readonly(mp)) { in xfs_fs_unfreeze()
970 xfs_blockgc_start(mp); in xfs_fs_unfreeze()
971 xfs_inodegc_start(mp); in xfs_fs_unfreeze()
983 struct xfs_mount *mp) in xfs_finish_flags() argument
986 if (xfs_has_logv2(mp)) { in xfs_finish_flags()
987 if (mp->m_logbsize <= 0 && in xfs_finish_flags()
988 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
989 mp->m_logbsize = mp->m_sb.sb_logsunit; in xfs_finish_flags()
990 } else if (mp->m_logbsize > 0 && in xfs_finish_flags()
991 mp->m_logbsize < mp->m_sb.sb_logsunit) { in xfs_finish_flags()
992 xfs_warn(mp, in xfs_finish_flags()
998 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
999 xfs_warn(mp, in xfs_finish_flags()
1008 if (xfs_has_crc(mp) && xfs_has_noattr2(mp)) { in xfs_finish_flags()
1009 xfs_warn(mp, "Cannot mount a V5 filesystem as noattr2. " in xfs_finish_flags()
1017 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
1018 xfs_warn(mp, in xfs_finish_flags()
1023 if ((mp->m_qflags & XFS_GQUOTA_ACCT) && in xfs_finish_flags()
1024 (mp->m_qflags & XFS_PQUOTA_ACCT) && in xfs_finish_flags()
1025 !xfs_has_pquotino(mp)) { in xfs_finish_flags()
1026 xfs_warn(mp, in xfs_finish_flags()
1036 struct xfs_mount *mp) in xfs_init_percpu_counters() argument
1040 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1044 error = percpu_counter_init(&mp->m_ifree, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1048 error = percpu_counter_init(&mp->m_fdblocks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1052 error = percpu_counter_init(&mp->m_delalloc_blks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1056 error = percpu_counter_init(&mp->m_delalloc_rtextents, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1060 error = percpu_counter_init(&mp->m_frextents, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1067 percpu_counter_destroy(&mp->m_delalloc_rtextents); in xfs_init_percpu_counters()
1069 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_init_percpu_counters()
1071 percpu_counter_destroy(&mp->m_fdblocks); in xfs_init_percpu_counters()
1073 percpu_counter_destroy(&mp->m_ifree); in xfs_init_percpu_counters()
1075 percpu_counter_destroy(&mp->m_icount); in xfs_init_percpu_counters()
1081 struct xfs_mount *mp) in xfs_reinit_percpu_counters() argument
1083 percpu_counter_set(&mp->m_icount, mp->m_sb.sb_icount); in xfs_reinit_percpu_counters()
1084 percpu_counter_set(&mp->m_ifree, mp->m_sb.sb_ifree); in xfs_reinit_percpu_counters()
1085 percpu_counter_set(&mp->m_fdblocks, mp->m_sb.sb_fdblocks); in xfs_reinit_percpu_counters()
1086 percpu_counter_set(&mp->m_frextents, mp->m_sb.sb_frextents); in xfs_reinit_percpu_counters()
1091 struct xfs_mount *mp) in xfs_destroy_percpu_counters() argument
1093 percpu_counter_destroy(&mp->m_icount); in xfs_destroy_percpu_counters()
1094 percpu_counter_destroy(&mp->m_ifree); in xfs_destroy_percpu_counters()
1095 percpu_counter_destroy(&mp->m_fdblocks); in xfs_destroy_percpu_counters()
1096 ASSERT(xfs_is_shutdown(mp) || in xfs_destroy_percpu_counters()
1097 percpu_counter_sum(&mp->m_delalloc_rtextents) == 0); in xfs_destroy_percpu_counters()
1098 percpu_counter_destroy(&mp->m_delalloc_rtextents); in xfs_destroy_percpu_counters()
1099 ASSERT(xfs_is_shutdown(mp) || in xfs_destroy_percpu_counters()
1100 percpu_counter_sum(&mp->m_delalloc_blks) == 0); in xfs_destroy_percpu_counters()
1101 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_destroy_percpu_counters()
1102 percpu_counter_destroy(&mp->m_frextents); in xfs_destroy_percpu_counters()
1107 struct xfs_mount *mp) in xfs_inodegc_init_percpu() argument
1112 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1113 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1117 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1119 gc->mp = mp; in xfs_inodegc_init_percpu()
1130 struct xfs_mount *mp) in xfs_inodegc_free_percpu() argument
1132 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1134 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1141 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_put_super() local
1143 xfs_notice(mp, "Unmounting Filesystem %pU", &mp->m_sb.sb_uuid); in xfs_fs_put_super()
1144 xfs_filestream_unmount(mp); in xfs_fs_put_super()
1145 xfs_unmountfs(mp); in xfs_fs_put_super()
1147 xfs_freesb(mp); in xfs_fs_put_super()
1148 xchk_mount_stats_free(mp); in xfs_fs_put_super()
1149 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1150 xfs_inodegc_free_percpu(mp); in xfs_fs_put_super()
1151 xfs_destroy_percpu_counters(mp); in xfs_fs_put_super()
1152 xfs_destroy_mount_workqueues(mp); in xfs_fs_put_super()
1153 xfs_shutdown_devices(mp); in xfs_fs_put_super()
1252 * NOTE: mp->m_super is NULL here!
1409 struct xfs_mount *mp) in xfs_fs_validate_params() argument
1412 if (xfs_has_norecovery(mp) && !xfs_is_readonly(mp)) { in xfs_fs_validate_params()
1413 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1421 if (xfs_has_attr2(mp) && xfs_has_noattr2(mp)) { in xfs_fs_validate_params()
1422 xfs_warn(mp, "attr2 and noattr2 cannot both be specified."); in xfs_fs_validate_params()
1427 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1428 xfs_warn(mp, in xfs_fs_validate_params()
1433 if (!IS_ENABLED(CONFIG_XFS_QUOTA) && mp->m_qflags != 0) { in xfs_fs_validate_params()
1434 xfs_warn(mp, "quota support not available in this kernel."); in xfs_fs_validate_params()
1438 if ((mp->m_dalign && !mp->m_swidth) || in xfs_fs_validate_params()
1439 (!mp->m_dalign && mp->m_swidth)) { in xfs_fs_validate_params()
1440 xfs_warn(mp, "sunit and swidth must be specified together"); in xfs_fs_validate_params()
1444 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1445 xfs_warn(mp, in xfs_fs_validate_params()
1447 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1451 if (mp->m_logbufs != -1 && in xfs_fs_validate_params()
1452 mp->m_logbufs != 0 && in xfs_fs_validate_params()
1453 (mp->m_logbufs < XLOG_MIN_ICLOGS || in xfs_fs_validate_params()
1454 mp->m_logbufs > XLOG_MAX_ICLOGS)) { in xfs_fs_validate_params()
1455 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", in xfs_fs_validate_params()
1456 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); in xfs_fs_validate_params()
1460 if (mp->m_logbsize != -1 && in xfs_fs_validate_params()
1461 mp->m_logbsize != 0 && in xfs_fs_validate_params()
1462 (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE || in xfs_fs_validate_params()
1463 mp->m_logbsize > XLOG_MAX_RECORD_BSIZE || in xfs_fs_validate_params()
1464 !is_power_of_2(mp->m_logbsize))) { in xfs_fs_validate_params()
1465 xfs_warn(mp, in xfs_fs_validate_params()
1467 mp->m_logbsize); in xfs_fs_validate_params()
1471 if (xfs_has_allocsize(mp) && in xfs_fs_validate_params()
1472 (mp->m_allocsize_log > XFS_MAX_IO_LOG || in xfs_fs_validate_params()
1473 mp->m_allocsize_log < XFS_MIN_IO_LOG)) { in xfs_fs_validate_params()
1474 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", in xfs_fs_validate_params()
1475 mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG); in xfs_fs_validate_params()
1502 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super() local
1506 mp->m_super = sb; in xfs_fs_fill_super()
1514 xfs_set_readonly(mp); in xfs_fs_fill_super()
1516 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_fs_fill_super()
1518 mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_fill_super()
1520 error = xfs_fs_validate_params(mp); in xfs_fs_fill_super()
1539 xfs_notice(mp, "Delaying mount for %d seconds.", in xfs_fs_fill_super()
1547 error = xfs_open_devices(mp); in xfs_fs_fill_super()
1552 mp->m_debugfs = xfs_debugfs_mkdir(mp->m_super->s_id, in xfs_fs_fill_super()
1555 mp->m_debugfs = NULL; in xfs_fs_fill_super()
1558 error = xfs_init_mount_workqueues(mp); in xfs_fs_fill_super()
1562 error = xfs_init_percpu_counters(mp); in xfs_fs_fill_super()
1566 error = xfs_inodegc_init_percpu(mp); in xfs_fs_fill_super()
1571 mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); in xfs_fs_fill_super()
1572 if (!mp->m_stats.xs_stats) { in xfs_fs_fill_super()
1577 error = xchk_mount_stats_alloc(mp); in xfs_fs_fill_super()
1581 error = xfs_readsb(mp, flags); in xfs_fs_fill_super()
1585 error = xfs_finish_flags(mp); in xfs_fs_fill_super()
1589 error = xfs_setup_devices(mp); in xfs_fs_fill_super()
1599 if (!(mp->m_features & XFS_FEAT_CRC)) { in xfs_fs_fill_super()
1601 xfs_warn(mp, in xfs_fs_fill_super()
1606 xfs_warn_once(mp, in xfs_fs_fill_super()
1611 if (xfs_has_asciici(mp)) { in xfs_fs_fill_super()
1613 xfs_warn_once(mp, in xfs_fs_fill_super()
1616 xfs_warn(mp, in xfs_fs_fill_super()
1624 if (xfs_has_needsrepair(mp)) { in xfs_fs_fill_super()
1625 xfs_warn(mp, "Filesystem needs repair. Please run xfs_repair."); in xfs_fs_fill_super()
1635 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1636 xfs_warn(mp, "Offline file system operation in progress!"); in xfs_fs_fill_super()
1641 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1644 if (!xfs_has_crc(mp)) { in xfs_fs_fill_super()
1645 xfs_warn(mp, in xfs_fs_fill_super()
1647 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1652 if (mp->m_sb.sb_blocksize > max_folio_size) { in xfs_fs_fill_super()
1653 xfs_warn(mp, in xfs_fs_fill_super()
1655 mp->m_sb.sb_blocksize, max_folio_size); in xfs_fs_fill_super()
1660 xfs_warn(mp, in xfs_fs_fill_super()
1662 mp->m_sb.sb_blocksize); in xfs_fs_fill_super()
1666 if (xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_dblocks) || in xfs_fs_fill_super()
1667 xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_rblocks)) { in xfs_fs_fill_super()
1668 xfs_warn(mp, in xfs_fs_fill_super()
1685 if (!xfs_verify_fileoff(mp, XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE))) { in xfs_fs_fill_super()
1686 xfs_warn(mp, in xfs_fs_fill_super()
1688 XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE), in xfs_fs_fill_super()
1694 error = xfs_filestream_mount(mp); in xfs_fs_fill_super()
1703 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1708 if (xfs_has_bigtime(mp)) { in xfs_fs_fill_super()
1715 trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max); in xfs_fs_fill_super()
1721 if (xfs_has_crc(mp)) in xfs_fs_fill_super()
1724 if (xfs_has_dax_always(mp)) { in xfs_fs_fill_super()
1725 error = xfs_setup_dax_always(mp); in xfs_fs_fill_super()
1730 if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { in xfs_fs_fill_super()
1731 xfs_warn(mp, in xfs_fs_fill_super()
1733 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1736 if (xfs_has_reflink(mp)) { in xfs_fs_fill_super()
1737 if (mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1738 xfs_alert(mp, in xfs_fs_fill_super()
1745 xfs_info(mp, "using DEBUG-only always_cow mode."); in xfs_fs_fill_super()
1746 mp->m_always_cow = true; in xfs_fs_fill_super()
1750 if (xfs_has_rmapbt(mp) && mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1751 xfs_alert(mp, in xfs_fs_fill_super()
1757 if (xfs_has_exchange_range(mp)) in xfs_fs_fill_super()
1758 xfs_warn(mp, in xfs_fs_fill_super()
1761 if (xfs_has_parent(mp)) in xfs_fs_fill_super()
1762 xfs_warn(mp, in xfs_fs_fill_super()
1765 error = xfs_mountfs(mp); in xfs_fs_fill_super()
1769 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1783 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1785 xfs_freesb(mp); in xfs_fs_fill_super()
1787 xchk_mount_stats_free(mp); in xfs_fs_fill_super()
1789 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1791 xfs_inodegc_free_percpu(mp); in xfs_fs_fill_super()
1793 xfs_destroy_percpu_counters(mp); in xfs_fs_fill_super()
1795 xfs_destroy_mount_workqueues(mp); in xfs_fs_fill_super()
1797 xfs_shutdown_devices(mp); in xfs_fs_fill_super()
1801 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1802 xfs_unmountfs(mp); in xfs_fs_fill_super()
1815 struct xfs_mount *mp) in xfs_remount_rw() argument
1817 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
1820 if (xfs_has_norecovery(mp)) { in xfs_remount_rw()
1821 xfs_warn(mp, in xfs_remount_rw()
1828 xfs_warn(mp, in xfs_remount_rw()
1835 xfs_clear_readonly(mp); in xfs_remount_rw()
1841 if (mp->m_update_sb) { in xfs_remount_rw()
1842 error = xfs_sync_sb(mp, false); in xfs_remount_rw()
1844 xfs_warn(mp, "failed to write sb changes"); in xfs_remount_rw()
1847 mp->m_update_sb = false; in xfs_remount_rw()
1854 xfs_restore_resvblks(mp); in xfs_remount_rw()
1855 xfs_log_work_queue(mp); in xfs_remount_rw()
1856 xfs_blockgc_start(mp); in xfs_remount_rw()
1859 error = xfs_fs_reserve_ag_blocks(mp); in xfs_remount_rw()
1864 xfs_inodegc_start(mp); in xfs_remount_rw()
1871 struct xfs_mount *mp) in xfs_remount_ro() argument
1879 error = sync_filesystem(mp->m_super); in xfs_remount_ro()
1887 xfs_blockgc_stop(mp); in xfs_remount_ro()
1895 error = xfs_blockgc_free_space(mp, &icw); in xfs_remount_ro()
1897 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_remount_ro()
1908 xfs_inodegc_stop(mp); in xfs_remount_ro()
1911 xfs_fs_unreserve_ag_blocks(mp); in xfs_remount_ro()
1920 xfs_save_resvblks(mp); in xfs_remount_ro()
1922 xfs_log_clean(mp); in xfs_remount_ro()
1923 xfs_set_readonly(mp); in xfs_remount_ro()
1944 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure() local
1950 if (xfs_has_crc(mp)) in xfs_fs_reconfigure()
1958 if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
1959 mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1960 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1964 if (!xfs_has_small_inums(mp) && xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
1965 mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1966 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1970 if (xfs_is_readonly(mp) && !(flags & SB_RDONLY)) { in xfs_fs_reconfigure()
1971 error = xfs_remount_rw(mp); in xfs_fs_reconfigure()
1977 if (!xfs_is_readonly(mp) && (flags & SB_RDONLY)) { in xfs_fs_reconfigure()
1978 error = xfs_remount_ro(mp); in xfs_fs_reconfigure()
1990 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free() local
1993 * mp is stored in the fs_context when it is initialized. in xfs_fs_free()
1994 * mp is transferred to the superblock on a successful mount, in xfs_fs_free()
1998 if (mp) in xfs_fs_free()
1999 xfs_mount_free(mp); in xfs_fs_free()
2017 struct xfs_mount *mp; in xfs_init_fs_context() local
2019 mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL | __GFP_NOFAIL); in xfs_init_fs_context()
2020 if (!mp) in xfs_init_fs_context()
2023 spin_lock_init(&mp->m_sb_lock); in xfs_init_fs_context()
2024 xa_init(&mp->m_perags); in xfs_init_fs_context()
2025 mutex_init(&mp->m_growlock); in xfs_init_fs_context()
2026 INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); in xfs_init_fs_context()
2027 INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); in xfs_init_fs_context()
2028 mp->m_kobj.kobject.kset = xfs_kset; in xfs_init_fs_context()
2035 mp->m_finobt_nores = true; in xfs_init_fs_context()
2040 mp->m_logbufs = -1; in xfs_init_fs_context()
2041 mp->m_logbsize = -1; in xfs_init_fs_context()
2042 mp->m_allocsize_log = 16; /* 64k */ in xfs_init_fs_context()
2044 xfs_hooks_init(&mp->m_dir_update_hooks); in xfs_init_fs_context()
2046 fc->s_fs_info = mp; in xfs_init_fs_context()