• Home
  • Raw
  • Download

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

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
53 static struct dentry *xfs_debugfs; /* top-level xfs debugfs dir */
54 static struct kset *xfs_kset; /* top-level xfs sysfs dir */
72 mp->m_features &= ~(XFS_FEAT_DAX_ALWAYS | XFS_FEAT_DAX_NEVER); in xfs_mount_set_dax_mode()
75 mp->m_features |= XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
76 mp->m_features &= ~XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
79 mp->m_features |= XFS_FEAT_DAX_NEVER; in xfs_mount_set_dax_mode()
80 mp->m_features &= ~XFS_FEAT_DAX_ALWAYS; in xfs_mount_set_dax_mode()
179 struct xfs_mount *mp = XFS_M(root->d_sb); in xfs_fs_show_options()
182 for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) { in xfs_fs_show_options()
183 if (mp->m_features & xfs_infop->flag) in xfs_fs_show_options()
184 seq_puts(m, xfs_infop->str); in xfs_fs_show_options()
191 (1 << mp->m_allocsize_log) >> 10); in xfs_fs_show_options()
193 if (mp->m_logbufs > 0) in xfs_fs_show_options()
194 seq_printf(m, ",logbufs=%d", mp->m_logbufs); in xfs_fs_show_options()
195 if (mp->m_logbsize > 0) in xfs_fs_show_options()
196 seq_printf(m, ",logbsize=%dk", mp->m_logbsize >> 10); in xfs_fs_show_options()
198 if (mp->m_logname) in xfs_fs_show_options()
199 seq_show_option(m, "logdev", mp->m_logname); in xfs_fs_show_options()
200 if (mp->m_rtname) in xfs_fs_show_options()
201 seq_show_option(m, "rtdev", mp->m_rtname); in xfs_fs_show_options()
203 if (mp->m_dalign > 0) in xfs_fs_show_options()
205 (int)XFS_FSB_TO_BB(mp, mp->m_dalign)); in xfs_fs_show_options()
206 if (mp->m_swidth > 0) in xfs_fs_show_options()
208 (int)XFS_FSB_TO_BB(mp, mp->m_swidth)); in xfs_fs_show_options()
210 if (mp->m_qflags & XFS_UQUOTA_ENFD) in xfs_fs_show_options()
212 else if (mp->m_qflags & XFS_UQUOTA_ACCT) in xfs_fs_show_options()
215 if (mp->m_qflags & XFS_PQUOTA_ENFD) in xfs_fs_show_options()
217 else if (mp->m_qflags & XFS_PQUOTA_ACCT) in xfs_fs_show_options()
220 if (mp->m_qflags & XFS_GQUOTA_ENFD) in xfs_fs_show_options()
222 else if (mp->m_qflags & XFS_GQUOTA_ACCT) in xfs_fs_show_options()
225 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) in xfs_fs_show_options()
237 if (!xfs_is_inode32(pag->pag_mount)) { in xfs_set_inode_alloc_perag()
238 set_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
239 clear_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
244 clear_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
245 clear_bit(XFS_AGSTATE_PREFERS_METADATA, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
249 set_bit(XFS_AGSTATE_ALLOWS_INODES, &pag->pag_opstate); in xfs_set_inode_alloc_perag()
250 if (pag->pag_agno < max_metadata) in xfs_set_inode_alloc_perag()
251 set_bit(XFS_AGSTATE_PREFERS_METADATA, &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()
267 * because in the growfs case, mp->m_sb.sb_agcount is not yet updated
279 xfs_sb_t *sbp = &mp->m_sb; in xfs_set_inode_alloc()
288 if (M_IGEO(mp)->maxicount) { in xfs_set_inode_alloc()
291 icount = sbp->sb_dblocks * sbp->sb_imax_pct; in xfs_set_inode_alloc()
293 icount += sbp->sb_agblocks - 1; in xfs_set_inode_alloc()
294 do_div(icount, sbp->sb_agblocks); in xfs_set_inode_alloc()
301 agino = XFS_AGB_TO_AGINO(mp, sbp->sb_agblocks - 1); in xfs_set_inode_alloc()
302 ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino); in xfs_set_inode_alloc()
305 * If user asked for no more than 32-bit inodes, and the fs is in xfs_set_inode_alloc()
310 set_bit(XFS_OPSTATE_INODE32, &mp->m_opstate); in xfs_set_inode_alloc()
312 clear_bit(XFS_OPSTATE_INODE32, &mp->m_opstate); in xfs_set_inode_alloc()
332 if (!mp->m_ddev_targp->bt_daxdev && in xfs_setup_dax_always()
333 (!mp->m_rtdev_targp || !mp->m_rtdev_targp->bt_daxdev)) { in xfs_setup_dax_always()
339 if (mp->m_super->s_blocksize != PAGE_SIZE) { in xfs_setup_dax_always()
346 bdev_is_partition(mp->m_ddev_targp->bt_bdev)) { in xfs_setup_dax_always()
348 "DAX and reflink cannot work with multi-partitions!"); in xfs_setup_dax_always()
349 return -EINVAL; in xfs_setup_dax_always()
369 mp->m_super, &fs_holder_ops); in xfs_blkdev_get()
408 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_shutdown_devices()
409 blkdev_issue_flush(mp->m_logdev_targp->bt_bdev); in xfs_shutdown_devices()
410 invalidate_bdev(mp->m_logdev_targp->bt_bdev); in xfs_shutdown_devices()
412 if (mp->m_rtdev_targp) { in xfs_shutdown_devices()
413 blkdev_issue_flush(mp->m_rtdev_targp->bt_bdev); in xfs_shutdown_devices()
414 invalidate_bdev(mp->m_rtdev_targp->bt_bdev); in xfs_shutdown_devices()
416 blkdev_issue_flush(mp->m_ddev_targp->bt_bdev); in xfs_shutdown_devices()
417 invalidate_bdev(mp->m_ddev_targp->bt_bdev); in xfs_shutdown_devices()
428 * get_sb_bdev() and is stored in sb->s_bdev.
434 struct super_block *sb = mp->m_super; in xfs_open_devices()
435 struct block_device *ddev = sb->s_bdev; in xfs_open_devices()
443 up_write(&sb->s_umount); in xfs_open_devices()
446 * Open real time and log devices - order is important. in xfs_open_devices()
448 if (mp->m_logname) { in xfs_open_devices()
449 error = xfs_blkdev_get(mp, mp->m_logname, &logdev); in xfs_open_devices()
454 if (mp->m_rtname) { in xfs_open_devices()
455 error = xfs_blkdev_get(mp, mp->m_rtname, &rtdev); in xfs_open_devices()
462 error = -EINVAL; in xfs_open_devices()
470 error = -ENOMEM; in xfs_open_devices()
471 mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev); in xfs_open_devices()
472 if (!mp->m_ddev_targp) in xfs_open_devices()
476 mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev); in xfs_open_devices()
477 if (!mp->m_rtdev_targp) in xfs_open_devices()
482 mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev); in xfs_open_devices()
483 if (!mp->m_logdev_targp) in xfs_open_devices()
486 mp->m_logdev_targp = mp->m_ddev_targp; in xfs_open_devices()
491 down_write(&sb->s_umount); in xfs_open_devices()
495 if (mp->m_rtdev_targp) in xfs_open_devices()
496 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_open_devices()
498 xfs_free_buftarg(mp->m_ddev_targp); in xfs_open_devices()
517 error = xfs_setsize_buftarg(mp->m_ddev_targp, mp->m_sb.sb_sectsize); in xfs_setup_devices()
521 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_setup_devices()
525 log_sector_size = mp->m_sb.sb_logsectsize; in xfs_setup_devices()
526 error = xfs_setsize_buftarg(mp->m_logdev_targp, in xfs_setup_devices()
531 if (mp->m_rtdev_targp) { in xfs_setup_devices()
532 error = xfs_setsize_buftarg(mp->m_rtdev_targp, in xfs_setup_devices()
533 mp->m_sb.sb_sectsize); in xfs_setup_devices()
545 mp->m_buf_workqueue = alloc_workqueue("xfs-buf/%s", in xfs_init_mount_workqueues()
547 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
548 if (!mp->m_buf_workqueue) in xfs_init_mount_workqueues()
551 mp->m_unwritten_workqueue = alloc_workqueue("xfs-conv/%s", in xfs_init_mount_workqueues()
553 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
554 if (!mp->m_unwritten_workqueue) in xfs_init_mount_workqueues()
557 mp->m_reclaim_workqueue = alloc_workqueue("xfs-reclaim/%s", in xfs_init_mount_workqueues()
559 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
560 if (!mp->m_reclaim_workqueue) in xfs_init_mount_workqueues()
563 mp->m_blockgc_wq = alloc_workqueue("xfs-blockgc/%s", in xfs_init_mount_workqueues()
565 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
566 if (!mp->m_blockgc_wq) in xfs_init_mount_workqueues()
569 mp->m_inodegc_wq = alloc_workqueue("xfs-inodegc/%s", in xfs_init_mount_workqueues()
571 1, mp->m_super->s_id); in xfs_init_mount_workqueues()
572 if (!mp->m_inodegc_wq) in xfs_init_mount_workqueues()
575 mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s", in xfs_init_mount_workqueues()
576 XFS_WQFLAGS(WQ_FREEZABLE), 0, mp->m_super->s_id); in xfs_init_mount_workqueues()
577 if (!mp->m_sync_workqueue) in xfs_init_mount_workqueues()
583 destroy_workqueue(mp->m_inodegc_wq); in xfs_init_mount_workqueues()
585 destroy_workqueue(mp->m_blockgc_wq); in xfs_init_mount_workqueues()
587 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_init_mount_workqueues()
589 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_init_mount_workqueues()
591 destroy_workqueue(mp->m_buf_workqueue); in xfs_init_mount_workqueues()
593 return -ENOMEM; in xfs_init_mount_workqueues()
600 destroy_workqueue(mp->m_sync_workqueue); in xfs_destroy_mount_workqueues()
601 destroy_workqueue(mp->m_blockgc_wq); in xfs_destroy_mount_workqueues()
602 destroy_workqueue(mp->m_inodegc_wq); in xfs_destroy_mount_workqueues()
603 destroy_workqueue(mp->m_reclaim_workqueue); in xfs_destroy_mount_workqueues()
604 destroy_workqueue(mp->m_unwritten_workqueue); in xfs_destroy_mount_workqueues()
605 destroy_workqueue(mp->m_buf_workqueue); in xfs_destroy_mount_workqueues()
614 struct super_block *sb = mp->m_super; in xfs_flush_inodes_worker()
616 if (down_read_trylock(&sb->s_umount)) { in xfs_flush_inodes_worker()
618 up_read(&sb->s_umount); in xfs_flush_inodes_worker()
636 if (flush_work(&mp->m_flush_inodes_work)) in xfs_flush_inodes()
639 queue_work(mp->m_sync_workqueue, &mp->m_flush_inodes_work); in xfs_flush_inodes()
640 flush_work(&mp->m_flush_inodes_work); in xfs_flush_inodes()
664 ASSERT(!rwsem_is_locked(&inode->i_rwsem)); in xfs_fs_destroy_inode()
665 XFS_STATS_INC(ip->i_mount, vn_rele); in xfs_fs_destroy_inode()
666 XFS_STATS_INC(ip->i_mount, vn_remove); in xfs_fs_destroy_inode()
676 struct xfs_mount *mp = ip->i_mount; in xfs_fs_dirty_inode()
679 if (!(inode->i_sb->s_flags & SB_LAZYTIME)) in xfs_fs_dirty_inode()
690 if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) in xfs_fs_dirty_inode()
718 atomic_set(&ip->i_pincount, 0); in xfs_fs_inode_init_once()
719 spin_lock_init(&ip->i_flags_lock); in xfs_fs_inode_init_once()
721 mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER, in xfs_fs_inode_init_once()
722 "xfsino", ip->i_ino); in xfs_fs_inode_init_once()
727 * serialised against cache hits here via the inode->i_lock and igrab() in
743 if (ip->i_flags & XFS_IRECOVERY) { in xfs_fs_drop_inode()
744 ASSERT(xlog_recovery_needed(ip->i_mount->m_log)); in xfs_fs_drop_inode()
757 * of sb->s_umount, which is held around the call to ->put_super. in xfs_mount_free()
759 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) in xfs_mount_free()
760 xfs_free_buftarg(mp->m_logdev_targp); in xfs_mount_free()
761 if (mp->m_rtdev_targp) in xfs_mount_free()
762 xfs_free_buftarg(mp->m_rtdev_targp); in xfs_mount_free()
763 if (mp->m_ddev_targp) in xfs_mount_free()
764 xfs_free_buftarg(mp->m_ddev_targp); in xfs_mount_free()
766 debugfs_remove(mp->m_debugfs); in xfs_mount_free()
767 kfree(mp->m_rtname); in xfs_mount_free()
768 kfree(mp->m_logname); in xfs_mount_free()
798 flush_delayed_work(&mp->m_log->l_work); in xfs_fs_sync_fs()
811 * freeze that does this - we can run this multiple times without issue in xfs_fs_sync_fs()
815 if (sb->s_writers.frozen == SB_FREEZE_PAGEFAULT) { in xfs_fs_sync_fs()
828 struct xfs_mount *mp = XFS_M(dentry->d_sb); in xfs_fs_statfs()
829 xfs_sb_t *sbp = &mp->m_sb; in xfs_fs_statfs()
844 statp->f_type = XFS_SUPER_MAGIC; in xfs_fs_statfs()
845 statp->f_namelen = MAXNAMELEN - 1; in xfs_fs_statfs()
847 id = huge_encode_dev(mp->m_ddev_targp->bt_dev); in xfs_fs_statfs()
848 statp->f_fsid = u64_to_fsid(id); in xfs_fs_statfs()
850 icount = percpu_counter_sum(&mp->m_icount); in xfs_fs_statfs()
851 ifree = percpu_counter_sum(&mp->m_ifree); in xfs_fs_statfs()
852 fdblocks = percpu_counter_sum(&mp->m_fdblocks); in xfs_fs_statfs()
854 spin_lock(&mp->m_sb_lock); in xfs_fs_statfs()
855 statp->f_bsize = sbp->sb_blocksize; in xfs_fs_statfs()
856 lsize = sbp->sb_logstart ? sbp->sb_logblocks : 0; in xfs_fs_statfs()
857 statp->f_blocks = sbp->sb_dblocks - lsize; in xfs_fs_statfs()
858 spin_unlock(&mp->m_sb_lock); in xfs_fs_statfs()
860 /* make sure statp->f_bfree does not underflow */ in xfs_fs_statfs()
861 statp->f_bfree = max_t(int64_t, 0, in xfs_fs_statfs()
862 fdblocks - xfs_fdblocks_unavailable(mp)); in xfs_fs_statfs()
863 statp->f_bavail = statp->f_bfree; in xfs_fs_statfs()
865 fakeinos = XFS_FSB_TO_INO(mp, statp->f_bfree); in xfs_fs_statfs()
866 statp->f_files = min(icount + fakeinos, (uint64_t)XFS_MAXINUMBER); in xfs_fs_statfs()
867 if (M_IGEO(mp)->maxicount) in xfs_fs_statfs()
868 statp->f_files = min_t(typeof(statp->f_files), in xfs_fs_statfs()
869 statp->f_files, in xfs_fs_statfs()
870 M_IGEO(mp)->maxicount); in xfs_fs_statfs()
873 statp->f_files = max_t(typeof(statp->f_files), in xfs_fs_statfs()
874 statp->f_files, in xfs_fs_statfs()
875 sbp->sb_icount); in xfs_fs_statfs()
877 /* make sure statp->f_ffree does not underflow */ in xfs_fs_statfs()
878 ffree = statp->f_files - (icount - ifree); in xfs_fs_statfs()
879 statp->f_ffree = max_t(int64_t, ffree, 0); in xfs_fs_statfs()
882 (ip->i_diflags & (XFS_DIFLAG_RTINHERIT | XFS_DIFLAG_REALTIME))) { in xfs_fs_statfs()
885 statp->f_blocks = sbp->sb_rblocks; in xfs_fs_statfs()
886 freertx = percpu_counter_sum_positive(&mp->m_frextents); in xfs_fs_statfs()
887 statp->f_bavail = statp->f_bfree = freertx * sbp->sb_rextsize; in xfs_fs_statfs()
890 if ((ip->i_diflags & XFS_DIFLAG_PROJINHERIT) && in xfs_fs_statfs()
891 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
903 mp->m_resblks_save = mp->m_resblks; in xfs_save_resvblks()
912 if (mp->m_resblks_save) { in xfs_restore_resvblks()
913 resblks = mp->m_resblks_save; in xfs_restore_resvblks()
914 mp->m_resblks_save = 0; in xfs_restore_resvblks()
946 * For read-write filesystems, we need to restart the inodegc on error in xfs_fs_freeze()
993 if (mp->m_logbsize <= 0 && in xfs_finish_flags()
994 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
995 mp->m_logbsize = mp->m_sb.sb_logsunit; in xfs_finish_flags()
996 } else if (mp->m_logbsize > 0 && in xfs_finish_flags()
997 mp->m_logbsize < mp->m_sb.sb_logsunit) { in xfs_finish_flags()
1000 return -EINVAL; in xfs_finish_flags()
1004 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
1007 return -EINVAL; in xfs_finish_flags()
1017 return -EINVAL; in xfs_finish_flags()
1021 * prohibit r/w mounts of read-only filesystems in xfs_finish_flags()
1023 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
1025 "cannot mount a read-only filesystem as read-write"); in xfs_finish_flags()
1026 return -EROFS; in xfs_finish_flags()
1029 if ((mp->m_qflags & XFS_GQUOTA_ACCT) && in xfs_finish_flags()
1030 (mp->m_qflags & XFS_PQUOTA_ACCT) && in xfs_finish_flags()
1034 return -EINVAL; in xfs_finish_flags()
1046 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1048 return -ENOMEM; in xfs_init_percpu_counters()
1050 error = percpu_counter_init(&mp->m_ifree, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1054 error = percpu_counter_init(&mp->m_fdblocks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1058 error = percpu_counter_init(&mp->m_delalloc_blks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1062 error = percpu_counter_init(&mp->m_frextents, 0, GFP_KERNEL); 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_blks) == 0); in xfs_destroy_percpu_counters()
1098 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_destroy_percpu_counters()
1099 percpu_counter_destroy(&mp->m_frextents); in xfs_destroy_percpu_counters()
1109 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1110 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1111 return -ENOMEM; in xfs_inodegc_init_percpu()
1114 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1115 gc->cpu = cpu; in xfs_inodegc_init_percpu()
1116 gc->mp = mp; in xfs_inodegc_init_percpu()
1117 init_llist_head(&gc->list); in xfs_inodegc_init_percpu()
1118 gc->items = 0; in xfs_inodegc_init_percpu()
1119 gc->error = 0; in xfs_inodegc_init_percpu()
1120 INIT_DELAYED_WORK(&gc->work, xfs_inodegc_worker); in xfs_inodegc_init_percpu()
1129 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1131 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1140 xfs_notice(mp, "Unmounting Filesystem %pU", &mp->m_sb.sb_uuid); in xfs_fs_put_super()
1146 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1156 struct shrink_control *sc) in xfs_fs_nr_cached_objects() argument
1159 if (WARN_ON_ONCE(!sb->s_fs_info)) in xfs_fs_nr_cached_objects()
1167 struct shrink_control *sc) in xfs_fs_free_cached_objects() argument
1169 return xfs_reclaim_inodes_nr(XFS_M(sb), sc->nr_to_scan); in xfs_fs_free_cached_objects()
1207 return -ENOMEM; in suffix_kstrtoint()
1209 last = strlen(value) - 1; in suffix_kstrtoint()
1224 ret = -EINVAL; in suffix_kstrtoint()
1240 if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) && in xfs_fs_warn_deprecated()
1241 !!(XFS_M(fc->root->d_sb)->m_features & flag) == value) in xfs_fs_warn_deprecated()
1243 xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key); in xfs_fs_warn_deprecated()
1249 * NOTE: mp->m_super is NULL here!
1256 struct xfs_mount *parsing_mp = fc->s_fs_info; in xfs_fs_parse_param()
1267 parsing_mp->m_logbufs = result.uint_32; in xfs_fs_parse_param()
1270 if (suffix_kstrtoint(param->string, 10, &parsing_mp->m_logbsize)) in xfs_fs_parse_param()
1271 return -EINVAL; in xfs_fs_parse_param()
1274 kfree(parsing_mp->m_logname); in xfs_fs_parse_param()
1275 parsing_mp->m_logname = kstrdup(param->string, GFP_KERNEL); in xfs_fs_parse_param()
1276 if (!parsing_mp->m_logname) in xfs_fs_parse_param()
1277 return -ENOMEM; in xfs_fs_parse_param()
1280 kfree(parsing_mp->m_rtname); in xfs_fs_parse_param()
1281 parsing_mp->m_rtname = kstrdup(param->string, GFP_KERNEL); in xfs_fs_parse_param()
1282 if (!parsing_mp->m_rtname) in xfs_fs_parse_param()
1283 return -ENOMEM; in xfs_fs_parse_param()
1286 if (suffix_kstrtoint(param->string, 10, &size)) in xfs_fs_parse_param()
1287 return -EINVAL; in xfs_fs_parse_param()
1288 parsing_mp->m_allocsize_log = ffs(size) - 1; in xfs_fs_parse_param()
1289 parsing_mp->m_features |= XFS_FEAT_ALLOCSIZE; in xfs_fs_parse_param()
1293 parsing_mp->m_features |= XFS_FEAT_GRPID; in xfs_fs_parse_param()
1297 parsing_mp->m_features &= ~XFS_FEAT_GRPID; in xfs_fs_parse_param()
1300 parsing_mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_parse_param()
1303 parsing_mp->m_features |= XFS_FEAT_NORECOVERY; in xfs_fs_parse_param()
1306 parsing_mp->m_features |= XFS_FEAT_NOALIGN; in xfs_fs_parse_param()
1309 parsing_mp->m_features |= XFS_FEAT_SWALLOC; in xfs_fs_parse_param()
1312 parsing_mp->m_dalign = result.uint_32; in xfs_fs_parse_param()
1315 parsing_mp->m_swidth = result.uint_32; in xfs_fs_parse_param()
1318 parsing_mp->m_features |= XFS_FEAT_SMALL_INUMS; 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_NOUUID; in xfs_fs_parse_param()
1327 parsing_mp->m_features |= XFS_FEAT_LARGE_IOSIZE; 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_FILESTREAMS; in xfs_fs_parse_param()
1336 parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT; in xfs_fs_parse_param()
1337 parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD; in xfs_fs_parse_param()
1342 parsing_mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ENFD); in xfs_fs_parse_param()
1346 parsing_mp->m_qflags |= XFS_UQUOTA_ACCT; in xfs_fs_parse_param()
1347 parsing_mp->m_qflags &= ~XFS_UQUOTA_ENFD; in xfs_fs_parse_param()
1351 parsing_mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ENFD); in xfs_fs_parse_param()
1354 parsing_mp->m_qflags |= XFS_PQUOTA_ACCT; in xfs_fs_parse_param()
1355 parsing_mp->m_qflags &= ~XFS_PQUOTA_ENFD; in xfs_fs_parse_param()
1359 parsing_mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ENFD); in xfs_fs_parse_param()
1362 parsing_mp->m_qflags |= XFS_GQUOTA_ACCT; in xfs_fs_parse_param()
1363 parsing_mp->m_qflags &= ~XFS_GQUOTA_ENFD; in xfs_fs_parse_param()
1366 parsing_mp->m_features |= XFS_FEAT_DISCARD; in xfs_fs_parse_param()
1369 parsing_mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_parse_param()
1382 parsing_mp->m_features |= XFS_FEAT_IKEEP; in xfs_fs_parse_param()
1386 parsing_mp->m_features &= ~XFS_FEAT_IKEEP; in xfs_fs_parse_param()
1390 parsing_mp->m_features |= XFS_FEAT_ATTR2; in xfs_fs_parse_param()
1394 parsing_mp->m_features |= XFS_FEAT_NOATTR2; in xfs_fs_parse_param()
1397 xfs_warn(parsing_mp, "unknown mount option [%s].", param->key); in xfs_fs_parse_param()
1398 return -EINVAL; in xfs_fs_parse_param()
1408 /* No recovery flag requires a read-only mount */ in xfs_fs_validate_params()
1410 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1411 return -EINVAL; in xfs_fs_validate_params()
1420 return -EINVAL; in xfs_fs_validate_params()
1424 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1427 return -EINVAL; in xfs_fs_validate_params()
1430 if (!IS_ENABLED(CONFIG_XFS_QUOTA) && mp->m_qflags != 0) { in xfs_fs_validate_params()
1432 return -EINVAL; in xfs_fs_validate_params()
1435 if ((mp->m_dalign && !mp->m_swidth) || in xfs_fs_validate_params()
1436 (!mp->m_dalign && mp->m_swidth)) { in xfs_fs_validate_params()
1438 return -EINVAL; in xfs_fs_validate_params()
1441 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1444 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1445 return -EINVAL; in xfs_fs_validate_params()
1448 if (mp->m_logbufs != -1 && in xfs_fs_validate_params()
1449 mp->m_logbufs != 0 && in xfs_fs_validate_params()
1450 (mp->m_logbufs < XLOG_MIN_ICLOGS || in xfs_fs_validate_params()
1451 mp->m_logbufs > XLOG_MAX_ICLOGS)) { in xfs_fs_validate_params()
1452 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", in xfs_fs_validate_params()
1453 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); in xfs_fs_validate_params()
1454 return -EINVAL; in xfs_fs_validate_params()
1457 if (mp->m_logbsize != -1 && in xfs_fs_validate_params()
1458 mp->m_logbsize != 0 && in xfs_fs_validate_params()
1459 (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE || in xfs_fs_validate_params()
1460 mp->m_logbsize > XLOG_MAX_RECORD_BSIZE || in xfs_fs_validate_params()
1461 !is_power_of_2(mp->m_logbsize))) { in xfs_fs_validate_params()
1464 mp->m_logbsize); in xfs_fs_validate_params()
1465 return -EINVAL; in xfs_fs_validate_params()
1469 (mp->m_allocsize_log > XFS_MAX_IO_LOG || in xfs_fs_validate_params()
1470 mp->m_allocsize_log < XFS_MIN_IO_LOG)) { in xfs_fs_validate_params()
1471 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", in xfs_fs_validate_params()
1472 mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG); in xfs_fs_validate_params()
1473 return -EINVAL; in xfs_fs_validate_params()
1499 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super()
1503 mp->m_super = sb; in xfs_fs_fill_super()
1510 if (fc->sb_flags & SB_RDONLY) in xfs_fs_fill_super()
1511 set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_fs_fill_super()
1512 if (fc->sb_flags & SB_DIRSYNC) in xfs_fs_fill_super()
1513 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_fs_fill_super()
1514 if (fc->sb_flags & SB_SYNCHRONOUS) in xfs_fs_fill_super()
1515 mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_fill_super()
1522 sb->s_xattr = xfs_xattr_handlers; in xfs_fs_fill_super()
1523 sb->s_export_op = &xfs_export_operations; in xfs_fs_fill_super()
1525 sb->s_qcop = &xfs_quotactl_operations; in xfs_fs_fill_super()
1526 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ; in xfs_fs_fill_super()
1528 sb->s_op = &xfs_super_operations; in xfs_fs_fill_super()
1541 if (fc->sb_flags & SB_SILENT) in xfs_fs_fill_super()
1549 mp->m_debugfs = xfs_debugfs_mkdir(mp->m_super->s_id, in xfs_fs_fill_super()
1552 mp->m_debugfs = NULL; in xfs_fs_fill_super()
1568 mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); in xfs_fs_fill_super()
1569 if (!mp->m_stats.xs_stats) { in xfs_fs_fill_super()
1570 error = -ENOMEM; in xfs_fs_fill_super()
1598 error = -EINVAL; in xfs_fs_fill_super()
1607 …"Deprecated ASCII case-insensitivity feature (ascii-ci=1) will not be supported after September 20… in xfs_fs_fill_super()
1610 "Deprecated ASCII case-insensitivity feature (ascii-ci=1) not supported by kernel."); in xfs_fs_fill_super()
1611 error = -EINVAL; in xfs_fs_fill_super()
1619 error = -EFSCORRUPTED; in xfs_fs_fill_super()
1628 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1630 error = -EFSCORRUPTED; in xfs_fs_fill_super()
1635 * Until this is fixed only page-sized or smaller data blocks work. in xfs_fs_fill_super()
1637 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1641 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1642 error = -ENOSYS; in xfs_fs_fill_super()
1647 if (xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_dblocks) || in xfs_fs_fill_super()
1648 xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_rblocks)) { in xfs_fs_fill_super()
1651 error = -EFBIG; in xfs_fs_fill_super()
1658 * supports (currently 2^63 bytes on 64-bit and ULONG_MAX << PAGE_SHIFT in xfs_fs_fill_super()
1659 * bytes on 32-bit), but as XFS and VFS have gotten the s_maxbytes in xfs_fs_fill_super()
1660 * calculation wrong on 32-bit kernels in the past, we'll add a WARN_ON in xfs_fs_fill_super()
1671 error = -EINVAL; in xfs_fs_fill_super()
1683 sb->s_magic = XFS_SUPER_MAGIC; in xfs_fs_fill_super()
1684 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1685 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1; in xfs_fs_fill_super()
1686 sb->s_maxbytes = MAX_LFS_FILESIZE; in xfs_fs_fill_super()
1687 sb->s_max_links = XFS_MAXLINK; in xfs_fs_fill_super()
1688 sb->s_time_gran = 1; in xfs_fs_fill_super()
1690 sb->s_time_min = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MIN); in xfs_fs_fill_super()
1691 sb->s_time_max = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MAX); in xfs_fs_fill_super()
1693 sb->s_time_min = XFS_LEGACY_TIME_MIN; in xfs_fs_fill_super()
1694 sb->s_time_max = XFS_LEGACY_TIME_MAX; in xfs_fs_fill_super()
1696 trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max); in xfs_fs_fill_super()
1697 sb->s_iflags |= SB_I_CGROUPWB; in xfs_fs_fill_super()
1703 sb->s_flags |= SB_I_VERSION; in xfs_fs_fill_super()
1711 if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { in xfs_fs_fill_super()
1714 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1718 if (mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1721 error = -EINVAL; in xfs_fs_fill_super()
1726 xfs_info(mp, "using DEBUG-only always_cow mode."); in xfs_fs_fill_super()
1727 mp->m_always_cow = true; in xfs_fs_fill_super()
1731 if (xfs_has_rmapbt(mp) && mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1734 error = -EINVAL; in xfs_fs_fill_super()
1742 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1744 error = -ENOENT; in xfs_fs_fill_super()
1747 sb->s_root = d_make_root(root); in xfs_fs_fill_super()
1748 if (!sb->s_root) { in xfs_fs_fill_super()
1749 error = -ENOMEM; in xfs_fs_fill_super()
1762 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1790 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
1795 "ro->rw transition prohibited on norecovery mount"); in xfs_remount_rw()
1796 return -EINVAL; in xfs_remount_rw()
1802 "ro->rw transition prohibited on unknown (0x%x) ro-compat filesystem", in xfs_remount_rw()
1803 (sbp->sb_features_ro_compat & in xfs_remount_rw()
1805 return -EINVAL; in xfs_remount_rw()
1808 clear_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_remount_rw()
1814 if (mp->m_update_sb) { in xfs_remount_rw()
1820 mp->m_update_sb = false; in xfs_remount_rw()
1825 * it is non-zero, otherwise go with the default. in xfs_remount_rw()
1831 /* Create the per-AG metadata reservation pool .*/ in xfs_remount_rw()
1833 if (error && error != -ENOSPC) in xfs_remount_rw()
1836 /* Re-enable the background inode inactivation worker. */ in xfs_remount_rw()
1852 error = sync_filesystem(mp->m_super); in xfs_remount_ro()
1863 * Clear out all remaining COW staging extents and speculative post-EOF in xfs_remount_ro()
1865 * cleanups during reclaim on a read-only mount. We must process every in xfs_remount_ro()
1883 /* Free the per-AG metadata reservation pool. */ in xfs_remount_ro()
1900 set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_remount_ro()
1921 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure()
1922 struct xfs_mount *new_mp = fc->s_fs_info; in xfs_fs_reconfigure()
1923 int flags = fc->sb_flags; in xfs_fs_reconfigure()
1928 fc->sb_flags |= SB_I_VERSION; in xfs_fs_reconfigure()
1934 /* inode32 -> inode64 */ in xfs_fs_reconfigure()
1936 mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1937 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1940 /* inode64 -> inode32 */ in xfs_fs_reconfigure()
1942 mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1943 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1946 /* ro -> rw */ in xfs_fs_reconfigure()
1953 /* rw -> ro */ in xfs_fs_reconfigure()
1967 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free()
1998 return -ENOMEM; in xfs_init_fs_context()
2000 spin_lock_init(&mp->m_sb_lock); in xfs_init_fs_context()
2001 INIT_RADIX_TREE(&mp->m_perag_tree, GFP_ATOMIC); in xfs_init_fs_context()
2002 spin_lock_init(&mp->m_perag_lock); in xfs_init_fs_context()
2003 mutex_init(&mp->m_growlock); in xfs_init_fs_context()
2004 INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); in xfs_init_fs_context()
2005 INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); in xfs_init_fs_context()
2006 mp->m_kobj.kobject.kset = xfs_kset; in xfs_init_fs_context()
2008 * We don't create the finobt per-ag space reservation until after log in xfs_init_fs_context()
2013 mp->m_finobt_nores = true; in xfs_init_fs_context()
2018 mp->m_logbufs = -1; in xfs_init_fs_context()
2019 mp->m_logbsize = -1; in xfs_init_fs_context()
2020 mp->m_allocsize_log = 16; /* 64k */ in xfs_init_fs_context()
2022 fc->s_fs_info = mp; in xfs_init_fs_context()
2023 fc->ops = &xfs_context_ops; in xfs_init_fs_context()
2093 * The size of the cache-allocated buf log item is the maximum in xfs_init_caches()
2236 return -ENOMEM; in xfs_init_caches()
2283 return -ENOMEM; in xfs_init_workqueues()
2293 return -ENOMEM; in xfs_init_workqueues()
2343 error = -ENOMEM; in init_xfs_fs()
2351 error = -ENOMEM; in init_xfs_fs()