Lines Matching +full:sc +full:- +full:partitions
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
57 static struct dentry *xfs_debugfs; /* top-level xfs debugfs dir */
58 static struct kset *xfs_kset; /* top-level xfs sysfs dir */
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()
186 for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) { in xfs_fs_show_options()
187 if (mp->m_features & xfs_infop->flag) in xfs_fs_show_options()
188 seq_puts(m, xfs_infop->str); 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()
241 if (!xfs_is_inode32(pag->pag_mount)) { in xfs_set_inode_alloc_perag()
242 set_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
243 clear_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
248 clear_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
249 clear_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
253 set_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
254 if (pag->pag_agno < max_metadata) in xfs_set_inode_alloc_perag()
255 set_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
257 clear_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
271 * because in the growfs case, mp->m_sb.sb_agcount is not yet updated
283 xfs_sb_t *sbp = &mp->m_sb; in xfs_set_inode_alloc()
292 if (M_IGEO(mp)->maxicount) { in xfs_set_inode_alloc()
295 icount = sbp->sb_dblocks * sbp->sb_imax_pct; in xfs_set_inode_alloc()
297 icount += sbp->sb_agblocks - 1; in xfs_set_inode_alloc()
298 do_div(icount, sbp->sb_agblocks); 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()
309 * If user asked for no more than 32-bit inodes, and the fs is in xfs_set_inode_alloc()
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()
343 if (mp->m_super->s_blocksize != PAGE_SIZE) { in xfs_setup_dax_always()
350 bdev_is_partition(mp->m_ddev_targp->bt_bdev)) { in xfs_setup_dax_always()
352 "DAX and reflink cannot work with multi-partitions!"); in xfs_setup_dax_always()
353 return -EINVAL; in xfs_setup_dax_always()
373 mp->m_super, &fs_holder_ops); in xfs_blkdev_get()
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()
433 * get_sb_bdev() and is stored in sb->s_bdev.
439 struct super_block *sb = mp->m_super; in xfs_open_devices()
440 struct block_device *ddev = sb->s_bdev; in xfs_open_devices()
445 * Open real time and log devices - order is important. 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()
463 error = -EINVAL; in xfs_open_devices()
471 error = -ENOMEM; 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()
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()
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()
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()
594 return -ENOMEM; in xfs_init_mount_workqueues()
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()
615 struct super_block *sb = mp->m_super; in xfs_flush_inodes_worker()
617 if (down_read_trylock(&sb->s_umount)) { in xfs_flush_inodes_worker()
619 up_read(&sb->s_umount); in xfs_flush_inodes_worker()
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()
665 ASSERT(!rwsem_is_locked(&inode->i_rwsem)); in xfs_fs_destroy_inode()
666 XFS_STATS_INC(ip->i_mount, vn_rele); in xfs_fs_destroy_inode()
667 XFS_STATS_INC(ip->i_mount, vn_remove); in xfs_fs_destroy_inode()
677 struct xfs_mount *mp = ip->i_mount; in xfs_fs_dirty_inode()
680 if (!(inode->i_sb->s_flags & SB_LAZYTIME)) in xfs_fs_dirty_inode()
691 if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) in xfs_fs_dirty_inode()
719 atomic_set(&ip->i_pincount, 0); in xfs_fs_inode_init_once()
720 spin_lock_init(&ip->i_flags_lock); in xfs_fs_inode_init_once()
721 init_rwsem(&ip->i_lock); in xfs_fs_inode_init_once()
726 * serialised against cache hits here via the inode->i_lock and igrab() in
742 if (ip->i_flags & XFS_IRECOVERY) { in xfs_fs_drop_inode()
743 ASSERT(xlog_recovery_needed(ip->i_mount->m_log)); in xfs_fs_drop_inode()
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()
793 flush_delayed_work(&mp->m_log->l_work); in xfs_fs_sync_fs()
806 * freeze that does this - we can run this multiple times without issue in xfs_fs_sync_fs()
810 if (sb->s_writers.frozen == SB_FREEZE_PAGEFAULT) { in xfs_fs_sync_fs()
823 struct xfs_mount *mp = XFS_M(dentry->d_sb); in xfs_fs_statfs()
824 xfs_sb_t *sbp = &mp->m_sb; in xfs_fs_statfs()
839 statp->f_type = XFS_SUPER_MAGIC; in xfs_fs_statfs()
840 statp->f_namelen = MAXNAMELEN - 1; in xfs_fs_statfs()
842 id = huge_encode_dev(mp->m_ddev_targp->bt_dev); in xfs_fs_statfs()
843 statp->f_fsid = u64_to_fsid(id); 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()
850 statp->f_bsize = sbp->sb_blocksize; in xfs_fs_statfs()
851 lsize = sbp->sb_logstart ? sbp->sb_logblocks : 0; in xfs_fs_statfs()
852 statp->f_blocks = sbp->sb_dblocks - lsize; in xfs_fs_statfs()
853 spin_unlock(&mp->m_sb_lock); in xfs_fs_statfs()
855 /* make sure statp->f_bfree does not underflow */ in xfs_fs_statfs()
856 statp->f_bfree = max_t(int64_t, 0, in xfs_fs_statfs()
857 fdblocks - xfs_fdblocks_unavailable(mp)); in xfs_fs_statfs()
858 statp->f_bavail = statp->f_bfree; in xfs_fs_statfs()
860 fakeinos = XFS_FSB_TO_INO(mp, statp->f_bfree); in xfs_fs_statfs()
861 statp->f_files = min(icount + fakeinos, (uint64_t)XFS_MAXINUMBER); in xfs_fs_statfs()
862 if (M_IGEO(mp)->maxicount) in xfs_fs_statfs()
863 statp->f_files = min_t(typeof(statp->f_files), in xfs_fs_statfs()
864 statp->f_files, in xfs_fs_statfs()
865 M_IGEO(mp)->maxicount); in xfs_fs_statfs()
868 statp->f_files = max_t(typeof(statp->f_files), in xfs_fs_statfs()
869 statp->f_files, in xfs_fs_statfs()
870 sbp->sb_icount); in xfs_fs_statfs()
872 /* make sure statp->f_ffree does not underflow */ in xfs_fs_statfs()
873 ffree = statp->f_files - (icount - ifree); in xfs_fs_statfs()
874 statp->f_ffree = max_t(int64_t, ffree, 0); in xfs_fs_statfs()
877 if ((ip->i_diflags & XFS_DIFLAG_PROJINHERIT) && in xfs_fs_statfs()
878 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
883 (ip->i_diflags & (XFS_DIFLAG_RTINHERIT | XFS_DIFLAG_REALTIME))) { in xfs_fs_statfs()
886 statp->f_blocks = sbp->sb_rblocks; 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()
897 mp->m_resblks_save = mp->m_resblks; in xfs_save_resvblks()
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()
940 * For read-write filesystems, we need to restart the inodegc on error in xfs_fs_freeze()
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()
994 return -EINVAL; in xfs_finish_flags()
998 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
1001 return -EINVAL; in xfs_finish_flags()
1011 return -EINVAL; in xfs_finish_flags()
1015 * prohibit r/w mounts of read-only filesystems in xfs_finish_flags()
1017 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
1019 "cannot mount a read-only filesystem as read-write"); in xfs_finish_flags()
1020 return -EROFS; 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()
1028 return -EINVAL; in xfs_finish_flags()
1040 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1042 return -ENOMEM; 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()
1076 return -ENOMEM; in xfs_init_percpu_counters()
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()
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()
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()
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()
1112 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1113 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1114 return -ENOMEM; in xfs_inodegc_init_percpu()
1117 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1118 gc->cpu = cpu; in xfs_inodegc_init_percpu()
1119 gc->mp = mp; in xfs_inodegc_init_percpu()
1120 init_llist_head(&gc->list); in xfs_inodegc_init_percpu()
1121 gc->items = 0; in xfs_inodegc_init_percpu()
1122 gc->error = 0; in xfs_inodegc_init_percpu()
1123 INIT_DELAYED_WORK(&gc->work, xfs_inodegc_worker); in xfs_inodegc_init_percpu()
1132 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1134 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1143 xfs_notice(mp, "Unmounting Filesystem %pU", &mp->m_sb.sb_uuid); in xfs_fs_put_super()
1149 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1159 struct shrink_control *sc) in xfs_fs_nr_cached_objects() argument
1162 if (WARN_ON_ONCE(!sb->s_fs_info)) in xfs_fs_nr_cached_objects()
1170 struct shrink_control *sc) in xfs_fs_free_cached_objects() argument
1172 return xfs_reclaim_inodes_nr(XFS_M(sb), sc->nr_to_scan); in xfs_fs_free_cached_objects()
1210 return -ENOMEM; in suffix_kstrtoint()
1212 last = strlen(value) - 1; in suffix_kstrtoint()
1227 ret = -EINVAL; in suffix_kstrtoint()
1243 if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) && in xfs_fs_warn_deprecated()
1244 !!(XFS_M(fc->root->d_sb)->m_features & flag) == value) in xfs_fs_warn_deprecated()
1246 xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key); in xfs_fs_warn_deprecated()
1252 * NOTE: mp->m_super is NULL here!
1259 struct xfs_mount *parsing_mp = fc->s_fs_info; in xfs_fs_parse_param()
1270 parsing_mp->m_logbufs = result.uint_32; in xfs_fs_parse_param()
1273 if (suffix_kstrtoint(param->string, 10, &parsing_mp->m_logbsize)) in xfs_fs_parse_param()
1274 return -EINVAL; in xfs_fs_parse_param()
1277 kfree(parsing_mp->m_logname); in xfs_fs_parse_param()
1278 parsing_mp->m_logname = kstrdup(param->string, GFP_KERNEL); in xfs_fs_parse_param()
1279 if (!parsing_mp->m_logname) in xfs_fs_parse_param()
1280 return -ENOMEM; in xfs_fs_parse_param()
1283 kfree(parsing_mp->m_rtname); in xfs_fs_parse_param()
1284 parsing_mp->m_rtname = kstrdup(param->string, GFP_KERNEL); in xfs_fs_parse_param()
1285 if (!parsing_mp->m_rtname) in xfs_fs_parse_param()
1286 return -ENOMEM; in xfs_fs_parse_param()
1289 if (suffix_kstrtoint(param->string, 10, &size)) in xfs_fs_parse_param()
1290 return -EINVAL; in xfs_fs_parse_param()
1291 parsing_mp->m_allocsize_log = ffs(size) - 1; in xfs_fs_parse_param()
1292 parsing_mp->m_features |= XFS_FEAT_ALLOCSIZE; in xfs_fs_parse_param()
1296 parsing_mp->m_features |= XFS_FEAT_GRPID; in xfs_fs_parse_param()
1300 parsing_mp->m_features &= ~XFS_FEAT_GRPID; in xfs_fs_parse_param()
1303 parsing_mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_parse_param()
1306 parsing_mp->m_features |= XFS_FEAT_NORECOVERY; in xfs_fs_parse_param()
1309 parsing_mp->m_features |= XFS_FEAT_NOALIGN; in xfs_fs_parse_param()
1312 parsing_mp->m_features |= XFS_FEAT_SWALLOC; in xfs_fs_parse_param()
1315 parsing_mp->m_dalign = result.uint_32; in xfs_fs_parse_param()
1318 parsing_mp->m_swidth = result.uint_32; in xfs_fs_parse_param()
1321 parsing_mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_parse_param()
1324 parsing_mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_parse_param()
1327 parsing_mp->m_features |= XFS_FEAT_NOUUID; in xfs_fs_parse_param()
1330 parsing_mp->m_features |= XFS_FEAT_LARGE_IOSIZE; in xfs_fs_parse_param()
1333 parsing_mp->m_features &= ~XFS_FEAT_LARGE_IOSIZE; in xfs_fs_parse_param()
1336 parsing_mp->m_features |= XFS_FEAT_FILESTREAMS; in xfs_fs_parse_param()
1339 parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT; in xfs_fs_parse_param()
1340 parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD; in xfs_fs_parse_param()
1345 parsing_mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ENFD); in xfs_fs_parse_param()
1349 parsing_mp->m_qflags |= XFS_UQUOTA_ACCT; in xfs_fs_parse_param()
1350 parsing_mp->m_qflags &= ~XFS_UQUOTA_ENFD; in xfs_fs_parse_param()
1354 parsing_mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ENFD); in xfs_fs_parse_param()
1357 parsing_mp->m_qflags |= XFS_PQUOTA_ACCT; in xfs_fs_parse_param()
1358 parsing_mp->m_qflags &= ~XFS_PQUOTA_ENFD; in xfs_fs_parse_param()
1362 parsing_mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ENFD); in xfs_fs_parse_param()
1365 parsing_mp->m_qflags |= XFS_GQUOTA_ACCT; in xfs_fs_parse_param()
1366 parsing_mp->m_qflags &= ~XFS_GQUOTA_ENFD; in xfs_fs_parse_param()
1369 parsing_mp->m_features |= XFS_FEAT_DISCARD; in xfs_fs_parse_param()
1372 parsing_mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_parse_param()
1385 parsing_mp->m_features |= XFS_FEAT_IKEEP; in xfs_fs_parse_param()
1389 parsing_mp->m_features &= ~XFS_FEAT_IKEEP; in xfs_fs_parse_param()
1393 parsing_mp->m_features |= XFS_FEAT_ATTR2; in xfs_fs_parse_param()
1397 parsing_mp->m_features |= XFS_FEAT_NOATTR2; in xfs_fs_parse_param()
1400 xfs_warn(parsing_mp, "unknown mount option [%s].", param->key); in xfs_fs_parse_param()
1401 return -EINVAL; in xfs_fs_parse_param()
1411 /* No recovery flag requires a read-only mount */ in xfs_fs_validate_params()
1413 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1414 return -EINVAL; in xfs_fs_validate_params()
1423 return -EINVAL; in xfs_fs_validate_params()
1427 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1430 return -EINVAL; in xfs_fs_validate_params()
1433 if (!IS_ENABLED(CONFIG_XFS_QUOTA) && mp->m_qflags != 0) { in xfs_fs_validate_params()
1435 return -EINVAL; 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()
1441 return -EINVAL; in xfs_fs_validate_params()
1444 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1447 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1448 return -EINVAL; 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()
1457 return -EINVAL; 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()
1467 mp->m_logbsize); in xfs_fs_validate_params()
1468 return -EINVAL; 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()
1476 return -EINVAL; in xfs_fs_validate_params()
1502 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super()
1506 mp->m_super = sb; in xfs_fs_fill_super()
1513 if (fc->sb_flags & SB_RDONLY) in xfs_fs_fill_super()
1515 if (fc->sb_flags & SB_DIRSYNC) in xfs_fs_fill_super()
1516 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_fs_fill_super()
1517 if (fc->sb_flags & SB_SYNCHRONOUS) in xfs_fs_fill_super()
1518 mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_fill_super()
1525 sb->s_xattr = xfs_xattr_handlers; in xfs_fs_fill_super()
1526 sb->s_export_op = &xfs_export_operations; in xfs_fs_fill_super()
1528 sb->s_qcop = &xfs_quotactl_operations; in xfs_fs_fill_super()
1529 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ; in xfs_fs_fill_super()
1531 sb->s_op = &xfs_super_operations; in xfs_fs_fill_super()
1544 if (fc->sb_flags & SB_SILENT) 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()
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()
1573 error = -ENOMEM; in xfs_fs_fill_super()
1599 if (!(mp->m_features & XFS_FEAT_CRC)) { in xfs_fs_fill_super()
1603 error = -EINVAL; in xfs_fs_fill_super()
1614 …"Deprecated ASCII case-insensitivity feature (ascii-ci=1) will not be supported after September 20… in xfs_fs_fill_super()
1617 "Deprecated ASCII case-insensitivity feature (ascii-ci=1) not supported by kernel."); in xfs_fs_fill_super()
1618 error = -EINVAL; in xfs_fs_fill_super()
1626 error = -EFSCORRUPTED; in xfs_fs_fill_super()
1635 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1637 error = -EFSCORRUPTED; in xfs_fs_fill_super()
1641 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1647 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1648 error = -ENOSYS; in xfs_fs_fill_super()
1652 if (mp->m_sb.sb_blocksize > max_folio_size) { in xfs_fs_fill_super()
1655 mp->m_sb.sb_blocksize, max_folio_size); in xfs_fs_fill_super()
1656 error = -ENOSYS; 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()
1670 error = -EFBIG; in xfs_fs_fill_super()
1677 * supports (currently 2^63 bytes on 64-bit and ULONG_MAX << PAGE_SHIFT in xfs_fs_fill_super()
1678 * bytes on 32-bit), but as XFS and VFS have gotten the s_maxbytes in xfs_fs_fill_super()
1679 * calculation wrong on 32-bit kernels in the past, we'll add a WARN_ON in xfs_fs_fill_super()
1690 error = -EINVAL; in xfs_fs_fill_super()
1702 sb->s_magic = XFS_SUPER_MAGIC; in xfs_fs_fill_super()
1703 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1704 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1; in xfs_fs_fill_super()
1705 sb->s_maxbytes = MAX_LFS_FILESIZE; in xfs_fs_fill_super()
1706 sb->s_max_links = XFS_MAXLINK; in xfs_fs_fill_super()
1707 sb->s_time_gran = 1; in xfs_fs_fill_super()
1709 sb->s_time_min = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MIN); in xfs_fs_fill_super()
1710 sb->s_time_max = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MAX); in xfs_fs_fill_super()
1712 sb->s_time_min = XFS_LEGACY_TIME_MIN; in xfs_fs_fill_super()
1713 sb->s_time_max = XFS_LEGACY_TIME_MAX; 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()
1716 sb->s_iflags |= SB_I_CGROUPWB; in xfs_fs_fill_super()
1722 sb->s_flags |= SB_I_VERSION; in xfs_fs_fill_super()
1730 if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { in xfs_fs_fill_super()
1733 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1737 if (mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1740 error = -EINVAL; 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()
1753 error = -EINVAL; in xfs_fs_fill_super()
1759 "EXPERIMENTAL exchange-range feature enabled. Use at your own risk!"); in xfs_fs_fill_super()
1769 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1771 error = -ENOENT; in xfs_fs_fill_super()
1774 sb->s_root = d_make_root(root); in xfs_fs_fill_super()
1775 if (!sb->s_root) { in xfs_fs_fill_super()
1776 error = -ENOMEM; in xfs_fs_fill_super()
1789 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1817 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
1822 "ro->rw transition prohibited on norecovery mount"); in xfs_remount_rw()
1823 return -EINVAL; in xfs_remount_rw()
1829 "ro->rw transition prohibited on unknown (0x%x) ro-compat filesystem", in xfs_remount_rw()
1830 (sbp->sb_features_ro_compat & in xfs_remount_rw()
1832 return -EINVAL; in xfs_remount_rw()
1841 if (mp->m_update_sb) { in xfs_remount_rw()
1847 mp->m_update_sb = false; in xfs_remount_rw()
1852 * it is non-zero, otherwise go with the default. in xfs_remount_rw()
1858 /* Create the per-AG metadata reservation pool .*/ in xfs_remount_rw()
1860 if (error && error != -ENOSPC) in xfs_remount_rw()
1863 /* Re-enable the background inode inactivation worker. */ in xfs_remount_rw()
1879 error = sync_filesystem(mp->m_super); in xfs_remount_ro()
1890 * Clear out all remaining COW staging extents and speculative post-EOF in xfs_remount_ro()
1892 * cleanups during reclaim on a read-only mount. We must process every in xfs_remount_ro()
1910 /* Free the per-AG metadata reservation pool. */ in xfs_remount_ro()
1944 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure()
1945 struct xfs_mount *new_mp = fc->s_fs_info; in xfs_fs_reconfigure()
1946 int flags = fc->sb_flags; in xfs_fs_reconfigure()
1951 fc->sb_flags |= SB_I_VERSION; in xfs_fs_reconfigure()
1957 /* inode32 -> inode64 */ 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()
1963 /* inode64 -> inode32 */ 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()
1969 /* ro -> rw */ in xfs_fs_reconfigure()
1976 /* rw -> ro */ in xfs_fs_reconfigure()
1990 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free()
2021 return -ENOMEM; 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()
2030 * We don't create the finobt per-ag space reservation until after log 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()
2047 fc->ops = &xfs_context_ops; in xfs_init_fs_context()
2120 * The size of the cache-allocated buf log item is the maximum in xfs_init_caches()
2289 return -ENOMEM; in xfs_init_caches()
2340 return -ENOMEM; in xfs_init_workqueues()
2350 return -ENOMEM; in xfs_init_workqueues()
2400 error = -ENOMEM; in init_xfs_fs()
2408 error = -ENOMEM; in init_xfs_fs()