Lines Matching full:mp
60 static inline void xfs_mount_list_add(struct xfs_mount *mp) in xfs_mount_list_add() argument
63 list_add(&mp->m_mount_list, &xfs_mount_list); in xfs_mount_list_add()
67 static inline void xfs_mount_list_del(struct xfs_mount *mp) in xfs_mount_list_del() argument
70 list_del(&mp->m_mount_list); in xfs_mount_list_del()
74 static inline void xfs_mount_list_add(struct xfs_mount *mp) {} in xfs_mount_list_add() argument
75 static inline void xfs_mount_list_del(struct xfs_mount *mp) {} in xfs_mount_list_del() argument
86 struct xfs_mount *mp, in xfs_mount_set_dax_mode() argument
91 mp->m_features &= ~(XFS_FEAT_DAX_ALWAYS | XFS_FEAT_DAX_NEVER); in xfs_mount_set_dax_mode()
94 mp->m_features |= XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
95 mp->m_features &= ~XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
98 mp->m_features |= XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
99 mp->m_features &= ~XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
198 struct xfs_mount *mp = XFS_M(root->d_sb); in xfs_fs_show_options() local
202 if (mp->m_features & xfs_infop->flag) in xfs_fs_show_options()
206 seq_printf(m, ",inode%d", xfs_has_small_inums(mp) ? 32 : 64); in xfs_fs_show_options()
208 if (xfs_has_allocsize(mp)) in xfs_fs_show_options()
210 (1 << mp->m_allocsize_log) >> 10); in xfs_fs_show_options()
212 if (mp->m_logbufs > 0) in xfs_fs_show_options()
213 seq_printf(m, ",logbufs=%d", mp->m_logbufs); in xfs_fs_show_options()
214 if (mp->m_logbsize > 0) in xfs_fs_show_options()
215 seq_printf(m, ",logbsize=%dk", mp->m_logbsize >> 10); in xfs_fs_show_options()
217 if (mp->m_logname) in xfs_fs_show_options()
218 seq_show_option(m, "logdev", mp->m_logname); in xfs_fs_show_options()
219 if (mp->m_rtname) in xfs_fs_show_options()
220 seq_show_option(m, "rtdev", mp->m_rtname); in xfs_fs_show_options()
222 if (mp->m_dalign > 0) in xfs_fs_show_options()
224 (int)XFS_FSB_TO_BB(mp, mp->m_dalign)); in xfs_fs_show_options()
225 if (mp->m_swidth > 0) in xfs_fs_show_options()
227 (int)XFS_FSB_TO_BB(mp, mp->m_swidth)); in xfs_fs_show_options()
229 if (mp->m_qflags & XFS_UQUOTA_ENFD) in xfs_fs_show_options()
231 else if (mp->m_qflags & XFS_UQUOTA_ACCT) in xfs_fs_show_options()
234 if (mp->m_qflags & XFS_PQUOTA_ENFD) in xfs_fs_show_options()
236 else if (mp->m_qflags & XFS_PQUOTA_ACCT) in xfs_fs_show_options()
239 if (mp->m_qflags & XFS_GQUOTA_ENFD) in xfs_fs_show_options()
241 else if (mp->m_qflags & XFS_GQUOTA_ACCT) in xfs_fs_show_options()
244 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) in xfs_fs_show_options()
260 * because in the growfs case, mp->m_sb.sb_agcount is not yet updated
267 struct xfs_mount *mp, in xfs_set_inode_alloc() argument
272 xfs_sb_t *sbp = &mp->m_sb; in xfs_set_inode_alloc()
281 if (M_IGEO(mp)->maxicount) { in xfs_set_inode_alloc()
294 agino = XFS_AGB_TO_AGINO(mp, sbp->sb_agblocks - 1); in xfs_set_inode_alloc()
295 ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino); in xfs_set_inode_alloc()
302 if (xfs_has_small_inums(mp) && ino > XFS_MAXINUMBER_32) in xfs_set_inode_alloc()
303 set_bit(XFS_OPSTATE_INODE32, &mp->m_opstate); in xfs_set_inode_alloc()
305 clear_bit(XFS_OPSTATE_INODE32, &mp->m_opstate); in xfs_set_inode_alloc()
310 ino = XFS_AGINO_TO_INO(mp, index, agino); in xfs_set_inode_alloc()
312 pag = xfs_perag_get(mp, index); in xfs_set_inode_alloc()
314 if (xfs_is_inode32(mp)) { in xfs_set_inode_alloc()
334 return xfs_is_inode32(mp) ? maxagi : agcount; in xfs_set_inode_alloc()
339 struct xfs_mount *mp) in xfs_setup_dax_always() argument
341 if (!mp->m_ddev_targp->bt_daxdev && in xfs_setup_dax_always()
342 (!mp->m_rtdev_targp || !mp->m_rtdev_targp->bt_daxdev)) { in xfs_setup_dax_always()
343 xfs_alert(mp, in xfs_setup_dax_always()
348 if (mp->m_super->s_blocksize != PAGE_SIZE) { in xfs_setup_dax_always()
349 xfs_alert(mp, in xfs_setup_dax_always()
354 if (xfs_has_reflink(mp) && in xfs_setup_dax_always()
355 bdev_is_partition(mp->m_ddev_targp->bt_bdev)) { in xfs_setup_dax_always()
356 xfs_alert(mp, in xfs_setup_dax_always()
361 xfs_warn(mp, "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); in xfs_setup_dax_always()
365 xfs_mount_set_dax_mode(mp, XFS_DAX_NEVER); in xfs_setup_dax_always()
371 xfs_mount_t *mp, in xfs_blkdev_get() argument
378 mp); in xfs_blkdev_get()
381 xfs_warn(mp, "Invalid device [%s], error=%d", name, error); in xfs_blkdev_get()
397 struct xfs_mount *mp) in xfs_close_devices() argument
399 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_close_devices()
400 struct block_device *logdev = mp->m_logdev_targp->bt_bdev; in xfs_close_devices()
402 xfs_free_buftarg(mp->m_logdev_targp); in xfs_close_devices()
405 if (mp->m_rtdev_targp) { in xfs_close_devices()
406 struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev; in xfs_close_devices()
408 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_close_devices()
411 xfs_free_buftarg(mp->m_ddev_targp); in xfs_close_devices()
426 struct xfs_mount *mp) in xfs_open_devices() argument
428 struct block_device *ddev = mp->m_super->s_bdev; in xfs_open_devices()
435 if (mp->m_logname) { in xfs_open_devices()
436 error = xfs_blkdev_get(mp, mp->m_logname, &logdev); in xfs_open_devices()
441 if (mp->m_rtname) { in xfs_open_devices()
442 error = xfs_blkdev_get(mp, mp->m_rtname, &rtdev); in xfs_open_devices()
447 xfs_warn(mp, in xfs_open_devices()
458 mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev); in xfs_open_devices()
459 if (!mp->m_ddev_targp) in xfs_open_devices()
463 mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev); in xfs_open_devices()
464 if (!mp->m_rtdev_targp) in xfs_open_devices()
469 mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev); in xfs_open_devices()
470 if (!mp->m_logdev_targp) in xfs_open_devices()
473 mp->m_logdev_targp = mp->m_ddev_targp; in xfs_open_devices()
479 if (mp->m_rtdev_targp) in xfs_open_devices()
480 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_open_devices()
482 xfs_free_buftarg(mp->m_ddev_targp); in xfs_open_devices()
496 struct xfs_mount *mp) in xfs_setup_devices() argument
500 error = xfs_setsize_buftarg(mp->m_ddev_targp, mp->m_sb.sb_sectsize); in xfs_setup_devices()
504 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_setup_devices()
507 if (xfs_has_sector(mp)) in xfs_setup_devices()
508 log_sector_size = mp->m_sb.sb_logsectsize; in xfs_setup_devices()
509 error = xfs_setsize_buftarg(mp->m_logdev_targp, in xfs_setup_devices()
514 if (mp->m_rtdev_targp) { in xfs_setup_devices()
515 error = xfs_setsize_buftarg(mp->m_rtdev_targp, in xfs_setup_devices()
516 mp->m_sb.sb_sectsize); in xfs_setup_devices()
526 struct xfs_mount *mp) in xfs_init_mount_workqueues() argument
528 mp->m_buf_workqueue = alloc_workqueue("xfs-buf/%s", in xfs_init_mount_workqueues()
530 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
531 if (!mp->m_buf_workqueue) in xfs_init_mount_workqueues()
534 mp->m_unwritten_workqueue = alloc_workqueue("xfs-conv/%s", in xfs_init_mount_workqueues()
536 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
537 if (!mp->m_unwritten_workqueue) in xfs_init_mount_workqueues()
540 mp->m_reclaim_workqueue = alloc_workqueue("xfs-reclaim/%s", in xfs_init_mount_workqueues()
542 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
543 if (!mp->m_reclaim_workqueue) in xfs_init_mount_workqueues()
546 mp->m_blockgc_wq = alloc_workqueue("xfs-blockgc/%s", in xfs_init_mount_workqueues()
548 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
549 if (!mp->m_blockgc_wq) in xfs_init_mount_workqueues()
552 mp->m_inodegc_wq = alloc_workqueue("xfs-inodegc/%s", in xfs_init_mount_workqueues()
554 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
555 if (!mp->m_inodegc_wq) in xfs_init_mount_workqueues()
558 mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s", in xfs_init_mount_workqueues()
559 XFS_WQFLAGS(WQ_FREEZABLE), 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
560 if (!mp->m_sync_workqueue) in xfs_init_mount_workqueues()
566 destroy_workqueue(mp->m_inodegc_wq); in xfs_init_mount_workqueues()
568 destroy_workqueue(mp->m_blockgc_wq); in xfs_init_mount_workqueues()
570 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_init_mount_workqueues()
572 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_init_mount_workqueues()
574 destroy_workqueue(mp->m_buf_workqueue); in xfs_init_mount_workqueues()
581 struct xfs_mount *mp) in xfs_destroy_mount_workqueues() argument
583 destroy_workqueue(mp->m_sync_workqueue); in xfs_destroy_mount_workqueues()
584 destroy_workqueue(mp->m_blockgc_wq); in xfs_destroy_mount_workqueues()
585 destroy_workqueue(mp->m_inodegc_wq); in xfs_destroy_mount_workqueues()
586 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_destroy_mount_workqueues()
587 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_destroy_mount_workqueues()
588 destroy_workqueue(mp->m_buf_workqueue); in xfs_destroy_mount_workqueues()
595 struct xfs_mount *mp = container_of(work, struct xfs_mount, in xfs_flush_inodes_worker() local
597 struct super_block *sb = mp->m_super; in xfs_flush_inodes_worker()
613 struct xfs_mount *mp) in xfs_flush_inodes() argument
619 if (flush_work(&mp->m_flush_inodes_work)) in xfs_flush_inodes()
622 queue_work(mp->m_sync_workqueue, &mp->m_flush_inodes_work); in xfs_flush_inodes()
623 flush_work(&mp->m_flush_inodes_work); in xfs_flush_inodes()
659 struct xfs_mount *mp = ip->i_mount; in xfs_fs_dirty_inode() local
673 if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) in xfs_fs_dirty_inode()
736 struct xfs_mount *mp) in xfs_mount_free() argument
738 kfree(mp->m_rtname); in xfs_mount_free()
739 kfree(mp->m_logname); in xfs_mount_free()
740 kmem_free(mp); in xfs_mount_free()
748 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_sync_fs() local
751 trace_xfs_fs_sync_fs(mp, __return_address); in xfs_fs_sync_fs()
759 error = xfs_log_force(mp, XFS_LOG_SYNC); in xfs_fs_sync_fs()
769 flush_delayed_work(&mp->m_log->l_work); in xfs_fs_sync_fs()
787 xfs_inodegc_stop(mp); in xfs_fs_sync_fs()
788 xfs_blockgc_stop(mp); in xfs_fs_sync_fs()
799 struct xfs_mount *mp = XFS_M(dentry->d_sb); in xfs_fs_statfs() local
800 xfs_sb_t *sbp = &mp->m_sb; in xfs_fs_statfs()
813 xfs_inodegc_push(mp); in xfs_fs_statfs()
818 id = huge_encode_dev(mp->m_ddev_targp->bt_dev); in xfs_fs_statfs()
821 icount = percpu_counter_sum(&mp->m_icount); in xfs_fs_statfs()
822 ifree = percpu_counter_sum(&mp->m_ifree); in xfs_fs_statfs()
823 fdblocks = percpu_counter_sum(&mp->m_fdblocks); in xfs_fs_statfs()
825 spin_lock(&mp->m_sb_lock); in xfs_fs_statfs()
829 spin_unlock(&mp->m_sb_lock); in xfs_fs_statfs()
833 fdblocks - xfs_fdblocks_unavailable(mp)); in xfs_fs_statfs()
836 fakeinos = XFS_FSB_TO_INO(mp, statp->f_bfree); in xfs_fs_statfs()
838 if (M_IGEO(mp)->maxicount) in xfs_fs_statfs()
841 M_IGEO(mp)->maxicount); in xfs_fs_statfs()
854 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
858 if (XFS_IS_REALTIME_MOUNT(mp) && in xfs_fs_statfs()
863 freertx = percpu_counter_sum_positive(&mp->m_frextents); in xfs_fs_statfs()
871 xfs_save_resvblks(struct xfs_mount *mp) in xfs_save_resvblks() argument
875 mp->m_resblks_save = mp->m_resblks; in xfs_save_resvblks()
876 xfs_reserve_blocks(mp, &resblks, NULL); in xfs_save_resvblks()
880 xfs_restore_resvblks(struct xfs_mount *mp) in xfs_restore_resvblks() argument
884 if (mp->m_resblks_save) { in xfs_restore_resvblks()
885 resblks = mp->m_resblks_save; in xfs_restore_resvblks()
886 mp->m_resblks_save = 0; in xfs_restore_resvblks()
888 resblks = xfs_default_resblks(mp); in xfs_restore_resvblks()
890 xfs_reserve_blocks(mp, &resblks, NULL); in xfs_restore_resvblks()
903 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_freeze() local
913 xfs_save_resvblks(mp); in xfs_fs_freeze()
914 ret = xfs_log_quiesce(mp); in xfs_fs_freeze()
924 if (ret && !xfs_is_readonly(mp)) { in xfs_fs_freeze()
925 xfs_blockgc_start(mp); in xfs_fs_freeze()
926 xfs_inodegc_start(mp); in xfs_fs_freeze()
936 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_unfreeze() local
938 xfs_restore_resvblks(mp); in xfs_fs_unfreeze()
939 xfs_log_work_queue(mp); in xfs_fs_unfreeze()
947 if (!xfs_is_readonly(mp)) { in xfs_fs_unfreeze()
948 xfs_blockgc_start(mp); in xfs_fs_unfreeze()
949 xfs_inodegc_start(mp); in xfs_fs_unfreeze()
961 struct xfs_mount *mp) in xfs_finish_flags() argument
964 if (xfs_has_logv2(mp)) { in xfs_finish_flags()
965 if (mp->m_logbsize <= 0 && in xfs_finish_flags()
966 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
967 mp->m_logbsize = mp->m_sb.sb_logsunit; in xfs_finish_flags()
968 } else if (mp->m_logbsize > 0 && in xfs_finish_flags()
969 mp->m_logbsize < mp->m_sb.sb_logsunit) { in xfs_finish_flags()
970 xfs_warn(mp, in xfs_finish_flags()
976 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
977 xfs_warn(mp, in xfs_finish_flags()
986 if (xfs_has_crc(mp) && xfs_has_noattr2(mp)) { in xfs_finish_flags()
987 xfs_warn(mp, "Cannot mount a V5 filesystem as noattr2. " in xfs_finish_flags()
995 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
996 xfs_warn(mp, in xfs_finish_flags()
1001 if ((mp->m_qflags & XFS_GQUOTA_ACCT) && in xfs_finish_flags()
1002 (mp->m_qflags & XFS_PQUOTA_ACCT) && in xfs_finish_flags()
1003 !xfs_has_pquotino(mp)) { in xfs_finish_flags()
1004 xfs_warn(mp, in xfs_finish_flags()
1014 struct xfs_mount *mp) in xfs_init_percpu_counters() argument
1018 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1022 error = percpu_counter_init(&mp->m_ifree, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1026 error = percpu_counter_init(&mp->m_fdblocks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1030 error = percpu_counter_init(&mp->m_delalloc_blks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1034 error = percpu_counter_init(&mp->m_frextents, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1041 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_init_percpu_counters()
1043 percpu_counter_destroy(&mp->m_fdblocks); in xfs_init_percpu_counters()
1045 percpu_counter_destroy(&mp->m_ifree); in xfs_init_percpu_counters()
1047 percpu_counter_destroy(&mp->m_icount); in xfs_init_percpu_counters()
1053 struct xfs_mount *mp) in xfs_reinit_percpu_counters() argument
1055 percpu_counter_set(&mp->m_icount, mp->m_sb.sb_icount); in xfs_reinit_percpu_counters()
1056 percpu_counter_set(&mp->m_ifree, mp->m_sb.sb_ifree); in xfs_reinit_percpu_counters()
1057 percpu_counter_set(&mp->m_fdblocks, mp->m_sb.sb_fdblocks); in xfs_reinit_percpu_counters()
1058 percpu_counter_set(&mp->m_frextents, mp->m_sb.sb_frextents); in xfs_reinit_percpu_counters()
1063 struct xfs_mount *mp) in xfs_destroy_percpu_counters() argument
1065 percpu_counter_destroy(&mp->m_icount); in xfs_destroy_percpu_counters()
1066 percpu_counter_destroy(&mp->m_ifree); in xfs_destroy_percpu_counters()
1067 percpu_counter_destroy(&mp->m_fdblocks); in xfs_destroy_percpu_counters()
1068 ASSERT(xfs_is_shutdown(mp) || in xfs_destroy_percpu_counters()
1069 percpu_counter_sum(&mp->m_delalloc_blks) == 0); in xfs_destroy_percpu_counters()
1070 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_destroy_percpu_counters()
1071 percpu_counter_destroy(&mp->m_frextents); in xfs_destroy_percpu_counters()
1076 struct xfs_mount *mp) in xfs_inodegc_init_percpu() argument
1081 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1082 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1086 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1096 struct xfs_mount *mp) in xfs_inodegc_free_percpu() argument
1098 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1100 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1107 struct xfs_mount *mp = XFS_M(sb); in xfs_fs_put_super() local
1113 xfs_notice(mp, "Unmounting Filesystem"); in xfs_fs_put_super()
1114 xfs_filestream_unmount(mp); in xfs_fs_put_super()
1115 xfs_unmountfs(mp); in xfs_fs_put_super()
1117 xfs_freesb(mp); in xfs_fs_put_super()
1118 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1119 xfs_mount_list_del(mp); in xfs_fs_put_super()
1120 xfs_inodegc_free_percpu(mp); in xfs_fs_put_super()
1121 xfs_destroy_percpu_counters(mp); in xfs_fs_put_super()
1122 xfs_destroy_mount_workqueues(mp); in xfs_fs_put_super()
1123 xfs_close_devices(mp); in xfs_fs_put_super()
1126 xfs_mount_free(mp); in xfs_fs_put_super()
1217 * NOTE: mp->m_super is NULL here!
1374 struct xfs_mount *mp) in xfs_fs_validate_params() argument
1377 if (xfs_has_norecovery(mp) && !xfs_is_readonly(mp)) { in xfs_fs_validate_params()
1378 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1386 if (xfs_has_attr2(mp) && xfs_has_noattr2(mp)) { in xfs_fs_validate_params()
1387 xfs_warn(mp, "attr2 and noattr2 cannot both be specified."); in xfs_fs_validate_params()
1392 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1393 xfs_warn(mp, in xfs_fs_validate_params()
1398 if (!IS_ENABLED(CONFIG_XFS_QUOTA) && mp->m_qflags != 0) { in xfs_fs_validate_params()
1399 xfs_warn(mp, "quota support not available in this kernel."); in xfs_fs_validate_params()
1403 if ((mp->m_dalign && !mp->m_swidth) || in xfs_fs_validate_params()
1404 (!mp->m_dalign && mp->m_swidth)) { in xfs_fs_validate_params()
1405 xfs_warn(mp, "sunit and swidth must be specified together"); in xfs_fs_validate_params()
1409 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1410 xfs_warn(mp, in xfs_fs_validate_params()
1412 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1416 if (mp->m_logbufs != -1 && in xfs_fs_validate_params()
1417 mp->m_logbufs != 0 && in xfs_fs_validate_params()
1418 (mp->m_logbufs < XLOG_MIN_ICLOGS || in xfs_fs_validate_params()
1419 mp->m_logbufs > XLOG_MAX_ICLOGS)) { in xfs_fs_validate_params()
1420 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", in xfs_fs_validate_params()
1421 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); in xfs_fs_validate_params()
1425 if (mp->m_logbsize != -1 && in xfs_fs_validate_params()
1426 mp->m_logbsize != 0 && in xfs_fs_validate_params()
1427 (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE || in xfs_fs_validate_params()
1428 mp->m_logbsize > XLOG_MAX_RECORD_BSIZE || in xfs_fs_validate_params()
1429 !is_power_of_2(mp->m_logbsize))) { in xfs_fs_validate_params()
1430 xfs_warn(mp, in xfs_fs_validate_params()
1432 mp->m_logbsize); in xfs_fs_validate_params()
1436 if (xfs_has_allocsize(mp) && in xfs_fs_validate_params()
1437 (mp->m_allocsize_log > XFS_MAX_IO_LOG || in xfs_fs_validate_params()
1438 mp->m_allocsize_log < XFS_MIN_IO_LOG)) { in xfs_fs_validate_params()
1439 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", in xfs_fs_validate_params()
1440 mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG); in xfs_fs_validate_params()
1452 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super() local
1456 mp->m_super = sb; in xfs_fs_fill_super()
1458 error = xfs_fs_validate_params(mp); in xfs_fs_fill_super()
1477 xfs_notice(mp, "Delaying mount for %d seconds.", in xfs_fs_fill_super()
1485 error = xfs_open_devices(mp); in xfs_fs_fill_super()
1489 error = xfs_init_mount_workqueues(mp); in xfs_fs_fill_super()
1493 error = xfs_init_percpu_counters(mp); in xfs_fs_fill_super()
1497 error = xfs_inodegc_init_percpu(mp); in xfs_fs_fill_super()
1503 * must be allocated before adding this @mp to the cpu-dead handler's in xfs_fs_fill_super()
1506 xfs_mount_list_add(mp); in xfs_fs_fill_super()
1509 mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); in xfs_fs_fill_super()
1510 if (!mp->m_stats.xs_stats) { in xfs_fs_fill_super()
1515 error = xfs_readsb(mp, flags); in xfs_fs_fill_super()
1519 error = xfs_finish_flags(mp); in xfs_fs_fill_super()
1523 error = xfs_setup_devices(mp); in xfs_fs_fill_super()
1528 if (!xfs_has_crc(mp)) { in xfs_fs_fill_super()
1530 xfs_warn_once(mp, in xfs_fs_fill_super()
1533 xfs_warn(mp, in xfs_fs_fill_super()
1541 if (xfs_has_needsrepair(mp)) { in xfs_fs_fill_super()
1542 xfs_warn(mp, "Filesystem needs repair. Please run xfs_repair."); in xfs_fs_fill_super()
1552 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1553 xfs_warn(mp, "Offline file system operation in progress!"); in xfs_fs_fill_super()
1561 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1562 xfs_warn(mp, in xfs_fs_fill_super()
1565 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1571 if (xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_dblocks) || in xfs_fs_fill_super()
1572 xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_rblocks)) { in xfs_fs_fill_super()
1573 xfs_warn(mp, in xfs_fs_fill_super()
1590 if (!xfs_verify_fileoff(mp, XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE))) { in xfs_fs_fill_super()
1591 xfs_warn(mp, in xfs_fs_fill_super()
1593 XFS_B_TO_FSBT(mp, MAX_LFS_FILESIZE), in xfs_fs_fill_super()
1599 error = xfs_filestream_mount(mp); in xfs_fs_fill_super()
1608 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1613 if (xfs_has_bigtime(mp)) { in xfs_fs_fill_super()
1620 trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max); in xfs_fs_fill_super()
1626 if (xfs_has_crc(mp)) in xfs_fs_fill_super()
1629 if (xfs_has_dax_always(mp)) { in xfs_fs_fill_super()
1630 error = xfs_setup_dax_always(mp); in xfs_fs_fill_super()
1635 if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { in xfs_fs_fill_super()
1636 xfs_warn(mp, in xfs_fs_fill_super()
1638 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1641 if (xfs_has_reflink(mp)) { in xfs_fs_fill_super()
1642 if (mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1643 xfs_alert(mp, in xfs_fs_fill_super()
1650 xfs_info(mp, "using DEBUG-only always_cow mode."); in xfs_fs_fill_super()
1651 mp->m_always_cow = true; in xfs_fs_fill_super()
1655 if (xfs_has_rmapbt(mp) && mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1656 xfs_alert(mp, in xfs_fs_fill_super()
1662 if (xfs_has_large_extent_counts(mp)) in xfs_fs_fill_super()
1663 xfs_warn(mp, in xfs_fs_fill_super()
1666 error = xfs_mountfs(mp); in xfs_fs_fill_super()
1670 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1684 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1686 xfs_freesb(mp); in xfs_fs_fill_super()
1688 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1690 xfs_mount_list_del(mp); in xfs_fs_fill_super()
1691 xfs_inodegc_free_percpu(mp); in xfs_fs_fill_super()
1693 xfs_destroy_percpu_counters(mp); in xfs_fs_fill_super()
1695 xfs_destroy_mount_workqueues(mp); in xfs_fs_fill_super()
1697 xfs_close_devices(mp); in xfs_fs_fill_super()
1700 xfs_mount_free(mp); in xfs_fs_fill_super()
1704 xfs_filestream_unmount(mp); in xfs_fs_fill_super()
1705 xfs_unmountfs(mp); in xfs_fs_fill_super()
1718 struct xfs_mount *mp) in xfs_remount_rw() argument
1720 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
1723 if (xfs_has_norecovery(mp)) { in xfs_remount_rw()
1724 xfs_warn(mp, in xfs_remount_rw()
1731 xfs_warn(mp, in xfs_remount_rw()
1738 clear_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_remount_rw()
1744 if (mp->m_update_sb) { in xfs_remount_rw()
1745 error = xfs_sync_sb(mp, false); in xfs_remount_rw()
1747 xfs_warn(mp, "failed to write sb changes"); in xfs_remount_rw()
1750 mp->m_update_sb = false; in xfs_remount_rw()
1757 xfs_restore_resvblks(mp); in xfs_remount_rw()
1758 xfs_log_work_queue(mp); in xfs_remount_rw()
1759 xfs_blockgc_start(mp); in xfs_remount_rw()
1762 error = xfs_fs_reserve_ag_blocks(mp); in xfs_remount_rw()
1767 xfs_inodegc_start(mp); in xfs_remount_rw()
1774 struct xfs_mount *mp) in xfs_remount_ro() argument
1782 error = sync_filesystem(mp->m_super); in xfs_remount_ro()
1790 xfs_blockgc_stop(mp); in xfs_remount_ro()
1798 error = xfs_blockgc_free_space(mp, &icw); in xfs_remount_ro()
1800 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_remount_ro()
1811 xfs_inodegc_stop(mp); in xfs_remount_ro()
1814 error = xfs_fs_unreserve_ag_blocks(mp); in xfs_remount_ro()
1816 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_remount_ro()
1827 xfs_save_resvblks(mp); in xfs_remount_ro()
1829 xfs_log_clean(mp); in xfs_remount_ro()
1830 set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_remount_ro()
1851 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure() local
1857 if (xfs_has_crc(mp)) in xfs_fs_reconfigure()
1865 if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
1866 mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1867 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1871 if (!xfs_has_small_inums(mp) && xfs_has_small_inums(new_mp)) { in xfs_fs_reconfigure()
1872 mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1873 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1877 if (xfs_is_readonly(mp) && !(flags & SB_RDONLY)) { in xfs_fs_reconfigure()
1878 error = xfs_remount_rw(mp); in xfs_fs_reconfigure()
1884 if (!xfs_is_readonly(mp) && (flags & SB_RDONLY)) { in xfs_fs_reconfigure()
1885 error = xfs_remount_ro(mp); in xfs_fs_reconfigure()
1896 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free() local
1899 * mp is stored in the fs_context when it is initialized. in xfs_fs_free()
1900 * mp is transferred to the superblock on a successful mount, in xfs_fs_free()
1904 if (mp) in xfs_fs_free()
1905 xfs_mount_free(mp); in xfs_fs_free()
1918 struct xfs_mount *mp; in xfs_init_fs_context() local
1920 mp = kmem_alloc(sizeof(struct xfs_mount), KM_ZERO); in xfs_init_fs_context()
1921 if (!mp) in xfs_init_fs_context()
1924 spin_lock_init(&mp->m_sb_lock); in xfs_init_fs_context()
1925 spin_lock_init(&mp->m_agirotor_lock); in xfs_init_fs_context()
1926 INIT_RADIX_TREE(&mp->m_perag_tree, GFP_ATOMIC); in xfs_init_fs_context()
1927 spin_lock_init(&mp->m_perag_lock); in xfs_init_fs_context()
1928 mutex_init(&mp->m_growlock); in xfs_init_fs_context()
1929 INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); in xfs_init_fs_context()
1930 INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); in xfs_init_fs_context()
1931 mp->m_kobj.kobject.kset = xfs_kset; in xfs_init_fs_context()
1938 mp->m_finobt_nores = true; in xfs_init_fs_context()
1943 mp->m_logbufs = -1; in xfs_init_fs_context()
1944 mp->m_logbsize = -1; in xfs_init_fs_context()
1945 mp->m_allocsize_log = 16; /* 64k */ in xfs_init_fs_context()
1951 set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_init_fs_context()
1953 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_init_fs_context()
1955 mp->m_features |= XFS_FEAT_WSYNC; in xfs_init_fs_context()
1957 fc->s_fs_info = mp; in xfs_init_fs_context()
2235 struct xfs_mount *mp, *n; in xfs_cpu_dead() local
2238 list_for_each_entry_safe(mp, n, &xfs_mount_list, m_mount_list) { in xfs_cpu_dead()
2240 xfs_inodegc_cpu_dead(mp, cpu); in xfs_cpu_dead()
2241 xlog_cil_pcp_dead(mp->m_log, cpu); in xfs_cpu_dead()