• 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 if ((ip->i_diflags & XFS_DIFLAG_PROJINHERIT) && in xfs_fs_statfs()
883 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) == in xfs_fs_statfs()
888 (ip->i_diflags & (XFS_DIFLAG_RTINHERIT | XFS_DIFLAG_REALTIME))) { in xfs_fs_statfs()
891 statp->f_blocks = sbp->sb_rblocks; in xfs_fs_statfs()
892 freertx = percpu_counter_sum_positive(&mp->m_frextents); in xfs_fs_statfs()
893 statp->f_bavail = statp->f_bfree = freertx * sbp->sb_rextsize; in xfs_fs_statfs()
904 mp->m_resblks_save = mp->m_resblks; in xfs_save_resvblks()
913 if (mp->m_resblks_save) { in xfs_restore_resvblks()
914 resblks = mp->m_resblks_save; in xfs_restore_resvblks()
915 mp->m_resblks_save = 0; in xfs_restore_resvblks()
947 * For read-write filesystems, we need to restart the inodegc on error in xfs_fs_freeze()
994 if (mp->m_logbsize <= 0 && in xfs_finish_flags()
995 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
996 mp->m_logbsize = mp->m_sb.sb_logsunit; in xfs_finish_flags()
997 } else if (mp->m_logbsize > 0 && in xfs_finish_flags()
998 mp->m_logbsize < mp->m_sb.sb_logsunit) { in xfs_finish_flags()
1001 return -EINVAL; in xfs_finish_flags()
1005 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { in xfs_finish_flags()
1008 return -EINVAL; in xfs_finish_flags()
1018 return -EINVAL; in xfs_finish_flags()
1022 * prohibit r/w mounts of read-only filesystems in xfs_finish_flags()
1024 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !xfs_is_readonly(mp)) { in xfs_finish_flags()
1026 "cannot mount a read-only filesystem as read-write"); in xfs_finish_flags()
1027 return -EROFS; in xfs_finish_flags()
1030 if ((mp->m_qflags & XFS_GQUOTA_ACCT) && in xfs_finish_flags()
1031 (mp->m_qflags & XFS_PQUOTA_ACCT) && in xfs_finish_flags()
1035 return -EINVAL; in xfs_finish_flags()
1047 error = percpu_counter_init(&mp->m_icount, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1049 return -ENOMEM; in xfs_init_percpu_counters()
1051 error = percpu_counter_init(&mp->m_ifree, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1055 error = percpu_counter_init(&mp->m_fdblocks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1059 error = percpu_counter_init(&mp->m_delalloc_blks, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1063 error = percpu_counter_init(&mp->m_frextents, 0, GFP_KERNEL); in xfs_init_percpu_counters()
1070 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_init_percpu_counters()
1072 percpu_counter_destroy(&mp->m_fdblocks); in xfs_init_percpu_counters()
1074 percpu_counter_destroy(&mp->m_ifree); in xfs_init_percpu_counters()
1076 percpu_counter_destroy(&mp->m_icount); in xfs_init_percpu_counters()
1077 return -ENOMEM; in xfs_init_percpu_counters()
1084 percpu_counter_set(&mp->m_icount, mp->m_sb.sb_icount); in xfs_reinit_percpu_counters()
1085 percpu_counter_set(&mp->m_ifree, mp->m_sb.sb_ifree); in xfs_reinit_percpu_counters()
1086 percpu_counter_set(&mp->m_fdblocks, mp->m_sb.sb_fdblocks); in xfs_reinit_percpu_counters()
1087 percpu_counter_set(&mp->m_frextents, mp->m_sb.sb_frextents); in xfs_reinit_percpu_counters()
1094 percpu_counter_destroy(&mp->m_icount); in xfs_destroy_percpu_counters()
1095 percpu_counter_destroy(&mp->m_ifree); in xfs_destroy_percpu_counters()
1096 percpu_counter_destroy(&mp->m_fdblocks); in xfs_destroy_percpu_counters()
1098 percpu_counter_sum(&mp->m_delalloc_blks) == 0); in xfs_destroy_percpu_counters()
1099 percpu_counter_destroy(&mp->m_delalloc_blks); in xfs_destroy_percpu_counters()
1100 percpu_counter_destroy(&mp->m_frextents); in xfs_destroy_percpu_counters()
1110 mp->m_inodegc = alloc_percpu(struct xfs_inodegc); in xfs_inodegc_init_percpu()
1111 if (!mp->m_inodegc) in xfs_inodegc_init_percpu()
1112 return -ENOMEM; in xfs_inodegc_init_percpu()
1115 gc = per_cpu_ptr(mp->m_inodegc, cpu); in xfs_inodegc_init_percpu()
1116 gc->cpu = cpu; in xfs_inodegc_init_percpu()
1117 gc->mp = mp; in xfs_inodegc_init_percpu()
1118 init_llist_head(&gc->list); in xfs_inodegc_init_percpu()
1119 gc->items = 0; in xfs_inodegc_init_percpu()
1120 gc->error = 0; in xfs_inodegc_init_percpu()
1121 INIT_DELAYED_WORK(&gc->work, xfs_inodegc_worker); in xfs_inodegc_init_percpu()
1130 if (!mp->m_inodegc) in xfs_inodegc_free_percpu()
1132 free_percpu(mp->m_inodegc); in xfs_inodegc_free_percpu()
1141 xfs_notice(mp, "Unmounting Filesystem %pU", &mp->m_sb.sb_uuid); in xfs_fs_put_super()
1147 free_percpu(mp->m_stats.xs_stats); in xfs_fs_put_super()
1157 struct shrink_control *sc) in xfs_fs_nr_cached_objects() argument
1160 if (WARN_ON_ONCE(!sb->s_fs_info)) in xfs_fs_nr_cached_objects()
1168 struct shrink_control *sc) in xfs_fs_free_cached_objects() argument
1170 return xfs_reclaim_inodes_nr(XFS_M(sb), sc->nr_to_scan); in xfs_fs_free_cached_objects()
1208 return -ENOMEM; in suffix_kstrtoint()
1210 last = strlen(value) - 1; in suffix_kstrtoint()
1225 ret = -EINVAL; in suffix_kstrtoint()
1241 if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) && in xfs_fs_warn_deprecated()
1242 !!(XFS_M(fc->root->d_sb)->m_features & flag) == value) in xfs_fs_warn_deprecated()
1244 xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key); in xfs_fs_warn_deprecated()
1250 * NOTE: mp->m_super is NULL here!
1257 struct xfs_mount *parsing_mp = fc->s_fs_info; in xfs_fs_parse_param()
1268 parsing_mp->m_logbufs = result.uint_32; in xfs_fs_parse_param()
1271 if (suffix_kstrtoint(param->string, 10, &parsing_mp->m_logbsize)) in xfs_fs_parse_param()
1272 return -EINVAL; in xfs_fs_parse_param()
1275 kfree(parsing_mp->m_logname); in xfs_fs_parse_param()
1276 parsing_mp->m_logname = kstrdup(param->string, GFP_KERNEL); in xfs_fs_parse_param()
1277 if (!parsing_mp->m_logname) in xfs_fs_parse_param()
1278 return -ENOMEM; in xfs_fs_parse_param()
1281 kfree(parsing_mp->m_rtname); in xfs_fs_parse_param()
1282 parsing_mp->m_rtname = kstrdup(param->string, GFP_KERNEL); in xfs_fs_parse_param()
1283 if (!parsing_mp->m_rtname) in xfs_fs_parse_param()
1284 return -ENOMEM; in xfs_fs_parse_param()
1287 if (suffix_kstrtoint(param->string, 10, &size)) in xfs_fs_parse_param()
1288 return -EINVAL; in xfs_fs_parse_param()
1289 parsing_mp->m_allocsize_log = ffs(size) - 1; in xfs_fs_parse_param()
1290 parsing_mp->m_features |= XFS_FEAT_ALLOCSIZE; in xfs_fs_parse_param()
1294 parsing_mp->m_features |= XFS_FEAT_GRPID; in xfs_fs_parse_param()
1298 parsing_mp->m_features &= ~XFS_FEAT_GRPID; in xfs_fs_parse_param()
1301 parsing_mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_parse_param()
1304 parsing_mp->m_features |= XFS_FEAT_NORECOVERY; in xfs_fs_parse_param()
1307 parsing_mp->m_features |= XFS_FEAT_NOALIGN; in xfs_fs_parse_param()
1310 parsing_mp->m_features |= XFS_FEAT_SWALLOC; in xfs_fs_parse_param()
1313 parsing_mp->m_dalign = result.uint_32; in xfs_fs_parse_param()
1316 parsing_mp->m_swidth = result.uint_32; in xfs_fs_parse_param()
1319 parsing_mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_parse_param()
1322 parsing_mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_parse_param()
1325 parsing_mp->m_features |= XFS_FEAT_NOUUID; in xfs_fs_parse_param()
1328 parsing_mp->m_features |= XFS_FEAT_LARGE_IOSIZE; in xfs_fs_parse_param()
1331 parsing_mp->m_features &= ~XFS_FEAT_LARGE_IOSIZE; in xfs_fs_parse_param()
1334 parsing_mp->m_features |= XFS_FEAT_FILESTREAMS; in xfs_fs_parse_param()
1337 parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT; in xfs_fs_parse_param()
1338 parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD; in xfs_fs_parse_param()
1343 parsing_mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ENFD); in xfs_fs_parse_param()
1347 parsing_mp->m_qflags |= XFS_UQUOTA_ACCT; in xfs_fs_parse_param()
1348 parsing_mp->m_qflags &= ~XFS_UQUOTA_ENFD; in xfs_fs_parse_param()
1352 parsing_mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ENFD); in xfs_fs_parse_param()
1355 parsing_mp->m_qflags |= XFS_PQUOTA_ACCT; in xfs_fs_parse_param()
1356 parsing_mp->m_qflags &= ~XFS_PQUOTA_ENFD; in xfs_fs_parse_param()
1360 parsing_mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ENFD); in xfs_fs_parse_param()
1363 parsing_mp->m_qflags |= XFS_GQUOTA_ACCT; in xfs_fs_parse_param()
1364 parsing_mp->m_qflags &= ~XFS_GQUOTA_ENFD; in xfs_fs_parse_param()
1367 parsing_mp->m_features |= XFS_FEAT_DISCARD; in xfs_fs_parse_param()
1370 parsing_mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_parse_param()
1383 parsing_mp->m_features |= XFS_FEAT_IKEEP; in xfs_fs_parse_param()
1387 parsing_mp->m_features &= ~XFS_FEAT_IKEEP; in xfs_fs_parse_param()
1391 parsing_mp->m_features |= XFS_FEAT_ATTR2; in xfs_fs_parse_param()
1395 parsing_mp->m_features |= XFS_FEAT_NOATTR2; in xfs_fs_parse_param()
1398 xfs_warn(parsing_mp, "unknown mount option [%s].", param->key); in xfs_fs_parse_param()
1399 return -EINVAL; in xfs_fs_parse_param()
1409 /* No recovery flag requires a read-only mount */ in xfs_fs_validate_params()
1411 xfs_warn(mp, "no-recovery mounts must be read-only."); in xfs_fs_validate_params()
1412 return -EINVAL; in xfs_fs_validate_params()
1421 return -EINVAL; in xfs_fs_validate_params()
1425 if (xfs_has_noalign(mp) && (mp->m_dalign || mp->m_swidth)) { in xfs_fs_validate_params()
1428 return -EINVAL; in xfs_fs_validate_params()
1431 if (!IS_ENABLED(CONFIG_XFS_QUOTA) && mp->m_qflags != 0) { in xfs_fs_validate_params()
1433 return -EINVAL; in xfs_fs_validate_params()
1436 if ((mp->m_dalign && !mp->m_swidth) || in xfs_fs_validate_params()
1437 (!mp->m_dalign && mp->m_swidth)) { in xfs_fs_validate_params()
1439 return -EINVAL; in xfs_fs_validate_params()
1442 if (mp->m_dalign && (mp->m_swidth % mp->m_dalign != 0)) { in xfs_fs_validate_params()
1445 mp->m_swidth, mp->m_dalign); in xfs_fs_validate_params()
1446 return -EINVAL; in xfs_fs_validate_params()
1449 if (mp->m_logbufs != -1 && in xfs_fs_validate_params()
1450 mp->m_logbufs != 0 && in xfs_fs_validate_params()
1451 (mp->m_logbufs < XLOG_MIN_ICLOGS || in xfs_fs_validate_params()
1452 mp->m_logbufs > XLOG_MAX_ICLOGS)) { in xfs_fs_validate_params()
1453 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", in xfs_fs_validate_params()
1454 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); in xfs_fs_validate_params()
1455 return -EINVAL; in xfs_fs_validate_params()
1458 if (mp->m_logbsize != -1 && in xfs_fs_validate_params()
1459 mp->m_logbsize != 0 && in xfs_fs_validate_params()
1460 (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE || in xfs_fs_validate_params()
1461 mp->m_logbsize > XLOG_MAX_RECORD_BSIZE || in xfs_fs_validate_params()
1462 !is_power_of_2(mp->m_logbsize))) { in xfs_fs_validate_params()
1465 mp->m_logbsize); in xfs_fs_validate_params()
1466 return -EINVAL; in xfs_fs_validate_params()
1470 (mp->m_allocsize_log > XFS_MAX_IO_LOG || in xfs_fs_validate_params()
1471 mp->m_allocsize_log < XFS_MIN_IO_LOG)) { in xfs_fs_validate_params()
1472 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", in xfs_fs_validate_params()
1473 mp->m_allocsize_log, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG); in xfs_fs_validate_params()
1474 return -EINVAL; in xfs_fs_validate_params()
1500 struct xfs_mount *mp = sb->s_fs_info; in xfs_fs_fill_super()
1504 mp->m_super = sb; in xfs_fs_fill_super()
1511 if (fc->sb_flags & SB_RDONLY) in xfs_fs_fill_super()
1512 set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_fs_fill_super()
1513 if (fc->sb_flags & SB_DIRSYNC) in xfs_fs_fill_super()
1514 mp->m_features |= XFS_FEAT_DIRSYNC; in xfs_fs_fill_super()
1515 if (fc->sb_flags & SB_SYNCHRONOUS) in xfs_fs_fill_super()
1516 mp->m_features |= XFS_FEAT_WSYNC; in xfs_fs_fill_super()
1523 sb->s_xattr = xfs_xattr_handlers; in xfs_fs_fill_super()
1524 sb->s_export_op = &xfs_export_operations; in xfs_fs_fill_super()
1526 sb->s_qcop = &xfs_quotactl_operations; in xfs_fs_fill_super()
1527 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ; in xfs_fs_fill_super()
1529 sb->s_op = &xfs_super_operations; in xfs_fs_fill_super()
1542 if (fc->sb_flags & SB_SILENT) in xfs_fs_fill_super()
1550 mp->m_debugfs = xfs_debugfs_mkdir(mp->m_super->s_id, in xfs_fs_fill_super()
1553 mp->m_debugfs = NULL; in xfs_fs_fill_super()
1569 mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); in xfs_fs_fill_super()
1570 if (!mp->m_stats.xs_stats) { in xfs_fs_fill_super()
1571 error = -ENOMEM; in xfs_fs_fill_super()
1599 error = -EINVAL; in xfs_fs_fill_super()
1608 …"Deprecated ASCII case-insensitivity feature (ascii-ci=1) will not be supported after September 20… in xfs_fs_fill_super()
1611 "Deprecated ASCII case-insensitivity feature (ascii-ci=1) not supported by kernel."); in xfs_fs_fill_super()
1612 error = -EINVAL; in xfs_fs_fill_super()
1620 error = -EFSCORRUPTED; in xfs_fs_fill_super()
1629 if (mp->m_sb.sb_inprogress) { in xfs_fs_fill_super()
1631 error = -EFSCORRUPTED; in xfs_fs_fill_super()
1636 * Until this is fixed only page-sized or smaller data blocks work. in xfs_fs_fill_super()
1638 if (mp->m_sb.sb_blocksize > PAGE_SIZE) { in xfs_fs_fill_super()
1642 mp->m_sb.sb_blocksize, PAGE_SIZE); in xfs_fs_fill_super()
1643 error = -ENOSYS; in xfs_fs_fill_super()
1648 if (xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_dblocks) || in xfs_fs_fill_super()
1649 xfs_sb_validate_fsb_count(&mp->m_sb, mp->m_sb.sb_rblocks)) { in xfs_fs_fill_super()
1652 error = -EFBIG; in xfs_fs_fill_super()
1659 * supports (currently 2^63 bytes on 64-bit and ULONG_MAX << PAGE_SHIFT in xfs_fs_fill_super()
1660 * bytes on 32-bit), but as XFS and VFS have gotten the s_maxbytes in xfs_fs_fill_super()
1661 * calculation wrong on 32-bit kernels in the past, we'll add a WARN_ON in xfs_fs_fill_super()
1672 error = -EINVAL; in xfs_fs_fill_super()
1684 sb->s_magic = XFS_SUPER_MAGIC; in xfs_fs_fill_super()
1685 sb->s_blocksize = mp->m_sb.sb_blocksize; in xfs_fs_fill_super()
1686 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1; in xfs_fs_fill_super()
1687 sb->s_maxbytes = MAX_LFS_FILESIZE; in xfs_fs_fill_super()
1688 sb->s_max_links = XFS_MAXLINK; in xfs_fs_fill_super()
1689 sb->s_time_gran = 1; in xfs_fs_fill_super()
1691 sb->s_time_min = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MIN); in xfs_fs_fill_super()
1692 sb->s_time_max = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MAX); in xfs_fs_fill_super()
1694 sb->s_time_min = XFS_LEGACY_TIME_MIN; in xfs_fs_fill_super()
1695 sb->s_time_max = XFS_LEGACY_TIME_MAX; in xfs_fs_fill_super()
1697 trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max); in xfs_fs_fill_super()
1698 sb->s_iflags |= SB_I_CGROUPWB; in xfs_fs_fill_super()
1704 sb->s_flags |= SB_I_VERSION; in xfs_fs_fill_super()
1712 if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { in xfs_fs_fill_super()
1715 mp->m_features &= ~XFS_FEAT_DISCARD; in xfs_fs_fill_super()
1719 if (mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1722 error = -EINVAL; in xfs_fs_fill_super()
1727 xfs_info(mp, "using DEBUG-only always_cow mode."); in xfs_fs_fill_super()
1728 mp->m_always_cow = true; in xfs_fs_fill_super()
1732 if (xfs_has_rmapbt(mp) && mp->m_sb.sb_rblocks) { in xfs_fs_fill_super()
1735 error = -EINVAL; in xfs_fs_fill_super()
1743 root = igrab(VFS_I(mp->m_rootip)); in xfs_fs_fill_super()
1745 error = -ENOENT; in xfs_fs_fill_super()
1748 sb->s_root = d_make_root(root); in xfs_fs_fill_super()
1749 if (!sb->s_root) { in xfs_fs_fill_super()
1750 error = -ENOMEM; in xfs_fs_fill_super()
1763 free_percpu(mp->m_stats.xs_stats); in xfs_fs_fill_super()
1791 struct xfs_sb *sbp = &mp->m_sb; in xfs_remount_rw()
1796 "ro->rw transition prohibited on norecovery mount"); in xfs_remount_rw()
1797 return -EINVAL; in xfs_remount_rw()
1803 "ro->rw transition prohibited on unknown (0x%x) ro-compat filesystem", in xfs_remount_rw()
1804 (sbp->sb_features_ro_compat & in xfs_remount_rw()
1806 return -EINVAL; in xfs_remount_rw()
1809 clear_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_remount_rw()
1815 if (mp->m_update_sb) { in xfs_remount_rw()
1821 mp->m_update_sb = false; in xfs_remount_rw()
1826 * it is non-zero, otherwise go with the default. in xfs_remount_rw()
1832 /* Create the per-AG metadata reservation pool .*/ in xfs_remount_rw()
1834 if (error && error != -ENOSPC) in xfs_remount_rw()
1837 /* Re-enable the background inode inactivation worker. */ in xfs_remount_rw()
1853 error = sync_filesystem(mp->m_super); in xfs_remount_ro()
1864 * Clear out all remaining COW staging extents and speculative post-EOF in xfs_remount_ro()
1866 * cleanups during reclaim on a read-only mount. We must process every in xfs_remount_ro()
1884 /* Free the per-AG metadata reservation pool. */ in xfs_remount_ro()
1901 set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); in xfs_remount_ro()
1922 struct xfs_mount *mp = XFS_M(fc->root->d_sb); in xfs_fs_reconfigure()
1923 struct xfs_mount *new_mp = fc->s_fs_info; in xfs_fs_reconfigure()
1924 int flags = fc->sb_flags; in xfs_fs_reconfigure()
1929 fc->sb_flags |= SB_I_VERSION; in xfs_fs_reconfigure()
1935 /* inode32 -> inode64 */ in xfs_fs_reconfigure()
1937 mp->m_features &= ~XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1938 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1941 /* inode64 -> inode32 */ in xfs_fs_reconfigure()
1943 mp->m_features |= XFS_FEAT_SMALL_INUMS; in xfs_fs_reconfigure()
1944 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); in xfs_fs_reconfigure()
1947 /* ro -> rw */ in xfs_fs_reconfigure()
1954 /* rw -> ro */ in xfs_fs_reconfigure()
1968 struct xfs_mount *mp = fc->s_fs_info; in xfs_fs_free()
1999 return -ENOMEM; in xfs_init_fs_context()
2001 spin_lock_init(&mp->m_sb_lock); in xfs_init_fs_context()
2002 INIT_RADIX_TREE(&mp->m_perag_tree, GFP_ATOMIC); in xfs_init_fs_context()
2003 spin_lock_init(&mp->m_perag_lock); in xfs_init_fs_context()
2004 mutex_init(&mp->m_growlock); in xfs_init_fs_context()
2005 INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); in xfs_init_fs_context()
2006 INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); in xfs_init_fs_context()
2007 mp->m_kobj.kobject.kset = xfs_kset; in xfs_init_fs_context()
2009 * We don't create the finobt per-ag space reservation until after log in xfs_init_fs_context()
2014 mp->m_finobt_nores = true; in xfs_init_fs_context()
2019 mp->m_logbufs = -1; in xfs_init_fs_context()
2020 mp->m_logbsize = -1; in xfs_init_fs_context()
2021 mp->m_allocsize_log = 16; /* 64k */ in xfs_init_fs_context()
2023 fc->s_fs_info = mp; in xfs_init_fs_context()
2024 fc->ops = &xfs_context_ops; in xfs_init_fs_context()
2094 * The size of the cache-allocated buf log item is the maximum in xfs_init_caches()
2237 return -ENOMEM; in xfs_init_caches()
2284 return -ENOMEM; in xfs_init_workqueues()
2294 return -ENOMEM; in xfs_init_workqueues()
2344 error = -ENOMEM; in init_xfs_fs()
2352 error = -ENOMEM; in init_xfs_fs()