Lines Matching refs:mp
57 static inline void xfs_mount_list_add(struct xfs_mount *mp) in xfs_mount_list_add() argument
60 list_add(&mp->m_mount_list, &xfs_mount_list); in xfs_mount_list_add()
64 static inline void xfs_mount_list_del(struct xfs_mount *mp) in xfs_mount_list_del() argument
67 list_del(&mp->m_mount_list); in xfs_mount_list_del()
71 static inline void xfs_mount_list_add(struct xfs_mount *mp) {} in xfs_mount_list_add() argument
72 static inline void xfs_mount_list_del(struct xfs_mount *mp) {} in xfs_mount_list_del() argument
83 struct xfs_mount *mp, in xfs_mount_set_dax_mode() argument
88 mp->m_features &= ~(XFS_FEAT_DAX_ALWAYS | XFS_FEAT_DAX_NEVER); in xfs_mount_set_dax_mode()
91 mp->m_features |= XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
92 mp->m_features &= ~XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
95 mp->m_features |= XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
96 mp->m_features &= ~XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
195 struct xfs_mount *mp = XFS_M(root->d_sb); in xfs_fs_show_options() local
199 if (mp->m_features & xfs_infop->flag) in xfs_fs_show_options()
203 seq_printf(m, ",inode%d", xfs_has_small_inums(mp) ? 32 : 64); in xfs_fs_show_options()
205 if (xfs_has_allocsize(mp)) in xfs_fs_show_options()
207 (1 << mp->m_allocsize_log) >> 10); in xfs_fs_show_options()
209 if (mp->m_logbufs > 0) in xfs_fs_show_options()
210 seq_printf(m, ",logbufs=%d", mp->m_logbufs); in xfs_fs_show_options()
211 if (mp->m_logbsize > 0) in xfs_fs_show_options()
212 seq_printf(m, ",logbsize=%dk", mp->m_logbsize >> 10); in xfs_fs_show_options()
214 if (mp->m_logname) in xfs_fs_show_options()
215 seq_show_option(m, "logdev", mp->m_logname); in xfs_fs_show_options()
216 if (mp->m_rtname) in xfs_fs_show_options()
217 seq_show_option(m, "rtdev", mp->m_rtname); in xfs_fs_show_options()
219 if (mp->m_dalign > 0) in xfs_fs_show_options()
221 (int)XFS_FSB_TO_BB(mp, mp->m_dalign)); in xfs_fs_show_options()
222 if (mp->m_swidth > 0) in xfs_fs_show_options()
224 (int)XFS_FSB_TO_BB(mp, mp->m_swidth)); in xfs_fs_show_options()
226 if (mp->m_qflags & XFS_UQUOTA_ENFD) in xfs_fs_show_options()
228 else if (mp->m_qflags & XFS_UQUOTA_ACCT) in xfs_fs_show_options()
231 if (mp->m_qflags & XFS_PQUOTA_ENFD) in xfs_fs_show_options()
233 else if (mp->m_qflags & XFS_PQUOTA_ACCT) in xfs_fs_show_options()
236 if (mp->m_qflags & XFS_GQUOTA_ENFD) in xfs_fs_show_options()
238 else if (mp->m_qflags & XFS_GQUOTA_ACCT) in xfs_fs_show_options()
241 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) in xfs_fs_show_options()
264 struct xfs_mount *mp, in xfs_set_inode_alloc() argument
269 xfs_sb_t *sbp = &mp->m_sb; in xfs_set_inode_alloc()
278 if (M_IGEO(mp)->maxicount) { in xfs_set_inode_alloc()
291 agino = XFS_AGB_TO_AGINO(mp, sbp->sb_agblocks - 1); in xfs_set_inode_alloc()
292 ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino); in xfs_set_inode_alloc()
299 if (xfs_has_small_inums(mp) && ino > XFS_MAXINUMBER_32) in xfs_set_inode_alloc()
300 set_bit(XFS_OPSTATE_INODE32, &mp->m_opstate); in xfs_set_inode_alloc()
302 clear_bit(XFS_OPSTATE_INODE32, &mp->m_opstate); in xfs_set_inode_alloc()
307 ino = XFS_AGINO_TO_INO(mp, index, agino); in xfs_set_inode_alloc()
309 pag = xfs_perag_get(mp, index); in xfs_set_inode_alloc()
311 if (xfs_is_inode32(mp)) { in xfs_set_inode_alloc()
331 return xfs_is_inode32(mp) ? maxagi : agcount; in xfs_set_inode_alloc()
345 xfs_mount_t *mp, in xfs_blkdev_get() argument
352 mp); in xfs_blkdev_get()
355 xfs_warn(mp, "Invalid device [%s], error=%d", name, error); in xfs_blkdev_get()
371 struct xfs_mount *mp) in xfs_close_devices() argument
373 struct dax_device *dax_ddev = mp->m_ddev_targp->bt_daxdev; in xfs_close_devices()
375 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_close_devices()
376 struct block_device *logdev = mp->m_logdev_targp->bt_bdev; in xfs_close_devices()
377 struct dax_device *dax_logdev = mp->m_logdev_targp->bt_daxdev; in xfs_close_devices()
379 xfs_free_buftarg(mp->m_logdev_targp); in xfs_close_devices()
383 if (mp->m_rtdev_targp) { in xfs_close_devices()
384 struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev; in xfs_close_devices()
385 struct dax_device *dax_rtdev = mp->m_rtdev_targp->bt_daxdev; in xfs_close_devices()
387 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_close_devices()
391 xfs_free_buftarg(mp->m_ddev_targp); in xfs_close_devices()
407 struct xfs_mount *mp) in xfs_open_devices() argument
409 struct block_device *ddev = mp->m_super->s_bdev; in xfs_open_devices()
418 if (mp->m_logname) { in xfs_open_devices()
419 error = xfs_blkdev_get(mp, mp->m_logname, &logdev); in xfs_open_devices()
425 if (mp->m_rtname) { in xfs_open_devices()
426 error = xfs_blkdev_get(mp, mp->m_rtname, &rtdev); in xfs_open_devices()
431 xfs_warn(mp, in xfs_open_devices()
443 mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev, dax_ddev); in xfs_open_devices()
444 if (!mp->m_ddev_targp) in xfs_open_devices()
448 mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev, dax_rtdev); in xfs_open_devices()
449 if (!mp->m_rtdev_targp) in xfs_open_devices()
454 mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev, dax_logdev); in xfs_open_devices()
455 if (!mp->m_logdev_targp) in xfs_open_devices()
458 mp->m_logdev_targp = mp->m_ddev_targp; in xfs_open_devices()
464 if (mp->m_rtdev_targp) in xfs_open_devices()
465 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_open_devices()
467 xfs_free_buftarg(mp->m_ddev_targp); in xfs_open_devices()
486 struct xfs_mount *mp) in xfs_setup_devices() argument
490 error = xfs_setsize_buftarg(mp->m_ddev_targp, mp->m_sb.sb_sectsize); in xfs_setup_devices()
494 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_setup_devices()
497 if (xfs_has_sector(mp)) in xfs_setup_devices()
498 log_sector_size = mp->m_sb.sb_logsectsize; in xfs_setup_devices()
499 error = xfs_setsize_buftarg(mp->m_logdev_targp, in xfs_setup_devices()
504 if (mp->m_rtdev_targp) { in xfs_setup_devices()
505 error = xfs_setsize_buftarg(mp->m_rtdev_targp, in xfs_setup_devices()
506 mp->m_sb.sb_sectsize); in xfs_setup_devices()
516 struct xfs_mount *mp) in xfs_init_mount_workqueues() argument
518 mp->m_buf_workqueue = alloc_workqueue("xfs-buf/%s", in xfs_init_mount_workqueues()
520 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
521 if (!mp->m_buf_workqueue) in xfs_init_mount_workqueues()
524 mp->m_unwritten_workqueue = alloc_workqueue("xfs-conv/%s", in xfs_init_mount_workqueues()
526 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
527 if (!mp->m_unwritten_workqueue) in xfs_init_mount_workqueues()
530 mp->m_reclaim_workqueue = alloc_workqueue("xfs-reclaim/%s", in xfs_init_mount_workqueues()
532 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
533 if (!mp->m_reclaim_workqueue) in xfs_init_mount_workqueues()
536 mp->m_blockgc_wq = alloc_workqueue("xfs-blockgc/%s", in xfs_init_mount_workqueues()
538 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
539 if (!mp->m_blockgc_wq) in xfs_init_mount_workqueues()
542 mp->m_inodegc_wq = alloc_workqueue("xfs-inodegc/%s", in xfs_init_mount_workqueues()
544 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
545 if (!mp->m_inodegc_wq) in xfs_init_mount_workqueues()
548 mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s", in xfs_init_mount_workqueues()
549 XFS_WQFLAGS(WQ_FREEZABLE), 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
550 if (!mp->m_sync_workqueue) in xfs_init_mount_workqueues()
556 destroy_workqueue(mp->m_inodegc_wq); in xfs_init_mount_workqueues()
558 destroy_workqueue(mp->m_blockgc_wq); in xfs_init_mount_workqueues()
560 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_init_mount_workqueues()
562 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_init_mount_workqueues()
564 destroy_workqueue(mp->m_buf_workqueue); in xfs_init_mount_workqueues()
571 struct xfs_mount *mp) in xfs_destroy_mount_workqueues() argument
573 destroy_workqueue(mp->m_sync_workqueue); in xfs_destroy_mount_workqueues()
574 destroy_workqueue(mp->m_blockgc_wq); in xfs_destroy_mount_workqueues()
575 destroy_workqueue(mp->m_inodegc_wq); in xfs_destroy_mount_workqueues()
576 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_destroy_mount_workqueues()
577 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_destroy_mount_workqueues()
578 destroy_workqueue(mp->m_buf_workqueue); in xfs_destroy_mount_workqueues()
585 struct xfs_mount *mp = container_of(work, struct xfs_mount, in xfs_flush_inodes_worker() local
587 struct super_block *sb = mp->m_super; in xfs_flush_inodes_worker()
603 struct xfs_mount *mp) in xfs_flush_inodes() argument
609 if (flush_work(&mp->m_flush_inodes_work)) in xfs_flush_inodes()
612 queue_work(mp->m_sync_workqueue, &mp->m_flush_inodes_work); in xfs_flush_inodes()
613 flush_work(&mp->m_flush_inodes_work); in xfs_flush_inodes()
649 struct xfs_mount *mp = ip->i_mount; in xfs_fs_dirty_inode() local
657 if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) in xfs_fs_dirty_inode()
720 struct xfs_mount *mp) in xfs_mount_free() argument
722 kfree(mp->m_rtname); in xfs_mount_free()
723 kfree(mp->m_logname); in xfs_mount_free()
724 kmem_free(mp); in xfs_mount_free()
732 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_sync_fs() local
734 trace_xfs_fs_sync_fs(mp, __return_address); in xfs_fs_sync_fs()
742 xfs_log_force(mp, XFS_LOG_SYNC); in xfs_fs_sync_fs()
749 flush_delayed_work(&mp->m_log->l_work); in xfs_fs_sync_fs()
767 xfs_inodegc_stop(mp); in xfs_fs_sync_fs()
768 xfs_blockgc_stop(mp); in xfs_fs_sync_fs()
779 struct xfs_mount *mp = XFS_M(dentry->d_sb); in xfs_fs_statfs() local
780 xfs_sb_t *sbp = &mp->m_sb; in xfs_fs_statfs()
790 xfs_inodegc_flush(mp); in xfs_fs_statfs()
795 id = huge_encode_dev(mp->m_ddev_targp->bt_dev); in xfs_fs_statfs()
798 icount = percpu_counter_sum(&mp->m_icount); in xfs_fs_statfs()
799 ifree = percpu_counter_sum(&mp->m_ifree); in xfs_fs_statfs()
800 fdblocks = percpu_counter_sum(&mp->m_fdblocks); in xfs_fs_statfs()
802 spin_lock(&mp->m_sb_lock); in xfs_fs_statfs()
806 spin_unlock(&mp->m_sb_lock); in xfs_fs_statfs()
809 statp->f_bfree = max_t(int64_t, fdblocks - mp->m_alloc_set_aside, 0); in xfs_fs_statfs()
812 fakeinos = XFS_FSB_TO_INO(mp, statp->f_bfree); in xfs_fs_statfs()
814 if (M_IGEO(mp)->maxicount) in xfs_fs_statfs()
817 M_IGEO(mp)->maxicount); in xfs_fs_statfs()
830 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
834 if (XFS_IS_REALTIME_MOUNT(mp) && in xfs_fs_statfs()
845 xfs_save_resvblks(struct xfs_mount *mp) in xfs_save_resvblks() argument
849 mp->m_resblks_save = mp->m_resblks; in xfs_save_resvblks()
850 xfs_reserve_blocks(mp, &resblks, NULL); in xfs_save_resvblks()
854 xfs_restore_resvblks(struct xfs_mount *mp) in xfs_restore_resvblks() argument
858 if (mp->m_resblks_save) { in xfs_restore_resvblks()
859 resblks = mp->m_resblks_save; in xfs_restore_resvblks()
860 mp->m_resblks_save = 0; in xfs_restore_resvblks()
862 resblks = xfs_default_resblks(mp); in xfs_restore_resvblks()
864 xfs_reserve_blocks(mp, &resblks, NULL); in xfs_restore_resvblks()
877 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_freeze() local
887 xfs_save_resvblks(mp); in xfs_fs_freeze()
888 ret = xfs_log_quiesce(mp); in xfs_fs_freeze()
898 if (ret && !xfs_is_readonly(mp)) { in xfs_fs_freeze()
899 xfs_blockgc_start(mp); in xfs_fs_freeze()
900 xfs_inodegc_start(mp); in xfs_fs_freeze()
910 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_unfreeze() local
912 xfs_restore_resvblks(mp); in xfs_fs_unfreeze()
913 xfs_log_work_queue(mp); in xfs_fs_unfreeze()
921 if (!xfs_is_readonly(mp)) { in xfs_fs_unfreeze()
922 xfs_blockgc_start(mp); in xfs_fs_unfreeze()
923 xfs_inodegc_start(mp); in xfs_fs_unfreeze()
935 struct xfs_mount *mp) in xfs_finish_flags() argument
938 if (xfs_has_logv2(mp)) { in xfs_finish_flags()
939 if (mp->m_logbsize <= 0 && in xfs_finish_flags()
940 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
941 mp->m_logbsize = mp->m_sb.sb_logsunit; in xfs_finish_flags()
942 } else if (mp->m_logbsize > 0 && in xfs_finish_flags()
943 mp->m_logbsize < mp->m_sb.sb_logsunit) { in xfs_finish_flags()
944 xfs_warn(mp, in xfs_finish_flags()
950 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
951 xfs_warn(mp, in xfs_finish_flags()
960 if (xfs_has_crc(mp) && xfs_has_noattr2(mp)) { in xfs_finish_flags()
961 xfs_warn(mp, "Cannot mount a V5 filesystem as noattr2. " in xfs_finish_flags()
969 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
970 xfs_warn(mp, in xfs_finish_flags()
975 if ((mp->m_qflags & XFS_GQUOTA_ACCT) && in xfs_finish_flags()
976 (mp->m_qflags & XFS_PQUOTA_ACCT) && in xfs_finish_flags()
977 !xfs_has_pquotino(mp)) { in xfs_finish_flags()
978 xfs_warn(mp, in xfs_finish_flags()
988 struct xfs_mount *mp) in xfs_init_percpu_counters() argument
992 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
996 error = percpu_counter_init(&mp->m_ifree, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1000 error = percpu_counter_init(&mp->m_fdblocks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1004 error = percpu_counter_init(&mp->m_delalloc_blks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1011 percpu_counter_destroy(&mp->m_fdblocks); in xfs_init_percpu_counters()
1013 percpu_counter_destroy(&mp->m_ifree); in xfs_init_percpu_counters()
1015 percpu_counter_destroy(&mp->m_icount); in xfs_init_percpu_counters()
1021 struct xfs_mount *mp) in xfs_reinit_percpu_counters() argument
1023 percpu_counter_set(&mp->m_icount, mp->m_sb.sb_icount); in xfs_reinit_percpu_counters()
1024 percpu_counter_set(&mp->m_ifree, mp->m_sb.sb_ifree); in xfs_reinit_percpu_counters()
1025 percpu_counter_set(&mp->m_fdblocks, mp->m_sb.sb_fdblocks); in xfs_reinit_percpu_counters()
1030 struct xfs_mount *mp) in xfs_destroy_percpu_counters() argument
1032 percpu_counter_destroy(&mp->m_icount); in xfs_destroy_percpu_counters()
1033 percpu_counter_destroy(&mp->m_ifree); in xfs_destroy_percpu_counters()
1034 percpu_counter_destroy(&mp->m_fdblocks); in xfs_destroy_percpu_counters()
1035 ASSERT(xfs_is_shutdown(mp) || in xfs_destroy_percpu_counters()
1036 percpu_counter_sum(&mp->m_delalloc_blks) == 0); in xfs_destroy_percpu_counters()
1037 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_destroy_percpu_counters()
1042 struct xfs_mount *mp) in xfs_inodegc_init_percpu() argument
1047 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1048 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1052 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1062 struct xfs_mount *mp) in xfs_inodegc_free_percpu() argument
1064 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1066 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1073 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_put_super() local
1079 xfs_notice(mp, "Unmounting Filesystem"); in xfs_fs_put_super()
1080 xfs_filestream_unmount(mp); in xfs_fs_put_super()
1081 xfs_unmountfs(mp); in xfs_fs_put_super()
1083 xfs_freesb(mp); in xfs_fs_put_super()
1084 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1085 xfs_mount_list_del(mp); in xfs_fs_put_super()
1086 xfs_inodegc_free_percpu(mp); in xfs_fs_put_super()
1087 xfs_destroy_percpu_counters(mp); in xfs_fs_put_super()
1088 xfs_destroy_mount_workqueues(mp); in xfs_fs_put_super()
1089 xfs_close_devices(mp); in xfs_fs_put_super()
1092 xfs_mount_free(mp); in xfs_fs_put_super()
1340 struct xfs_mount *mp) in xfs_fs_validate_params() argument
1343 if (xfs_has_norecovery(mp) && !xfs_is_readonly(mp)) { in xfs_fs_validate_params()
1344 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1352 if (xfs_has_attr2(mp) && xfs_has_noattr2(mp)) { in xfs_fs_validate_params()
1353 xfs_warn(mp, "attr2 and noattr2 cannot both be specified."); in xfs_fs_validate_params()
1358 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1359 xfs_warn(mp, in xfs_fs_validate_params()
1364 if (!IS_ENABLED(CONFIG_XFS_QUOTA) && mp->m_qflags != 0) { in xfs_fs_validate_params()
1365 xfs_warn(mp, "quota support not available in this kernel."); in xfs_fs_validate_params()
1369 if ((mp->m_dalign && !mp->m_swidth) || in xfs_fs_validate_params()
1370 (!mp->m_dalign && mp->m_swidth)) { in xfs_fs_validate_params()
1371 xfs_warn(mp, "sunit and swidth must be specified together"); in xfs_fs_validate_params()
1375 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1376 xfs_warn(mp, in xfs_fs_validate_params()
1378 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1382 if (mp->m_logbufs != -1 && in xfs_fs_validate_params()
1383 mp->m_logbufs != 0 && in xfs_fs_validate_params()
1384 (mp->m_logbufs < XLOG_MIN_ICLOGS || in xfs_fs_validate_params()
1385 mp->m_logbufs > XLOG_MAX_ICLOGS)) { in xfs_fs_validate_params()
1386 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", in xfs_fs_validate_params()
1387 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); in xfs_fs_validate_params()
1391 if (mp->m_logbsize != -1 && in xfs_fs_validate_params()
1392 mp->m_logbsize != 0 && in xfs_fs_validate_params()
1393 (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE || in xfs_fs_validate_params()
1394 mp->m_logbsize > XLOG_MAX_RECORD_BSIZE || in xfs_fs_validate_params()
1395 !is_power_of_2(mp->m_logbsize))) { in xfs_fs_validate_params()
1396 xfs_warn(mp, in xfs_fs_validate_params()
1398 mp->m_logbsize); in xfs_fs_validate_params()
1402 if (xfs_has_allocsize(mp) && in xfs_fs_validate_params()
1403 (mp->m_allocsize_log > XFS_MAX_IO_LOG || in xfs_fs_validate_params()
1404 mp->m_allocsize_log < XFS_MIN_IO_LOG)) { in xfs_fs_validate_params()
1405 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", in xfs_fs_validate_params()
1406 mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG); in xfs_fs_validate_params()
1418 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super() local
1422 mp->m_super = sb; in xfs_fs_fill_super()
1424 error = xfs_fs_validate_params(mp); in xfs_fs_fill_super()
1443 xfs_notice(mp, "Delaying mount for %d seconds.", in xfs_fs_fill_super()
1451 error = xfs_open_devices(mp); in xfs_fs_fill_super()
1455 error = xfs_init_mount_workqueues(mp); in xfs_fs_fill_super()
1459 error = xfs_init_percpu_counters(mp); in xfs_fs_fill_super()
1463 error = xfs_inodegc_init_percpu(mp); in xfs_fs_fill_super()
1472 xfs_mount_list_add(mp); in xfs_fs_fill_super()
1475 mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); in xfs_fs_fill_super()
1476 if (!mp->m_stats.xs_stats) { in xfs_fs_fill_super()
1481 error = xfs_readsb(mp, flags); in xfs_fs_fill_super()
1485 error = xfs_finish_flags(mp); in xfs_fs_fill_super()
1489 error = xfs_setup_devices(mp); in xfs_fs_fill_super()
1494 if (!xfs_has_crc(mp)) { in xfs_fs_fill_super()
1496 xfs_warn_once(mp, in xfs_fs_fill_super()
1499 xfs_warn(mp, in xfs_fs_fill_super()
1507 if (xfs_has_needsrepair(mp)) { in xfs_fs_fill_super()
1508 xfs_warn(mp, "Filesystem needs repair. Please run xfs_repair."); in xfs_fs_fill_super()
1518 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1519 xfs_warn(mp, "Offline file system operation in progress!"); in xfs_fs_fill_super()
1527 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1528 xfs_warn(mp, in xfs_fs_fill_super()
1531 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1537 if (xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_dblocks) || in xfs_fs_fill_super()
1538 xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_rblocks)) { in xfs_fs_fill_super()
1539 xfs_warn(mp, in xfs_fs_fill_super()
1556 if (!xfs_verify_fileoff(mp, XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE))) { in xfs_fs_fill_super()
1557 xfs_warn(mp, in xfs_fs_fill_super()
1559 XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE), in xfs_fs_fill_super()
1565 error = xfs_filestream_mount(mp); in xfs_fs_fill_super()
1574 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1579 if (xfs_has_bigtime(mp)) { in xfs_fs_fill_super()
1586 trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max); in xfs_fs_fill_super()
1592 if (xfs_has_crc(mp)) in xfs_fs_fill_super()
1595 if (xfs_has_dax_always(mp)) { in xfs_fs_fill_super()
1598 xfs_warn(mp, in xfs_fs_fill_super()
1601 datadev_is_dax = xfs_buftarg_is_dax(sb, mp->m_ddev_targp); in xfs_fs_fill_super()
1602 if (mp->m_rtdev_targp) in xfs_fs_fill_super()
1604 mp->m_rtdev_targp); in xfs_fs_fill_super()
1606 xfs_alert(mp, in xfs_fs_fill_super()
1608 xfs_mount_set_dax_mode(mp, XFS_DAX_NEVER); in xfs_fs_fill_super()
1610 if (xfs_has_reflink(mp)) { in xfs_fs_fill_super()
1611 xfs_alert(mp, in xfs_fs_fill_super()
1618 if (xfs_has_discard(mp)) { in xfs_fs_fill_super()
1622 xfs_warn(mp, "mounting with \"discard\" option, but " in xfs_fs_fill_super()
1624 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1628 if (xfs_has_reflink(mp)) { in xfs_fs_fill_super()
1629 if (mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1630 xfs_alert(mp, in xfs_fs_fill_super()
1637 xfs_info(mp, "using DEBUG-only always_cow mode."); in xfs_fs_fill_super()
1638 mp->m_always_cow = true; in xfs_fs_fill_super()
1642 if (xfs_has_rmapbt(mp) && mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1643 xfs_alert(mp, in xfs_fs_fill_super()
1649 error = xfs_mountfs(mp); in xfs_fs_fill_super()
1653 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1667 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1669 xfs_freesb(mp); in xfs_fs_fill_super()
1671 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1673 xfs_mount_list_del(mp); in xfs_fs_fill_super()
1674 xfs_inodegc_free_percpu(mp); in xfs_fs_fill_super()
1676 xfs_destroy_percpu_counters(mp); in xfs_fs_fill_super()
1678 xfs_destroy_mount_workqueues(mp); in xfs_fs_fill_super()
1680 xfs_close_devices(mp); in xfs_fs_fill_super()
1683 xfs_mount_free(mp); in xfs_fs_fill_super()
1687 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1688 xfs_unmountfs(mp); in xfs_fs_fill_super()
1701 struct xfs_mount *mp) in xfs_remount_rw() argument
1703 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
1706 if (xfs_has_norecovery(mp)) { in xfs_remount_rw()
1707 xfs_warn(mp, in xfs_remount_rw()
1714 xfs_warn(mp, in xfs_remount_rw()
1721 clear_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_remount_rw()
1727 if (mp->m_update_sb) { in xfs_remount_rw()
1728 error = xfs_sync_sb(mp, false); in xfs_remount_rw()
1730 xfs_warn(mp, "failed to write sb changes"); in xfs_remount_rw()
1733 mp->m_update_sb = false; in xfs_remount_rw()
1740 xfs_restore_resvblks(mp); in xfs_remount_rw()
1741 xfs_log_work_queue(mp); in xfs_remount_rw()
1744 error = xfs_reflink_recover_cow(mp); in xfs_remount_rw()
1746 xfs_err(mp, in xfs_remount_rw()
1748 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_remount_rw()
1751 xfs_blockgc_start(mp); in xfs_remount_rw()
1754 error = xfs_fs_reserve_ag_blocks(mp); in xfs_remount_rw()
1759 xfs_inodegc_start(mp); in xfs_remount_rw()
1766 struct xfs_mount *mp) in xfs_remount_ro() argument
1777 xfs_blockgc_stop(mp); in xfs_remount_ro()
1785 error = xfs_blockgc_free_space(mp, &icw); in xfs_remount_ro()
1787 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_remount_ro()
1798 xfs_inodegc_stop(mp); in xfs_remount_ro()
1801 error = xfs_fs_unreserve_ag_blocks(mp); in xfs_remount_ro()
1803 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_remount_ro()
1814 xfs_save_resvblks(mp); in xfs_remount_ro()
1816 xfs_log_clean(mp); in xfs_remount_ro()
1817 set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_remount_ro()
1838 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure() local
1844 if (xfs_has_crc(mp)) in xfs_fs_reconfigure()
1851 sync_filesystem(mp->m_super); in xfs_fs_reconfigure()
1854 if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
1855 mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1856 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1860 if (!xfs_has_small_inums(mp) && xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
1861 mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1862 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1866 if (xfs_is_readonly(mp) && !(flags & SB_RDONLY)) { in xfs_fs_reconfigure()
1867 error = xfs_remount_rw(mp); in xfs_fs_reconfigure()
1873 if (!xfs_is_readonly(mp) && (flags & SB_RDONLY)) { in xfs_fs_reconfigure()
1874 error = xfs_remount_ro(mp); in xfs_fs_reconfigure()
1885 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free() local
1893 if (mp) in xfs_fs_free()
1894 xfs_mount_free(mp); in xfs_fs_free()
1907 struct xfs_mount *mp; in xfs_init_fs_context() local
1909 mp = kmem_alloc(sizeof(struct xfs_mount), KM_ZERO); in xfs_init_fs_context()
1910 if (!mp) in xfs_init_fs_context()
1913 spin_lock_init(&mp->m_sb_lock); in xfs_init_fs_context()
1914 spin_lock_init(&mp->m_agirotor_lock); in xfs_init_fs_context()
1915 INIT_RADIX_TREE(&mp->m_perag_tree, GFP_ATOMIC); in xfs_init_fs_context()
1916 spin_lock_init(&mp->m_perag_lock); in xfs_init_fs_context()
1917 mutex_init(&mp->m_growlock); in xfs_init_fs_context()
1918 INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); in xfs_init_fs_context()
1919 INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); in xfs_init_fs_context()
1920 mp->m_kobj.kobject.kset = xfs_kset; in xfs_init_fs_context()
1927 mp->m_finobt_nores = true; in xfs_init_fs_context()
1932 mp->m_logbufs = -1; in xfs_init_fs_context()
1933 mp->m_logbsize = -1; in xfs_init_fs_context()
1934 mp->m_allocsize_log = 16; /* 64k */ in xfs_init_fs_context()
1940 set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_init_fs_context()
1942 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_init_fs_context()
1944 mp->m_features |= XFS_FEAT_WSYNC; in xfs_init_fs_context()
1946 fc->s_fs_info = mp; in xfs_init_fs_context()
2190 struct xfs_mount *mp, *n; in xfs_cpu_dead() local
2193 list_for_each_entry_safe(mp, n, &xfs_mount_list, m_mount_list) { in xfs_cpu_dead()
2195 xfs_inodegc_cpu_dead(mp, cpu); in xfs_cpu_dead()