Lines Matching +full:sc +full:- +full:partitions

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
58 static struct dentry *xfs_debugfs; /* top-level xfs debugfs dir */
59 static struct kset *xfs_kset; /* top-level xfs sysfs dir */
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()
190 for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) { in xfs_fs_show_options()
191 if (mp->m_features & xfs_infop->flag) in xfs_fs_show_options()
192 seq_puts(m, xfs_infop->str); 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()
246 set_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
247 clear_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
252 clear_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
253 clear_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
257 set_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
259 set_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
261 clear_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
275 * because in the growfs case, mp->m_sb.sb_agcount is not yet updated
287 xfs_sb_t *sbp = &mp->m_sb; in xfs_set_inode_alloc()
296 if (M_IGEO(mp)->maxicount) { in xfs_set_inode_alloc()
299 icount = sbp->sb_dblocks * sbp->sb_imax_pct; in xfs_set_inode_alloc()
301 icount += sbp->sb_agblocks - 1; in xfs_set_inode_alloc()
302 do_div(icount, sbp->sb_agblocks); 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()
313 * If user asked for no more than 32-bit inodes, and the fs is in xfs_set_inode_alloc()
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()
347 if (mp->m_super->s_blocksize != PAGE_SIZE) { in xfs_setup_dax_always()
354 bdev_is_partition(mp->m_ddev_targp->bt_bdev)) { in xfs_setup_dax_always()
356 "DAX and reflink cannot work with multi-partitions!"); in xfs_setup_dax_always()
357 return -EINVAL; in xfs_setup_dax_always()
377 mp->m_super, &fs_holder_ops); in xfs_blkdev_get()
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()
437 * get_sb_bdev() and is stored in sb->s_bdev.
443 struct super_block *sb = mp->m_super; in xfs_open_devices()
444 struct block_device *ddev = sb->s_bdev; in xfs_open_devices()
449 * Open real time and log devices - order is important. 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()
467 error = -EINVAL; in xfs_open_devices()
475 error = -ENOMEM; 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()
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()
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()
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()
598 return -ENOMEM; in xfs_init_mount_workqueues()
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()
619 struct super_block *sb = mp->m_super; in xfs_flush_inodes_worker()
621 if (down_read_trylock(&sb->s_umount)) { in xfs_flush_inodes_worker()
623 up_read(&sb->s_umount); in xfs_flush_inodes_worker()
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()
669 ASSERT(!rwsem_is_locked(&inode->i_rwsem)); in xfs_fs_destroy_inode()
670 XFS_STATS_INC(ip->i_mount, vn_rele); in xfs_fs_destroy_inode()
671 XFS_STATS_INC(ip->i_mount, vn_remove); in xfs_fs_destroy_inode()
681 struct xfs_mount *mp = ip->i_mount; in xfs_fs_dirty_inode()
684 if (!(inode->i_sb->s_flags & SB_LAZYTIME)) in xfs_fs_dirty_inode()
695 if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) in xfs_fs_dirty_inode()
723 atomic_set(&ip->i_pincount, 0); in xfs_fs_inode_init_once()
724 spin_lock_init(&ip->i_flags_lock); in xfs_fs_inode_init_once()
725 init_rwsem(&ip->i_lock); in xfs_fs_inode_init_once()
730 * serialised against cache hits here via the inode->i_lock and igrab() in
746 if (ip->i_flags & XFS_IRECOVERY) { in xfs_fs_drop_inode()
747 ASSERT(xlog_recovery_needed(ip->i_mount->m_log)); in xfs_fs_drop_inode()
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()
797 flush_delayed_work(&mp->m_log->l_work); in xfs_fs_sync_fs()
810 * freeze that does this - we can run this multiple times without issue in xfs_fs_sync_fs()
814 if (sb->s_writers.frozen == SB_FREEZE_PAGEFAULT) { in xfs_fs_sync_fs()
826 if (!mp->m_sb.sb_logstart) in xfs_internal_log_size()
828 return mp->m_sb.sb_logblocks; in xfs_internal_log_size()
837 percpu_counter_sum(&mp->m_fdblocks); in xfs_statfs_data()
839 /* make sure st->f_bfree does not underflow */ 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()
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()
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()
872 st->f_files = min(icount + fakeinos, (uint64_t)XFS_MAXINUMBER); in xfs_statfs_inodes()
873 if (M_IGEO(mp)->maxicount) in xfs_statfs_inodes()
874 st->f_files = min_t(typeof(st->f_files), st->f_files, in xfs_statfs_inodes()
875 M_IGEO(mp)->maxicount); in xfs_statfs_inodes()
878 st->f_files = max_t(typeof(st->f_files), st->f_files, in xfs_statfs_inodes()
879 mp->m_sb.sb_icount); in xfs_statfs_inodes()
881 /* Make sure st->f_ffree does not underflow */ in xfs_statfs_inodes()
882 st->f_ffree = max_t(int64_t, 0, st->f_files - (icount - ifree)); in xfs_statfs_inodes()
890 struct xfs_mount *mp = XFS_M(dentry->d_sb); in xfs_fs_statfs()
899 st->f_type = XFS_SUPER_MAGIC; in xfs_fs_statfs()
900 st->f_namelen = MAXNAMELEN - 1; 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()
908 (ip->i_diflags & (XFS_DIFLAG_RTINHERIT | XFS_DIFLAG_REALTIME))) in xfs_fs_statfs()
911 if ((ip->i_diflags & XFS_DIFLAG_PROJINHERIT) && in xfs_fs_statfs()
912 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
920 st->f_bavail = st->f_bfree; in xfs_fs_statfs()
927 mp->m_resblks_save = mp->m_resblks; in xfs_save_resvblks()
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()
970 * For read-write filesystems, we need to restart the inodegc on error in xfs_fs_freeze()
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()
1024 return -EINVAL; in xfs_finish_flags()
1028 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
1031 return -EINVAL; in xfs_finish_flags()
1041 return -EINVAL; in xfs_finish_flags()
1045 * prohibit r/w mounts of read-only filesystems in xfs_finish_flags()
1047 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
1049 "cannot mount a read-only filesystem as read-write"); in xfs_finish_flags()
1050 return -EROFS; 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()
1058 return -EINVAL; in xfs_finish_flags()
1070 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1072 return -ENOMEM; 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()
1106 return -ENOMEM; in xfs_init_percpu_counters()
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()
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()
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()
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()
1142 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1143 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1144 return -ENOMEM; in xfs_inodegc_init_percpu()
1147 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1148 gc->cpu = cpu; in xfs_inodegc_init_percpu()
1149 gc->mp = mp; in xfs_inodegc_init_percpu()
1150 init_llist_head(&gc->list); in xfs_inodegc_init_percpu()
1151 gc->items = 0; in xfs_inodegc_init_percpu()
1152 gc->error = 0; in xfs_inodegc_init_percpu()
1153 INIT_DELAYED_WORK(&gc->work, xfs_inodegc_worker); in xfs_inodegc_init_percpu()
1162 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1164 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1173 xfs_notice(mp, "Unmounting Filesystem %pU", &mp->m_sb.sb_uuid); in xfs_fs_put_super()
1180 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1190 struct shrink_control *sc) in xfs_fs_nr_cached_objects() argument
1193 if (WARN_ON_ONCE(!sb->s_fs_info)) in xfs_fs_nr_cached_objects()
1201 struct shrink_control *sc) in xfs_fs_free_cached_objects() argument
1203 return xfs_reclaim_inodes_nr(XFS_M(sb), sc->nr_to_scan); in xfs_fs_free_cached_objects()
1241 return -ENOMEM; in suffix_kstrtoint()
1243 last = strlen(value) - 1; in suffix_kstrtoint()
1258 ret = -EINVAL; in suffix_kstrtoint()
1274 if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) && in xfs_fs_warn_deprecated()
1275 !!(XFS_M(fc->root->d_sb)->m_features & flag) == value) in xfs_fs_warn_deprecated()
1277 xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key); in xfs_fs_warn_deprecated()
1283 * NOTE: mp->m_super is NULL here!
1290 struct xfs_mount *parsing_mp = fc->s_fs_info; in xfs_fs_parse_param()
1303 parsing_mp->m_logbufs = result.uint_32; in xfs_fs_parse_param()
1306 if (suffix_kstrtoint(param->string, 10, &parsing_mp->m_logbsize)) in xfs_fs_parse_param()
1307 return -EINVAL; in xfs_fs_parse_param()
1310 kfree(parsing_mp->m_logname); in xfs_fs_parse_param()
1311 parsing_mp->m_logname = kstrdup(param->string, GFP_KERNEL); in xfs_fs_parse_param()
1312 if (!parsing_mp->m_logname) in xfs_fs_parse_param()
1313 return -ENOMEM; in xfs_fs_parse_param()
1316 kfree(parsing_mp->m_rtname); in xfs_fs_parse_param()
1317 parsing_mp->m_rtname = kstrdup(param->string, GFP_KERNEL); in xfs_fs_parse_param()
1318 if (!parsing_mp->m_rtname) in xfs_fs_parse_param()
1319 return -ENOMEM; in xfs_fs_parse_param()
1322 if (suffix_kstrtoint(param->string, 10, &size)) in xfs_fs_parse_param()
1323 return -EINVAL; in xfs_fs_parse_param()
1324 parsing_mp->m_allocsize_log = ffs(size) - 1; in xfs_fs_parse_param()
1325 parsing_mp->m_features |= XFS_FEAT_ALLOCSIZE; in xfs_fs_parse_param()
1329 parsing_mp->m_features |= XFS_FEAT_GRPID; in xfs_fs_parse_param()
1333 parsing_mp->m_features &= ~XFS_FEAT_GRPID; in xfs_fs_parse_param()
1336 parsing_mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_parse_param()
1339 parsing_mp->m_features |= XFS_FEAT_NORECOVERY; in xfs_fs_parse_param()
1342 parsing_mp->m_features |= XFS_FEAT_NOALIGN; in xfs_fs_parse_param()
1345 parsing_mp->m_features |= XFS_FEAT_SWALLOC; in xfs_fs_parse_param()
1348 parsing_mp->m_dalign = result.uint_32; in xfs_fs_parse_param()
1351 parsing_mp->m_swidth = result.uint_32; in xfs_fs_parse_param()
1354 parsing_mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_parse_param()
1357 parsing_mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_parse_param()
1360 parsing_mp->m_features |= XFS_FEAT_NOUUID; in xfs_fs_parse_param()
1363 parsing_mp->m_features |= XFS_FEAT_LARGE_IOSIZE; in xfs_fs_parse_param()
1366 parsing_mp->m_features &= ~XFS_FEAT_LARGE_IOSIZE; in xfs_fs_parse_param()
1369 parsing_mp->m_features |= XFS_FEAT_FILESTREAMS; in xfs_fs_parse_param()
1372 parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT; in xfs_fs_parse_param()
1373 parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD; in xfs_fs_parse_param()
1374 parsing_mp->m_qflags |= XFS_QFLAGS_MNTOPTS; in xfs_fs_parse_param()
1379 parsing_mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ENFD); in xfs_fs_parse_param()
1380 parsing_mp->m_qflags |= XFS_QFLAGS_MNTOPTS; in xfs_fs_parse_param()
1384 parsing_mp->m_qflags |= XFS_UQUOTA_ACCT; in xfs_fs_parse_param()
1385 parsing_mp->m_qflags &= ~XFS_UQUOTA_ENFD; in xfs_fs_parse_param()
1386 parsing_mp->m_qflags |= XFS_QFLAGS_MNTOPTS; in xfs_fs_parse_param()
1390 parsing_mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ENFD); in xfs_fs_parse_param()
1391 parsing_mp->m_qflags |= XFS_QFLAGS_MNTOPTS; in xfs_fs_parse_param()
1394 parsing_mp->m_qflags |= XFS_PQUOTA_ACCT; in xfs_fs_parse_param()
1395 parsing_mp->m_qflags &= ~XFS_PQUOTA_ENFD; in xfs_fs_parse_param()
1396 parsing_mp->m_qflags |= XFS_QFLAGS_MNTOPTS; in xfs_fs_parse_param()
1400 parsing_mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ENFD); in xfs_fs_parse_param()
1401 parsing_mp->m_qflags |= XFS_QFLAGS_MNTOPTS; in xfs_fs_parse_param()
1404 parsing_mp->m_qflags |= XFS_GQUOTA_ACCT; in xfs_fs_parse_param()
1405 parsing_mp->m_qflags &= ~XFS_GQUOTA_ENFD; in xfs_fs_parse_param()
1406 parsing_mp->m_qflags |= XFS_QFLAGS_MNTOPTS; in xfs_fs_parse_param()
1409 parsing_mp->m_features |= XFS_FEAT_DISCARD; in xfs_fs_parse_param()
1412 parsing_mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_parse_param()
1425 parsing_mp->m_features |= XFS_FEAT_IKEEP; in xfs_fs_parse_param()
1429 parsing_mp->m_features &= ~XFS_FEAT_IKEEP; in xfs_fs_parse_param()
1433 parsing_mp->m_features |= XFS_FEAT_ATTR2; in xfs_fs_parse_param()
1437 parsing_mp->m_features |= XFS_FEAT_NOATTR2; in xfs_fs_parse_param()
1440 xfs_warn(parsing_mp, "unknown mount option [%s].", param->key); in xfs_fs_parse_param()
1441 return -EINVAL; in xfs_fs_parse_param()
1451 /* No recovery flag requires a read-only mount */ in xfs_fs_validate_params()
1453 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1454 return -EINVAL; in xfs_fs_validate_params()
1463 return -EINVAL; in xfs_fs_validate_params()
1467 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1470 return -EINVAL; in xfs_fs_validate_params()
1474 (mp->m_qflags & ~XFS_QFLAGS_MNTOPTS)) { in xfs_fs_validate_params()
1476 return -EINVAL; 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()
1482 return -EINVAL; in xfs_fs_validate_params()
1485 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1488 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1489 return -EINVAL; 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()
1498 return -EINVAL; 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()
1508 mp->m_logbsize); in xfs_fs_validate_params()
1509 return -EINVAL; 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()
1517 return -EINVAL; in xfs_fs_validate_params()
1543 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super()
1547 mp->m_super = sb; in xfs_fs_fill_super()
1554 if (fc->sb_flags & SB_RDONLY) in xfs_fs_fill_super()
1556 if (fc->sb_flags & SB_DIRSYNC) in xfs_fs_fill_super()
1557 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_fs_fill_super()
1558 if (fc->sb_flags & SB_SYNCHRONOUS) in xfs_fs_fill_super()
1559 mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_fill_super()
1566 sb->s_xattr = xfs_xattr_handlers; in xfs_fs_fill_super()
1567 sb->s_export_op = &xfs_export_operations; in xfs_fs_fill_super()
1569 sb->s_qcop = &xfs_quotactl_operations; in xfs_fs_fill_super()
1570 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ; in xfs_fs_fill_super()
1572 sb->s_op = &xfs_super_operations; in xfs_fs_fill_super()
1585 if (fc->sb_flags & SB_SILENT) 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()
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()
1614 error = -ENOMEM; in xfs_fs_fill_super()
1640 if (!(mp->m_features & XFS_FEAT_CRC)) { in xfs_fs_fill_super()
1644 error = -EINVAL; in xfs_fs_fill_super()
1655 …"Deprecated ASCII case-insensitivity feature (ascii-ci=1) will not be supported after September 20… in xfs_fs_fill_super()
1658 "Deprecated ASCII case-insensitivity feature (ascii-ci=1) not supported by kernel."); in xfs_fs_fill_super()
1659 error = -EINVAL; in xfs_fs_fill_super()
1671 error = -EFSCORRUPTED; in xfs_fs_fill_super()
1680 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1682 error = -EFSCORRUPTED; in xfs_fs_fill_super()
1686 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1692 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1693 error = -ENOSYS; in xfs_fs_fill_super()
1697 if (mp->m_sb.sb_blocksize > max_folio_size) { in xfs_fs_fill_super()
1700 mp->m_sb.sb_blocksize, max_folio_size); in xfs_fs_fill_super()
1701 error = -ENOSYS; 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()
1713 error = -EFBIG; in xfs_fs_fill_super()
1720 * supports (currently 2^63 bytes on 64-bit and ULONG_MAX << PAGE_SHIFT in xfs_fs_fill_super()
1721 * bytes on 32-bit), but as XFS and VFS have gotten the s_maxbytes in xfs_fs_fill_super()
1722 * calculation wrong on 32-bit kernels in the past, we'll add a WARN_ON in xfs_fs_fill_super()
1733 error = -EINVAL; in xfs_fs_fill_super()
1749 sb->s_magic = XFS_SUPER_MAGIC; in xfs_fs_fill_super()
1750 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1751 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1; in xfs_fs_fill_super()
1752 sb->s_maxbytes = MAX_LFS_FILESIZE; in xfs_fs_fill_super()
1753 sb->s_max_links = XFS_MAXLINK; in xfs_fs_fill_super()
1754 sb->s_time_gran = 1; in xfs_fs_fill_super()
1756 sb->s_time_min = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MIN); in xfs_fs_fill_super()
1757 sb->s_time_max = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MAX); in xfs_fs_fill_super()
1759 sb->s_time_min = XFS_LEGACY_TIME_MIN; in xfs_fs_fill_super()
1760 sb->s_time_max = XFS_LEGACY_TIME_MAX; 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()
1763 sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM; in xfs_fs_fill_super()
1769 sb->s_flags |= SB_I_VERSION; in xfs_fs_fill_super()
1777 if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { in xfs_fs_fill_super()
1780 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1788 !xfs_reflink_supports_rextsize(mp, mp->m_sb.sb_rextsize)) { in xfs_fs_fill_super()
1791 mp->m_sb.sb_rextsize); in xfs_fs_fill_super()
1792 error = -EINVAL; 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()
1813 if (!(mp->m_qflags & XFS_QFLAGS_MNTOPTS)) in xfs_fs_fill_super()
1815 mp->m_qflags &= ~XFS_QFLAGS_MNTOPTS; in xfs_fs_fill_super()
1821 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1823 error = -ENOENT; in xfs_fs_fill_super()
1826 sb->s_root = d_make_root(root); in xfs_fs_fill_super()
1827 if (!sb->s_root) { in xfs_fs_fill_super()
1828 error = -ENOMEM; in xfs_fs_fill_super()
1843 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1871 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
1876 "ro->rw transition prohibited on norecovery mount"); in xfs_remount_rw()
1877 return -EINVAL; in xfs_remount_rw()
1883 "ro->rw transition prohibited on unknown (0x%x) ro-compat filesystem", in xfs_remount_rw()
1884 (sbp->sb_features_ro_compat & in xfs_remount_rw()
1886 return -EINVAL; in xfs_remount_rw()
1895 if (mp->m_update_sb) { in xfs_remount_rw()
1901 mp->m_update_sb = false; in xfs_remount_rw()
1906 * it is non-zero, otherwise go with the default. in xfs_remount_rw()
1912 /* Create the per-AG metadata reservation pool .*/ in xfs_remount_rw()
1914 if (error && error != -ENOSPC) in xfs_remount_rw()
1917 /* Re-enable the background inode inactivation worker. */ in xfs_remount_rw()
1933 error = sync_filesystem(mp->m_super); in xfs_remount_ro()
1944 * Clear out all remaining COW staging extents and speculative post-EOF in xfs_remount_ro()
1946 * cleanups during reclaim on a read-only mount. We must process every in xfs_remount_ro()
1964 /* Free the per-AG metadata reservation pool. */ in xfs_remount_ro()
1998 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure()
1999 struct xfs_mount *new_mp = fc->s_fs_info; in xfs_fs_reconfigure()
2000 int flags = fc->sb_flags; in xfs_fs_reconfigure()
2003 new_mp->m_qflags &= ~XFS_QFLAGS_MNTOPTS; in xfs_fs_reconfigure()
2007 fc->sb_flags |= SB_I_VERSION; in xfs_fs_reconfigure()
2013 /* inode32 -> inode64 */ 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()
2019 /* inode64 -> inode32 */ 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()
2025 /* ro -> rw */ in xfs_fs_reconfigure()
2032 /* rw -> ro */ in xfs_fs_reconfigure()
2046 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free()
2079 return -ENOMEM; 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()
2089 * We don't create the finobt per-ag space reservation until after log 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()
2106 fc->ops = &xfs_context_ops; in xfs_init_fs_context()
2179 * The size of the cache-allocated buf log item is the maximum in xfs_init_caches()
2348 return -ENOMEM; in xfs_init_caches()
2399 return -ENOMEM; in xfs_init_workqueues()
2409 return -ENOMEM; in xfs_init_workqueues()
2459 error = -ENOMEM; in init_xfs_fs()
2467 error = -ENOMEM; in init_xfs_fs()