• Home
  • Raw
  • Download

Lines Matching full:sb

68 static void ext4_update_super(struct super_block *sb);
69 static int ext4_commit_super(struct super_block *sb);
70 static int ext4_mark_recovery_complete(struct super_block *sb,
72 static int ext4_clear_journal_err(struct super_block *sb,
74 static int ext4_sync_fs(struct super_block *sb, int wait);
75 static int ext4_remount(struct super_block *sb, int *flags, char *data);
77 static int ext4_unfreeze(struct super_block *sb);
78 static int ext4_freeze(struct super_block *sb);
81 static inline int ext2_feature_set_ok(struct super_block *sb);
82 static inline int ext3_feature_set_ok(struct super_block *sb);
83 static int ext4_feature_set_ok(struct super_block *sb, int readonly);
85 static void ext4_unregister_li_request(struct super_block *sb);
87 static struct inode *ext4_get_journal_inode(struct super_block *sb,
128 #define IS_EXT2_SB(sb) ((sb)->s_bdev->bd_holder == &ext2_fs_type) argument
130 #define IS_EXT2_SB(sb) (0) argument
143 #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) argument
206 static struct buffer_head *__ext4_sb_bread_gfp(struct super_block *sb, in __ext4_sb_bread_gfp() argument
213 bh = sb_getblk_gfp(sb, block, gfp); in __ext4_sb_bread_gfp()
227 struct buffer_head *ext4_sb_bread(struct super_block *sb, sector_t block, in ext4_sb_bread() argument
230 return __ext4_sb_bread_gfp(sb, block, op_flags, __GFP_MOVABLE); in ext4_sb_bread()
233 struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb, in ext4_sb_bread_unmovable() argument
236 return __ext4_sb_bread_gfp(sb, block, 0, 0); in ext4_sb_bread_unmovable()
239 void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block) in ext4_sb_breadahead_unmovable() argument
241 struct buffer_head *bh = sb_getblk_gfp(sb, block, 0); in ext4_sb_breadahead_unmovable()
250 static int ext4_verify_csum_type(struct super_block *sb, in ext4_verify_csum_type() argument
253 if (!ext4_has_feature_metadata_csum(sb)) in ext4_verify_csum_type()
259 static __le32 ext4_superblock_csum(struct super_block *sb, in ext4_superblock_csum() argument
262 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_superblock_csum()
271 static int ext4_superblock_csum_verify(struct super_block *sb, in ext4_superblock_csum_verify() argument
274 if (!ext4_has_metadata_csum(sb)) in ext4_superblock_csum_verify()
277 return es->s_checksum == ext4_superblock_csum(sb, es); in ext4_superblock_csum_verify()
280 void ext4_superblock_csum_set(struct super_block *sb) in ext4_superblock_csum_set() argument
282 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in ext4_superblock_csum_set()
284 if (!ext4_has_metadata_csum(sb)) in ext4_superblock_csum_set()
287 es->s_checksum = ext4_superblock_csum(sb, es); in ext4_superblock_csum_set()
290 ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, in ext4_block_bitmap() argument
294 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_block_bitmap()
298 ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, in ext4_inode_bitmap() argument
302 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_inode_bitmap()
306 ext4_fsblk_t ext4_inode_table(struct super_block *sb, in ext4_inode_table() argument
310 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_inode_table()
314 __u32 ext4_free_group_clusters(struct super_block *sb, in ext4_free_group_clusters() argument
318 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_free_group_clusters()
322 __u32 ext4_free_inodes_count(struct super_block *sb, in ext4_free_inodes_count() argument
326 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_free_inodes_count()
330 __u32 ext4_used_dirs_count(struct super_block *sb, in ext4_used_dirs_count() argument
334 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_used_dirs_count()
338 __u32 ext4_itable_unused_count(struct super_block *sb, in ext4_itable_unused_count() argument
342 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? in ext4_itable_unused_count()
346 void ext4_block_bitmap_set(struct super_block *sb, in ext4_block_bitmap_set() argument
350 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_block_bitmap_set()
354 void ext4_inode_bitmap_set(struct super_block *sb, in ext4_inode_bitmap_set() argument
358 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_inode_bitmap_set()
362 void ext4_inode_table_set(struct super_block *sb, in ext4_inode_table_set() argument
366 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_inode_table_set()
370 void ext4_free_group_clusters_set(struct super_block *sb, in ext4_free_group_clusters_set() argument
374 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_free_group_clusters_set()
378 void ext4_free_inodes_set(struct super_block *sb, in ext4_free_inodes_set() argument
382 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_free_inodes_set()
386 void ext4_used_dirs_set(struct super_block *sb, in ext4_used_dirs_set() argument
390 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_used_dirs_set()
394 void ext4_itable_unused_set(struct super_block *sb, in ext4_itable_unused_set() argument
398 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) in ext4_itable_unused_set()
428 static int block_device_ejected(struct super_block *sb) in block_device_ejected() argument
430 struct inode *bd_inode = sb->s_bdev->bd_inode; in block_device_ejected()
438 struct super_block *sb = journal->j_private; in ext4_journal_commit_callback() local
439 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_journal_commit_callback()
445 ext4_process_freed_data(sb, txn->t_tid); in ext4_journal_commit_callback()
453 jce->jce_func(sb, jce, error); in ext4_journal_commit_callback()
584 static void save_error_info(struct super_block *sb, int error, in save_error_info() argument
588 struct ext4_sb_info *sbi = EXT4_SB(sb); in save_error_info()
633 static void ext4_handle_error(struct super_block *sb, bool force_ro, int error, in ext4_handle_error() argument
637 journal_t *journal = EXT4_SB(sb)->s_journal; in ext4_handle_error()
638 bool continue_fs = !force_ro && test_opt(sb, ERRORS_CONT); in ext4_handle_error()
640 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; in ext4_handle_error()
641 if (test_opt(sb, WARN_ON_ERROR)) in ext4_handle_error()
644 if (!continue_fs && !sb_rdonly(sb)) { in ext4_handle_error()
645 ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED); in ext4_handle_error()
650 if (!bdev_read_only(sb->s_bdev)) { in ext4_handle_error()
651 save_error_info(sb, error, ino, block, func, line); in ext4_handle_error()
659 schedule_work(&EXT4_SB(sb)->s_error_work); in ext4_handle_error()
661 ext4_commit_super(sb); in ext4_handle_error()
669 if (test_opt(sb, ERRORS_PANIC) && !system_going_down()) { in ext4_handle_error()
671 sb->s_id); in ext4_handle_error()
674 if (sb_rdonly(sb) || continue_fs) in ext4_handle_error()
677 ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); in ext4_handle_error()
683 sb->s_flags |= SB_RDONLY; in ext4_handle_error()
695 * through the journal to avoid collisions of other journalled sb in flush_stashed_error_work()
727 * Write through journal failed. Write sb directly to get error info in flush_stashed_error_work()
733 #define ext4_error_ratelimit(sb) \ argument
734 ___ratelimit(&(EXT4_SB(sb)->s_err_ratelimit_state), \
737 void __ext4_error(struct super_block *sb, const char *function, in __ext4_error() argument
744 if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) in __ext4_error()
747 trace_ext4_error(sb, function, line); in __ext4_error()
748 if (ext4_error_ratelimit(sb)) { in __ext4_error()
754 sb->s_id, function, line, current->comm, &vaf); in __ext4_error()
757 ext4_handle_error(sb, force_ro, error, 0, block, function, line); in __ext4_error()
829 const char *ext4_decode_error(struct super_block *sb, int errno, in ext4_decode_error() argument
848 if (!sb || (EXT4_SB(sb)->s_journal && in ext4_decode_error()
849 EXT4_SB(sb)->s_journal->j_flags & JBD2_ABORT)) in ext4_decode_error()
872 void __ext4_std_error(struct super_block *sb, const char *function, in __ext4_std_error() argument
878 if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) in __ext4_std_error()
884 if (errno == -EROFS && journal_current_handle() == NULL && sb_rdonly(sb)) in __ext4_std_error()
887 if (ext4_error_ratelimit(sb)) { in __ext4_std_error()
888 errstr = ext4_decode_error(sb, errno, nbuf); in __ext4_std_error()
890 sb->s_id, function, line, errstr); in __ext4_std_error()
893 ext4_handle_error(sb, false, -errno, 0, 0, function, line); in __ext4_std_error()
896 void __ext4_msg(struct super_block *sb, in __ext4_msg() argument
902 atomic_inc(&EXT4_SB(sb)->s_msg_count); in __ext4_msg()
903 if (!___ratelimit(&(EXT4_SB(sb)->s_msg_ratelimit_state), "EXT4-fs")) in __ext4_msg()
909 printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf); in __ext4_msg()
913 static int ext4_warning_ratelimit(struct super_block *sb) in ext4_warning_ratelimit() argument
915 atomic_inc(&EXT4_SB(sb)->s_warning_count); in ext4_warning_ratelimit()
916 return ___ratelimit(&(EXT4_SB(sb)->s_warning_ratelimit_state), in ext4_warning_ratelimit()
920 void __ext4_warning(struct super_block *sb, const char *function, in __ext4_warning() argument
926 if (!ext4_warning_ratelimit(sb)) in __ext4_warning()
933 sb->s_id, function, line, &vaf); in __ext4_warning()
956 struct super_block *sb, ext4_group_t grp, in __ext4_grp_locked_error() argument
965 if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) in __ext4_grp_locked_error()
968 trace_ext4_error(sb, function, line); in __ext4_grp_locked_error()
969 if (ext4_error_ratelimit(sb)) { in __ext4_grp_locked_error()
974 sb->s_id, function, line, grp); in __ext4_grp_locked_error()
984 if (test_opt(sb, ERRORS_CONT)) { in __ext4_grp_locked_error()
985 if (test_opt(sb, WARN_ON_ERROR)) in __ext4_grp_locked_error()
987 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; in __ext4_grp_locked_error()
988 if (!bdev_read_only(sb->s_bdev)) { in __ext4_grp_locked_error()
989 save_error_info(sb, EFSCORRUPTED, ino, block, function, in __ext4_grp_locked_error()
991 schedule_work(&EXT4_SB(sb)->s_error_work); in __ext4_grp_locked_error()
995 ext4_unlock_group(sb, grp); in __ext4_grp_locked_error()
996 ext4_handle_error(sb, false, EFSCORRUPTED, ino, block, function, line); in __ext4_grp_locked_error()
1008 ext4_lock_group(sb, grp); in __ext4_grp_locked_error()
1012 void ext4_mark_group_bitmap_corrupted(struct super_block *sb, in ext4_mark_group_bitmap_corrupted() argument
1016 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_mark_group_bitmap_corrupted()
1017 struct ext4_group_info *grp = ext4_get_group_info(sb, group); in ext4_mark_group_bitmap_corrupted()
1018 struct ext4_group_desc *gdp = ext4_get_group_desc(sb, group, NULL); in ext4_mark_group_bitmap_corrupted()
1037 count = ext4_free_inodes_count(sb, gdp); in ext4_mark_group_bitmap_corrupted()
1044 void ext4_update_dynamic_rev(struct super_block *sb) in ext4_update_dynamic_rev() argument
1046 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in ext4_update_dynamic_rev()
1051 ext4_warning(sb, in ext4_update_dynamic_rev()
1072 static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb) in ext4_blkdev_get() argument
1076 bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb); in ext4_blkdev_get()
1082 ext4_msg(sb, KERN_ERR, in ext4_blkdev_get()
1117 static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi) in dump_orphan_list() argument
1121 ext4_msg(sb, KERN_ERR, "sb orphan head is %d", in dump_orphan_list()
1136 static int ext4_quota_off(struct super_block *sb, int type);
1138 static inline void ext4_quota_off_umount(struct super_block *sb) in ext4_quota_off_umount() argument
1144 ext4_quota_off(sb, type); in ext4_quota_off_umount()
1151 static inline char *get_qf_name(struct super_block *sb, in get_qf_name() argument
1156 lockdep_is_held(&sb->s_umount)); in get_qf_name()
1159 static inline void ext4_quota_off_umount(struct super_block *sb) in ext4_quota_off_umount() argument
1164 static void ext4_put_super(struct super_block *sb) in ext4_put_super() argument
1166 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_put_super()
1183 ext4_unregister_sysfs(sb); in ext4_put_super()
1185 ext4_unregister_li_request(sb); in ext4_put_super()
1186 ext4_quota_off_umount(sb); in ext4_put_super()
1195 ext4_abort(sb, -err, "Couldn't clean up the journal"); in ext4_put_super()
1201 ext4_release_system_zone(sb); in ext4_put_super()
1202 ext4_mb_release(sb); in ext4_put_super()
1203 ext4_ext_release(sb); in ext4_put_super()
1205 if (!sb_rdonly(sb) && !aborted) { in ext4_put_super()
1206 ext4_clear_feature_journal_needs_recovery(sb); in ext4_put_super()
1209 if (!sb_rdonly(sb)) in ext4_put_super()
1210 ext4_commit_super(sb); in ext4_put_super()
1232 kfree(get_qf_name(sb, sbi, i)); in ext4_put_super()
1240 dump_orphan_list(sb, sbi); in ext4_put_super()
1243 sync_blockdev(sb->s_bdev); in ext4_put_super()
1244 invalidate_bdev(sb->s_bdev); in ext4_put_super()
1245 if (sbi->s_journal_bdev && sbi->s_journal_bdev != sb->s_bdev) { in ext4_put_super()
1259 sb->s_fs_info = NULL; in ext4_put_super()
1272 utf8_unload(sb->s_encoding); in ext4_put_super()
1282 static struct inode *ext4_alloc_inode(struct super_block *sb) in ext4_alloc_inode() argument
1415 static struct inode *ext4_nfs_get_inode(struct super_block *sb, in ext4_nfs_get_inode() argument
1424 inode = ext4_iget(sb, ino, EXT4_IGET_HANDLE); in ext4_nfs_get_inode()
1435 static struct dentry *ext4_fh_to_dentry(struct super_block *sb, struct fid *fid, in ext4_fh_to_dentry() argument
1438 return generic_fh_to_dentry(sb, fid, fh_len, fh_type, in ext4_fh_to_dentry()
1442 static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid, in ext4_fh_to_parent() argument
1445 return generic_fh_to_parent(sb, fid, fh_len, fh_type, in ext4_fh_to_parent()
1553 static const union fscrypt_policy *ext4_get_dummy_policy(struct super_block *sb) in ext4_get_dummy_policy() argument
1555 return EXT4_SB(sb)->s_dummy_enc_policy.policy; in ext4_get_dummy_policy()
1558 static bool ext4_has_stable_inodes(struct super_block *sb) in ext4_has_stable_inodes() argument
1560 return ext4_has_feature_stable_inodes(sb); in ext4_has_stable_inodes()
1563 static void ext4_get_ino_and_lblk_bits(struct super_block *sb, in ext4_get_ino_and_lblk_bits() argument
1566 *ino_bits_ret = 8 * sizeof(EXT4_SB(sb)->s_es->s_inodes_count); in ext4_get_ino_and_lblk_bits()
1590 static int ext4_write_info(struct super_block *sb, int type);
1591 static int ext4_quota_on(struct super_block *sb, int type, int format_id,
1593 static int ext4_quota_on_mount(struct super_block *sb, int type);
1594 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
1596 static ssize_t ext4_quota_write(struct super_block *sb, int type,
1598 static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
1600 static int ext4_enable_quotas(struct super_block *sb);
1701 {Opt_sb, "sb=%u"},
1800 if (!options || strncmp(options, "sb=", 3) != 0) in get_sb_block()
1807 printk(KERN_ERR "EXT4-fs: Invalid sb specification: %s\n", in get_sb_block()
1824 static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) in set_qf_name() argument
1826 struct ext4_sb_info *sbi = EXT4_SB(sb); in set_qf_name()
1827 char *qname, *old_qname = get_qf_name(sb, sbi, qtype); in set_qf_name()
1830 if (sb_any_quota_loaded(sb) && !old_qname) { in set_qf_name()
1831 ext4_msg(sb, KERN_ERR, in set_qf_name()
1836 if (ext4_has_feature_quota(sb)) { in set_qf_name()
1837 ext4_msg(sb, KERN_INFO, "Journaled quota options " in set_qf_name()
1843 ext4_msg(sb, KERN_ERR, in set_qf_name()
1851 ext4_msg(sb, KERN_ERR, in set_qf_name()
1857 ext4_msg(sb, KERN_ERR, in set_qf_name()
1862 set_opt(sb, QUOTA); in set_qf_name()
1869 static int clear_qf_name(struct super_block *sb, int qtype) in clear_qf_name() argument
1872 struct ext4_sb_info *sbi = EXT4_SB(sb); in clear_qf_name()
1873 char *old_qname = get_qf_name(sb, sbi, qtype); in clear_qf_name()
1875 if (sb_any_quota_loaded(sb) && old_qname) { in clear_qf_name()
1876 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" in clear_qf_name()
2046 static int ext4_set_test_dummy_encryption(struct super_block *sb, in ext4_set_test_dummy_encryption() argument
2052 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_set_test_dummy_encryption()
2055 if (!ext4_has_feature_encrypt(sb)) { in ext4_set_test_dummy_encryption()
2056 ext4_msg(sb, KERN_WARNING, in ext4_set_test_dummy_encryption()
2068 ext4_msg(sb, KERN_WARNING, in ext4_set_test_dummy_encryption()
2072 err = fscrypt_set_test_dummy_encryption(sb, arg->from, in ext4_set_test_dummy_encryption()
2076 ext4_msg(sb, KERN_WARNING, in ext4_set_test_dummy_encryption()
2079 ext4_msg(sb, KERN_WARNING, in ext4_set_test_dummy_encryption()
2082 ext4_msg(sb, KERN_WARNING, in ext4_set_test_dummy_encryption()
2087 ext4_msg(sb, KERN_WARNING, "Test dummy encryption mode enabled"); in ext4_set_test_dummy_encryption()
2090 ext4_msg(sb, KERN_WARNING, in ext4_set_test_dummy_encryption()
2097 static int handle_mount_opt(struct super_block *sb, char *opt, int token, in handle_mount_opt() argument
2101 struct ext4_sb_info *sbi = EXT4_SB(sb); in handle_mount_opt()
2109 return set_qf_name(sb, USRQUOTA, &args[0]); in handle_mount_opt()
2111 return set_qf_name(sb, GRPQUOTA, &args[0]); in handle_mount_opt()
2113 return clear_qf_name(sb, USRQUOTA); in handle_mount_opt()
2115 return clear_qf_name(sb, GRPQUOTA); in handle_mount_opt()
2120 ext4_msg(sb, KERN_WARNING, deprecated_msg, opt, "3.5"); in handle_mount_opt()
2125 ext4_msg(sb, KERN_WARNING, "Ignoring removed %s option", opt); in handle_mount_opt()
2128 ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED); in handle_mount_opt()
2131 sb->s_flags |= SB_I_VERSION; in handle_mount_opt()
2134 sb->s_flags |= SB_LAZYTIME; in handle_mount_opt()
2137 sb->s_flags &= ~SB_LAZYTIME; in handle_mount_opt()
2141 sb->s_flags |= SB_INLINECRYPT; in handle_mount_opt()
2143 ext4_msg(sb, KERN_ERR, "inline encryption not supported"); in handle_mount_opt()
2153 ext4_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" " in handle_mount_opt()
2158 if ((m->flags & MOPT_NO_EXT2) && IS_EXT2_SB(sb)) { in handle_mount_opt()
2159 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
2163 if ((m->flags & MOPT_NO_EXT3) && IS_EXT3_SB(sb)) { in handle_mount_opt()
2164 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
2175 set_opt2(sb, EXPLICIT_DELALLOC); in handle_mount_opt()
2177 set_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM); in handle_mount_opt()
2182 clear_opt(sb, ERRORS_MASK); in handle_mount_opt()
2183 if (token == Opt_noquota && sb_any_quota_loaded(sb)) { in handle_mount_opt()
2184 ext4_msg(sb, KERN_ERR, "Cannot change quota " in handle_mount_opt()
2190 ext4_msg(sb, KERN_ERR, "%s option not supported", opt); in handle_mount_opt()
2195 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
2206 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
2217 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
2224 set_opt(sb, INIT_INODE_TABLE); in handle_mount_opt()
2239 ext4_msg(sb, KERN_ERR, "Invalid uid value %d", arg); in handle_mount_opt()
2246 ext4_msg(sb, KERN_ERR, "Invalid gid value %d", arg); in handle_mount_opt()
2252 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
2264 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
2270 ext4_msg(sb, KERN_ERR, "error: could not dup " in handle_mount_opt()
2277 ext4_msg(sb, KERN_ERR, "error: could not find " in handle_mount_opt()
2285 ext4_msg(sb, KERN_ERR, "error: journal path %s " in handle_mount_opt()
2297 ext4_msg(sb, KERN_ERR, "Invalid journal IO priority" in handle_mount_opt()
2304 return ext4_set_test_dummy_encryption(sb, opt, &args[0], in handle_mount_opt()
2309 …ext4_msg(sb, KERN_WARNING, "Remounting file system with no journal so ignoring journalled data opt… in handle_mount_opt()
2310 else if (test_opt(sb, DATA_FLAGS) != m->mount_opt) { in handle_mount_opt()
2311 ext4_msg(sb, KERN_ERR, in handle_mount_opt()
2316 clear_opt(sb, DATA_FLAGS); in handle_mount_opt()
2321 if (sb_any_quota_loaded(sb) && in handle_mount_opt()
2323 ext4_msg(sb, KERN_ERR, "Cannot change journaled " in handle_mount_opt()
2327 if (ext4_has_feature_quota(sb)) { in handle_mount_opt()
2328 ext4_msg(sb, KERN_INFO, in handle_mount_opt()
2345 ext4_msg(sb, KERN_ERR, "can't change " in handle_mount_opt()
2350 (test_opt(sb, DATA_FLAGS) == in handle_mount_opt()
2352 ext4_msg(sb, KERN_ERR, "can't mount with " in handle_mount_opt()
2356 ext4_msg(sb, KERN_WARNING, in handle_mount_opt()
2382 ext4_msg(sb, KERN_INFO, "dax option not supported"); in handle_mount_opt()
2397 ext4_msg(sb, KERN_WARNING, in handle_mount_opt()
2417 static int parse_options(char *options, struct super_block *sb, in parse_options() argument
2422 struct ext4_sb_info __maybe_unused *sbi = EXT4_SB(sb); in parse_options()
2439 if (handle_mount_opt(sb, p, token, args, journal_devnum, in parse_options()
2449 if (test_opt(sb, PRJQUOTA) && !ext4_has_feature_project(sb)) { in parse_options()
2450 ext4_msg(sb, KERN_ERR, "Project quota feature not enabled. " in parse_options()
2454 usr_qf_name = get_qf_name(sb, sbi, USRQUOTA); in parse_options()
2455 grp_qf_name = get_qf_name(sb, sbi, GRPQUOTA); in parse_options()
2457 if (test_opt(sb, USRQUOTA) && usr_qf_name) in parse_options()
2458 clear_opt(sb, USRQUOTA); in parse_options()
2460 if (test_opt(sb, GRPQUOTA) && grp_qf_name) in parse_options()
2461 clear_opt(sb, GRPQUOTA); in parse_options()
2463 if (test_opt(sb, GRPQUOTA) || test_opt(sb, USRQUOTA)) { in parse_options()
2464 ext4_msg(sb, KERN_ERR, "old and new quota " in parse_options()
2470 ext4_msg(sb, KERN_ERR, "journaled quota format " in parse_options()
2476 if (test_opt(sb, DIOREAD_NOLOCK)) { in parse_options()
2480 ext4_msg(sb, KERN_WARNING, "Warning: mounting with an " in parse_options()
2488 struct super_block *sb) in ext4_show_quota_options() argument
2491 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_show_quota_options()
2535 * - if the per-sb default is different from the global default
2537 static int _ext4_show_options(struct seq_file *seq, struct super_block *sb, in _ext4_show_options() argument
2540 struct ext4_sb_info *sbi = EXT4_SB(sb); in _ext4_show_options()
2550 SEQ_OPTS_PRINT("sb=%llu", sbi->s_sb_block); in _ext4_show_options()
2575 if (test_opt(sb, ERRORS_RO) && def_errors != EXT4_ERRORS_RO) in _ext4_show_options()
2577 if (test_opt(sb, ERRORS_CONT) && def_errors != EXT4_ERRORS_CONTINUE) in _ext4_show_options()
2579 if (test_opt(sb, ERRORS_PANIC) && def_errors != EXT4_ERRORS_PANIC) in _ext4_show_options()
2587 if (sb->s_flags & SB_I_VERSION) in _ext4_show_options()
2593 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) in _ext4_show_options()
2595 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) in _ext4_show_options()
2597 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA) in _ext4_show_options()
2605 if (test_opt(sb, INIT_INODE_TABLE) && (nodefs || in _ext4_show_options()
2610 if (test_opt(sb, DATA_ERR_ABORT)) in _ext4_show_options()
2613 fscrypt_show_test_dummy_encryption(seq, sep, sb); in _ext4_show_options()
2615 if (sb->s_flags & SB_INLINECRYPT) in _ext4_show_options()
2618 if (test_opt(sb, DAX_ALWAYS)) { in _ext4_show_options()
2619 if (IS_EXT2_SB(sb)) in _ext4_show_options()
2623 } else if (test_opt2(sb, DAX_NEVER)) { in _ext4_show_options()
2625 } else if (test_opt2(sb, DAX_INODE)) { in _ext4_show_options()
2628 ext4_show_quota_options(seq, sb); in _ext4_show_options()
2639 struct super_block *sb = seq->private; in ext4_seq_options_show() local
2642 seq_puts(seq, sb_rdonly(sb) ? "ro" : "rw"); in ext4_seq_options_show()
2643 rc = _ext4_show_options(seq, sb, 1); in ext4_seq_options_show()
2648 static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es, in ext4_setup_super() argument
2651 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_setup_super()
2655 ext4_msg(sb, KERN_ERR, "revision level too high, " in ext4_setup_super()
2663 ext4_msg(sb, KERN_WARNING, "warning: mounting unchecked fs, " in ext4_setup_super()
2666 ext4_msg(sb, KERN_WARNING, in ext4_setup_super()
2672 ext4_msg(sb, KERN_WARNING, in ext4_setup_super()
2678 ext4_msg(sb, KERN_WARNING, in ext4_setup_super()
2688 ext4_set_feature_journal_needs_recovery(sb); in ext4_setup_super()
2690 err = ext4_commit_super(sb); in ext4_setup_super()
2692 if (test_opt(sb, DEBUG)) in ext4_setup_super()
2695 sb->s_blocksize, in ext4_setup_super()
2697 EXT4_BLOCKS_PER_GROUP(sb), in ext4_setup_super()
2698 EXT4_INODES_PER_GROUP(sb), in ext4_setup_super()
2701 cleancache_init_fs(sb); in ext4_setup_super()
2705 int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup) in ext4_alloc_flex_bg_array() argument
2707 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_alloc_flex_bg_array()
2721 ext4_msg(sb, KERN_ERR, in ext4_alloc_flex_bg_array()
2733 ext4_msg(sb, KERN_ERR, in ext4_alloc_flex_bg_array()
2752 static int ext4_fill_flex_info(struct super_block *sb) in ext4_fill_flex_info() argument
2754 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_fill_flex_info()
2766 err = ext4_alloc_flex_bg_array(sb, sbi->s_groups_count); in ext4_fill_flex_info()
2771 gdp = ext4_get_group_desc(sb, i, NULL); in ext4_fill_flex_info()
2775 atomic_add(ext4_free_inodes_count(sb, gdp), &fg->free_inodes); in ext4_fill_flex_info()
2776 atomic64_add(ext4_free_group_clusters(sb, gdp), in ext4_fill_flex_info()
2778 atomic_add(ext4_used_dirs_count(sb, gdp), &fg->used_dirs); in ext4_fill_flex_info()
2786 static __le16 ext4_group_desc_csum(struct super_block *sb, __u32 block_group, in ext4_group_desc_csum() argument
2792 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_group_desc_csum()
2814 if (!ext4_has_feature_gdt_csum(sb)) in ext4_group_desc_csum()
2822 if (ext4_has_feature_64bit(sb) && offset < sbi->s_desc_size) in ext4_group_desc_csum()
2830 int ext4_group_desc_csum_verify(struct super_block *sb, __u32 block_group, in ext4_group_desc_csum_verify() argument
2833 if (ext4_has_group_desc_csum(sb) && in ext4_group_desc_csum_verify()
2834 (gdp->bg_checksum != ext4_group_desc_csum(sb, block_group, gdp))) in ext4_group_desc_csum_verify()
2840 void ext4_group_desc_csum_set(struct super_block *sb, __u32 block_group, in ext4_group_desc_csum_set() argument
2843 if (!ext4_has_group_desc_csum(sb)) in ext4_group_desc_csum_set()
2845 gdp->bg_checksum = ext4_group_desc_csum(sb, block_group, gdp); in ext4_group_desc_csum_set()
2849 static int ext4_check_descriptors(struct super_block *sb, in ext4_check_descriptors() argument
2853 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_check_descriptors()
2856 ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0); in ext4_check_descriptors()
2863 if (ext4_has_feature_flex_bg(sb)) in ext4_check_descriptors()
2869 struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); in ext4_check_descriptors()
2875 (EXT4_BLOCKS_PER_GROUP(sb) - 1); in ext4_check_descriptors()
2881 block_bitmap = ext4_block_bitmap(sb, gdp); in ext4_check_descriptors()
2883 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2886 if (!sb_rdonly(sb)) in ext4_check_descriptors()
2891 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2894 if (!sb_rdonly(sb)) in ext4_check_descriptors()
2898 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2903 inode_bitmap = ext4_inode_bitmap(sb, gdp); in ext4_check_descriptors()
2905 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2908 if (!sb_rdonly(sb)) in ext4_check_descriptors()
2913 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2916 if (!sb_rdonly(sb)) in ext4_check_descriptors()
2920 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2925 inode_table = ext4_inode_table(sb, gdp); in ext4_check_descriptors()
2927 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2930 if (!sb_rdonly(sb)) in ext4_check_descriptors()
2935 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2938 if (!sb_rdonly(sb)) in ext4_check_descriptors()
2943 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2948 ext4_lock_group(sb, i); in ext4_check_descriptors()
2949 if (!ext4_group_desc_csum_verify(sb, i, gdp)) { in ext4_check_descriptors()
2950 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " in ext4_check_descriptors()
2952 i, le16_to_cpu(ext4_group_desc_csum(sb, i, in ext4_check_descriptors()
2954 if (!sb_rdonly(sb)) { in ext4_check_descriptors()
2955 ext4_unlock_group(sb, i); in ext4_check_descriptors()
2959 ext4_unlock_group(sb, i); in ext4_check_descriptors()
2961 first_block += EXT4_BLOCKS_PER_GROUP(sb); in ext4_check_descriptors()
2985 static void ext4_orphan_cleanup(struct super_block *sb, in ext4_orphan_cleanup() argument
2988 unsigned int s_flags = sb->s_flags; in ext4_orphan_cleanup()
2999 if (bdev_read_only(sb->s_bdev)) { in ext4_orphan_cleanup()
3000 ext4_msg(sb, KERN_ERR, "write access " in ext4_orphan_cleanup()
3006 if (!ext4_feature_set_ok(sb, 0)) { in ext4_orphan_cleanup()
3007 ext4_msg(sb, KERN_INFO, "Skipping orphan cleanup due to " in ext4_orphan_cleanup()
3012 if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { in ext4_orphan_cleanup()
3015 ext4_msg(sb, KERN_INFO, "Errors on filesystem, " in ext4_orphan_cleanup()
3024 ext4_msg(sb, KERN_INFO, "orphan cleanup on readonly fs"); in ext4_orphan_cleanup()
3025 sb->s_flags &= ~SB_RDONLY; in ext4_orphan_cleanup()
3032 if (ext4_has_feature_quota(sb) && (s_flags & SB_RDONLY)) { in ext4_orphan_cleanup()
3033 int ret = ext4_enable_quotas(sb); in ext4_orphan_cleanup()
3038 ext4_msg(sb, KERN_ERR, in ext4_orphan_cleanup()
3044 if (EXT4_SB(sb)->s_qf_names[i]) { in ext4_orphan_cleanup()
3045 int ret = ext4_quota_on_mount(sb, i); in ext4_orphan_cleanup()
3050 ext4_msg(sb, KERN_ERR, in ext4_orphan_cleanup()
3064 if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { in ext4_orphan_cleanup()
3070 inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan)); in ext4_orphan_cleanup()
3076 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan); in ext4_orphan_cleanup()
3079 if (test_opt(sb, DEBUG)) in ext4_orphan_cleanup()
3080 ext4_msg(sb, KERN_DEBUG, in ext4_orphan_cleanup()
3100 if (test_opt(sb, DEBUG)) in ext4_orphan_cleanup()
3101 ext4_msg(sb, KERN_DEBUG, in ext4_orphan_cleanup()
3114 ext4_msg(sb, KERN_INFO, "%d orphan inode%s deleted", in ext4_orphan_cleanup()
3117 ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up", in ext4_orphan_cleanup()
3123 if (sb_dqopt(sb)->files[i]) in ext4_orphan_cleanup()
3124 dquot_quota_off(sb, i); in ext4_orphan_cleanup()
3128 sb->s_flags = s_flags; /* Restore SB_RDONLY status */ in ext4_orphan_cleanup()
3239 static ext4_fsblk_t descriptor_loc(struct super_block *sb, in descriptor_loc() argument
3242 struct ext4_sb_info *sbi = EXT4_SB(sb); in descriptor_loc()
3248 if (!ext4_has_feature_meta_bg(sb) || nr < first_meta_bg) in descriptor_loc()
3251 if (ext4_bg_has_super(sb, bg)) in descriptor_loc()
3260 if (sb->s_blocksize == 1024 && nr == 0 && in descriptor_loc()
3264 return (has_super + ext4_group_first_block_no(sb, bg)); in descriptor_loc()
3310 static int ext4_feature_set_ok(struct super_block *sb, int readonly) in ext4_feature_set_ok() argument
3312 if (ext4_has_unknown_ext4_incompat_features(sb)) { in ext4_feature_set_ok()
3313 ext4_msg(sb, KERN_ERR, in ext4_feature_set_ok()
3316 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_incompat) & in ext4_feature_set_ok()
3322 if (ext4_has_feature_casefold(sb)) { in ext4_feature_set_ok()
3323 ext4_msg(sb, KERN_ERR, in ext4_feature_set_ok()
3333 if (ext4_has_feature_readonly(sb)) { in ext4_feature_set_ok()
3334 ext4_msg(sb, KERN_INFO, "filesystem is read-only"); in ext4_feature_set_ok()
3335 sb->s_flags |= SB_RDONLY; in ext4_feature_set_ok()
3340 if (ext4_has_unknown_ext4_ro_compat_features(sb)) { in ext4_feature_set_ok()
3341 ext4_msg(sb, KERN_ERR, "couldn't mount RDWR because of " in ext4_feature_set_ok()
3343 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) & in ext4_feature_set_ok()
3347 if (ext4_has_feature_bigalloc(sb) && !ext4_has_feature_extents(sb)) { in ext4_feature_set_ok()
3348 ext4_msg(sb, KERN_ERR, in ext4_feature_set_ok()
3355 if (!readonly && (ext4_has_feature_quota(sb) || in ext4_feature_set_ok()
3356 ext4_has_feature_project(sb))) { in ext4_feature_set_ok()
3357 ext4_msg(sb, KERN_ERR, in ext4_feature_set_ok()
3372 struct super_block *sb = sbi->s_sb; in print_daily_error_info() local
3377 ext4_msg(sb, KERN_NOTICE, "error count since last fsck: %u", in print_daily_error_info()
3381 sb->s_id, in print_daily_error_info()
3396 sb->s_id, in print_daily_error_info()
3416 struct super_block *sb = elr->lr_super; in ext4_run_li_request() local
3417 ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; in ext4_run_li_request()
3424 elr->lr_next_group = ext4_mb_prefetch(sb, group, in ext4_run_li_request()
3425 EXT4_SB(sb)->s_mb_prefetch, &prefetch_ios); in ext4_run_li_request()
3427 ext4_mb_prefetch_fini(sb, elr->lr_next_group, in ext4_run_li_request()
3429 trace_ext4_prefetch_bitmaps(sb, group, elr->lr_next_group, in ext4_run_li_request()
3434 !sb_rdonly(sb) && test_opt(sb, INIT_INODE_TABLE)) { in ext4_run_li_request()
3444 gdp = ext4_get_group_desc(sb, group, NULL); in ext4_run_li_request()
3459 ret = ext4_init_inode_table(sb, group, in ext4_run_li_request()
3461 trace_ext4_lazy_itable_init(sb, group); in ext4_run_li_request()
3486 static void ext4_unregister_li_request(struct super_block *sb) in ext4_unregister_li_request() argument
3495 ext4_remove_li_request(EXT4_SB(sb)->s_li_request); in ext4_unregister_li_request()
3545 * We hold sb->s_umount, sb can not in ext4_lazyinit_thread()
3651 static ext4_group_t ext4_has_uninit_itable(struct super_block *sb) in ext4_has_uninit_itable() argument
3653 ext4_group_t group, ngroups = EXT4_SB(sb)->s_groups_count; in ext4_has_uninit_itable()
3656 if (!ext4_has_group_desc_csum(sb)) in ext4_has_uninit_itable()
3660 gdp = ext4_get_group_desc(sb, group, NULL); in ext4_has_uninit_itable()
3689 static struct ext4_li_request *ext4_li_request_new(struct super_block *sb, in ext4_li_request_new() argument
3698 elr->lr_super = sb; in ext4_li_request_new()
3700 if (test_opt(sb, PREFETCH_BLOCK_BITMAPS)) in ext4_li_request_new()
3717 int ext4_register_li_request(struct super_block *sb, in ext4_register_li_request() argument
3720 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_register_li_request()
3735 if (!test_opt(sb, PREFETCH_BLOCK_BITMAPS) && in ext4_register_li_request()
3736 (first_not_zeroed == ngroups || sb_rdonly(sb) || in ext4_register_li_request()
3737 !test_opt(sb, INIT_INODE_TABLE))) in ext4_register_li_request()
3740 elr = ext4_li_request_new(sb, first_not_zeroed); in ext4_register_li_request()
3792 static int set_journal_csum_feature_set(struct super_block *sb) in set_journal_csum_feature_set() argument
3796 struct ext4_sb_info *sbi = EXT4_SB(sb); in set_journal_csum_feature_set()
3798 if (ext4_has_metadata_csum(sb)) { in set_journal_csum_feature_set()
3812 if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) { in set_journal_csum_feature_set()
3817 } else if (test_opt(sb, JOURNAL_CHECKSUM)) { in set_journal_csum_feature_set()
3846 static int count_overhead(struct super_block *sb, ext4_group_t grp, in count_overhead() argument
3849 struct ext4_sb_info *sbi = EXT4_SB(sb); in count_overhead()
3852 ext4_group_t i, ngroups = ext4_get_groups_count(sb); in count_overhead()
3854 int has_super = ext4_bg_has_super(sb, grp); in count_overhead()
3856 if (!ext4_has_feature_bigalloc(sb)) in count_overhead()
3857 return (has_super + ext4_bg_num_gdb(sb, grp) + in count_overhead()
3862 (grp * EXT4_BLOCKS_PER_GROUP(sb)); in count_overhead()
3863 last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1; in count_overhead()
3865 gdp = ext4_get_group_desc(sb, i, NULL); in count_overhead()
3866 b = ext4_block_bitmap(sb, gdp); in count_overhead()
3871 b = ext4_inode_bitmap(sb, gdp); in count_overhead()
3876 b = ext4_inode_table(sb, gdp); in count_overhead()
3886 if (ext4_bg_has_super(sb, grp)) { in count_overhead()
3890 j = ext4_bg_num_gdb(sb, grp); in count_overhead()
3891 if (s + j > EXT4_BLOCKS_PER_GROUP(sb)) { in count_overhead()
3892 ext4_error(sb, "Invalid number of block group " in count_overhead()
3894 j = EXT4_BLOCKS_PER_GROUP(sb) - s; in count_overhead()
3902 return EXT4_CLUSTERS_PER_GROUP(sb) - in count_overhead()
3903 ext4_count_free(buf, EXT4_CLUSTERS_PER_GROUP(sb) / 8); in count_overhead()
3909 int ext4_calculate_overhead(struct super_block *sb) in ext4_calculate_overhead() argument
3911 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_calculate_overhead()
3915 ext4_group_t i, ngroups = ext4_get_groups_count(sb); in ext4_calculate_overhead()
3939 blks = count_overhead(sb, i, buf); in ext4_calculate_overhead()
3952 else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) { in ext4_calculate_overhead()
3954 j_inode = ext4_get_journal_inode(sb, j_inum); in ext4_calculate_overhead()
3956 j_blocks = j_inode->i_size >> sb->s_blocksize_bits; in ext4_calculate_overhead()
3960 ext4_msg(sb, KERN_ERR, "can't get journal size"); in ext4_calculate_overhead()
3969 static void ext4_set_resv_clusters(struct super_block *sb) in ext4_set_resv_clusters() argument
3972 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_set_resv_clusters()
3980 if (!ext4_has_feature_extents(sb)) in ext4_set_resv_clusters()
3999 static int ext4_fill_super(struct super_block *sb, void *data, int silent) in ext4_fill_super() argument
4001 struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev); in ext4_fill_super()
4034 sb->s_fs_info = sbi; in ext4_fill_super()
4035 sbi->s_sb = sb; in ext4_fill_super()
4038 if (sb->s_bdev->bd_part) in ext4_fill_super()
4040 part_stat_read(sb->s_bdev->bd_part, sectors[STAT_WRITE]); in ext4_fill_super()
4043 strreplace(sb->s_id, '/', '!'); in ext4_fill_super()
4047 blocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE); in ext4_fill_super()
4049 ext4_msg(sb, KERN_ERR, "unable to set blocksize"); in ext4_fill_super()
4064 bh = ext4_sb_bread_unmovable(sb, logical_sb_block); in ext4_fill_super()
4066 ext4_msg(sb, KERN_ERR, "unable to read superblock"); in ext4_fill_super()
4077 sb->s_magic = le16_to_cpu(es->s_magic); in ext4_fill_super()
4078 if (sb->s_magic != EXT4_SUPER_MAGIC) in ext4_fill_super()
4083 if (ext4_has_feature_metadata_csum(sb) && in ext4_fill_super()
4084 ext4_has_feature_gdt_csum(sb)) in ext4_fill_super()
4085 ext4_warning(sb, "metadata_csum and uninit_bg are " in ext4_fill_super()
4089 if (!ext4_verify_csum_type(sb, es)) { in ext4_fill_super()
4090 ext4_msg(sb, KERN_ERR, "VFS: Found ext4 filesystem with " in ext4_fill_super()
4099 ext4_msg(sb, KERN_ERR, "Cannot load crc32c driver."); in ext4_fill_super()
4106 if (!ext4_superblock_csum_verify(sb, es)) { in ext4_fill_super()
4107 ext4_msg(sb, KERN_ERR, "VFS: Found ext4 filesystem with " in ext4_fill_super()
4115 if (ext4_has_feature_csum_seed(sb)) in ext4_fill_super()
4117 else if (ext4_has_metadata_csum(sb) || ext4_has_feature_ea_inode(sb)) in ext4_fill_super()
4123 set_opt(sb, INIT_INODE_TABLE); in ext4_fill_super()
4125 set_opt(sb, DEBUG); in ext4_fill_super()
4127 set_opt(sb, GRPID); in ext4_fill_super()
4129 set_opt(sb, NO_UID32); in ext4_fill_super()
4131 set_opt(sb, XATTR_USER); in ext4_fill_super()
4133 set_opt(sb, POSIX_ACL); in ext4_fill_super()
4135 if (ext4_has_feature_fast_commit(sb)) in ext4_fill_super()
4136 set_opt2(sb, JOURNAL_FAST_COMMIT); in ext4_fill_super()
4138 if (ext4_has_metadata_csum(sb)) in ext4_fill_super()
4139 set_opt(sb, JOURNAL_CHECKSUM); in ext4_fill_super()
4142 set_opt(sb, JOURNAL_DATA); in ext4_fill_super()
4144 set_opt(sb, ORDERED_DATA); in ext4_fill_super()
4146 set_opt(sb, WRITEBACK_DATA); in ext4_fill_super()
4149 set_opt(sb, ERRORS_PANIC); in ext4_fill_super()
4151 set_opt(sb, ERRORS_CONT); in ext4_fill_super()
4153 set_opt(sb, ERRORS_RO); in ext4_fill_super()
4155 set_opt(sb, BLOCK_VALIDITY); in ext4_fill_super()
4157 set_opt(sb, DISCARD); in ext4_fill_super()
4166 set_opt(sb, BARRIER); in ext4_fill_super()
4172 if (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb) && in ext4_fill_super()
4174 set_opt(sb, DELALLOC); in ext4_fill_super()
4184 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4191 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4200 set_opt(sb, DIOREAD_NOLOCK); in ext4_fill_super()
4209 ext4_msg(sb, KERN_ERR, "invalid first ino: %u", in ext4_fill_super()
4216 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4219 ext4_msg(sb, KERN_ERR, "blocksize: %d", blocksize); in ext4_fill_super()
4230 sb->s_time_gran = 1; in ext4_fill_super()
4231 sb->s_time_max = EXT4_EXTRA_TIMESTAMP_MAX; in ext4_fill_super()
4233 sb->s_time_gran = NSEC_PER_SEC; in ext4_fill_super()
4234 sb->s_time_max = EXT4_NON_EXTRA_TIMESTAMP_MAX; in ext4_fill_super()
4236 sb->s_time_min = EXT4_TIMESTAMP_MIN; in ext4_fill_super()
4241 if (ext4_has_feature_extra_isize(sb)) { in ext4_fill_super()
4247 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4256 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4271 if (!parse_options(s_mount_opts, sb, &journal_devnum, in ext4_fill_super()
4273 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
4280 if (!parse_options((char *) data, sb, &journal_devnum, in ext4_fill_super()
4285 if (ext4_has_feature_casefold(sb) && !sb->s_encoding) { in ext4_fill_super()
4290 if (ext4_has_feature_encrypt(sb)) { in ext4_fill_super()
4291 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4298 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4305 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4312 ext4_msg(sb, KERN_INFO,"Using encoding defined by superblock: " in ext4_fill_super()
4316 sb->s_encoding = encoding; in ext4_fill_super()
4317 sb->s_encoding_flags = encoding_flags; in ext4_fill_super()
4321 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { in ext4_fill_super()
4324 clear_opt(sb, DIOREAD_NOLOCK); in ext4_fill_super()
4325 clear_opt2(sb, JOURNAL_FAST_COMMIT); in ext4_fill_super()
4326 if (test_opt2(sb, EXPLICIT_DELALLOC)) { in ext4_fill_super()
4327 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
4331 if (test_opt(sb, DAX_ALWAYS)) { in ext4_fill_super()
4332 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
4336 if (ext4_has_feature_encrypt(sb)) { in ext4_fill_super()
4337 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
4341 if (test_opt(sb, DELALLOC)) in ext4_fill_super()
4342 clear_opt(sb, DELALLOC); in ext4_fill_super()
4344 sb->s_iflags |= SB_I_CGROUPWB; in ext4_fill_super()
4347 sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | in ext4_fill_super()
4348 (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); in ext4_fill_super()
4351 (ext4_has_compat_features(sb) || in ext4_fill_super()
4352 ext4_has_ro_compat_features(sb) || in ext4_fill_super()
4353 ext4_has_incompat_features(sb))) in ext4_fill_super()
4354 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
4359 set_opt2(sb, HURD_COMPAT); in ext4_fill_super()
4360 if (ext4_has_feature_64bit(sb)) { in ext4_fill_super()
4361 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4370 if (ext4_has_feature_ea_inode(sb)) { in ext4_fill_super()
4371 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4377 if (IS_EXT2_SB(sb)) { in ext4_fill_super()
4378 if (ext2_feature_set_ok(sb)) in ext4_fill_super()
4379 ext4_msg(sb, KERN_INFO, "mounting ext2 file system " in ext4_fill_super()
4386 if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb))) in ext4_fill_super()
4388 ext4_msg(sb, KERN_ERR, "couldn't mount as ext2 due " in ext4_fill_super()
4394 if (IS_EXT3_SB(sb)) { in ext4_fill_super()
4395 if (ext3_feature_set_ok(sb)) in ext4_fill_super()
4396 ext4_msg(sb, KERN_INFO, "mounting ext3 file system " in ext4_fill_super()
4403 if (silent && ext4_feature_set_ok(sb, sb_rdonly(sb))) in ext4_fill_super()
4405 ext4_msg(sb, KERN_ERR, "couldn't mount as ext3 due " in ext4_fill_super()
4416 if (!ext4_feature_set_ok(sb, (sb_rdonly(sb)))) in ext4_fill_super()
4420 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4426 if (bdev_dax_supported(sb->s_bdev, blocksize)) in ext4_fill_super()
4430 if (ext4_has_feature_inline_data(sb)) { in ext4_fill_super()
4431 ext4_msg(sb, KERN_ERR, "Cannot use DAX on a filesystem" in ext4_fill_super()
4436 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4442 if (ext4_has_feature_encrypt(sb) && es->s_encryption_level) { in ext4_fill_super()
4443 ext4_msg(sb, KERN_ERR, "Unsupported encryption level %d", in ext4_fill_super()
4448 if (sb->s_blocksize != blocksize) { in ext4_fill_super()
4456 if (!sb_set_blocksize(sb, blocksize)) { in ext4_fill_super()
4457 ext4_msg(sb, KERN_ERR, "bad block size %d", in ext4_fill_super()
4465 bh = ext4_sb_bread_unmovable(sb, logical_sb_block); in ext4_fill_super()
4467 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4476 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4482 has_huge_files = ext4_has_feature_huge_file(sb); in ext4_fill_super()
4483 sbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits, in ext4_fill_super()
4485 sb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files); in ext4_fill_super()
4488 if (ext4_has_feature_64bit(sb)) { in ext4_fill_super()
4492 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4503 sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb); in ext4_fill_super()
4508 ext4_msg(sb, KERN_ERR, "invalid inodes per group: %lu\n", in ext4_fill_super()
4514 sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb); in ext4_fill_super()
4517 sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb)); in ext4_fill_super()
4518 sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb)); in ext4_fill_super()
4523 if (ext4_has_feature_dir_index(sb)) { in ext4_fill_super()
4529 if (!sb_rdonly(sb)) in ext4_fill_super()
4534 if (!sb_rdonly(sb)) in ext4_fill_super()
4543 if (ext4_has_feature_bigalloc(sb)) { in ext4_fill_super()
4545 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4555 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4562 ext4_msg(sb, KERN_ERR, "blocks per group (%lu) and " in ext4_fill_super()
4570 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4576 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4588 set_opt2(sb, STD_GROUP_SIZE); in ext4_fill_super()
4594 err = generic_check_addressable(sb->s_blocksize_bits, in ext4_fill_super()
4597 ext4_msg(sb, KERN_ERR, "filesystem" in ext4_fill_super()
4602 if (EXT4_BLOCKS_PER_GROUP(sb) == 0) in ext4_fill_super()
4606 blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits; in ext4_fill_super()
4608 ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu " in ext4_fill_super()
4619 ext4_msg(sb, KERN_WARNING, "bad geometry: first data " in ext4_fill_super()
4627 ext4_msg(sb, KERN_WARNING, "bad geometry: first data " in ext4_fill_super()
4634 EXT4_BLOCKS_PER_GROUP(sb) - 1); in ext4_fill_super()
4635 do_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb)); in ext4_fill_super()
4636 if (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) { in ext4_fill_super()
4637 ext4_msg(sb, KERN_WARNING, "groups count too large: %llu " in ext4_fill_super()
4642 EXT4_BLOCKS_PER_GROUP(sb)); in ext4_fill_super()
4647 (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); in ext4_fill_super()
4650 ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", in ext4_fill_super()
4656 db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / in ext4_fill_super()
4657 EXT4_DESC_PER_BLOCK(sb); in ext4_fill_super()
4658 if (ext4_has_feature_meta_bg(sb)) { in ext4_fill_super()
4660 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
4672 ext4_msg(sb, KERN_ERR, "not enough memory"); in ext4_fill_super()
4681 block = descriptor_loc(sb, logical_sb_block, i); in ext4_fill_super()
4682 ext4_sb_breadahead_unmovable(sb, block); in ext4_fill_super()
4688 block = descriptor_loc(sb, logical_sb_block, i); in ext4_fill_super()
4689 bh = ext4_sb_bread_unmovable(sb, block); in ext4_fill_super()
4691 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4703 if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) { in ext4_fill_super()
4704 ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); in ext4_fill_super()
4723 sb->s_op = &ext4_sops; in ext4_fill_super()
4724 sb->s_export_op = &ext4_export_ops; in ext4_fill_super()
4725 sb->s_xattr = ext4_xattr_handlers; in ext4_fill_super()
4727 sb->s_cop = &ext4_cryptops; in ext4_fill_super()
4730 sb->s_vop = &ext4_verityops; in ext4_fill_super()
4733 sb->dq_op = &ext4_quota_operations; in ext4_fill_super()
4734 if (ext4_has_feature_quota(sb)) in ext4_fill_super()
4735 sb->s_qcop = &dquot_quotactl_sysfile_ops; in ext4_fill_super()
4737 sb->s_qcop = &ext4_qctl_operations; in ext4_fill_super()
4738 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ; in ext4_fill_super()
4740 memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); in ext4_fill_super()
4753 ext4_clear_mount_flag(sb, EXT4_MF_FC_INELIGIBLE); in ext4_fill_super()
4754 ext4_clear_mount_flag(sb, EXT4_MF_FC_COMMITTING); in ext4_fill_super()
4765 sb->s_root = NULL; in ext4_fill_super()
4768 ext4_has_feature_journal_needs_recovery(sb)); in ext4_fill_super()
4770 if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) { in ext4_fill_super()
4771 err = ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)); in ext4_fill_super()
4780 if (!test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb)) { in ext4_fill_super()
4781 err = ext4_load_journal(sb, es, journal_devnum); in ext4_fill_super()
4784 } else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) && in ext4_fill_super()
4785 ext4_has_feature_journal_needs_recovery(sb)) { in ext4_fill_super()
4786 ext4_msg(sb, KERN_ERR, "required journal recovery " in ext4_fill_super()
4791 if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) { in ext4_fill_super()
4792 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
4797 if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) { in ext4_fill_super()
4798 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
4803 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
4810 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
4815 clear_opt(sb, JOURNAL_CHECKSUM); in ext4_fill_super()
4816 clear_opt(sb, DATA_FLAGS); in ext4_fill_super()
4817 clear_opt2(sb, JOURNAL_FAST_COMMIT); in ext4_fill_super()
4823 if (ext4_has_feature_64bit(sb) && in ext4_fill_super()
4824 !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0, in ext4_fill_super()
4826 ext4_msg(sb, KERN_ERR, "Failed to set 64-bit journal feature"); in ext4_fill_super()
4830 if (!set_journal_csum_feature_set(sb)) { in ext4_fill_super()
4831 ext4_msg(sb, KERN_ERR, "Failed to set journal checksum " in ext4_fill_super()
4836 if (test_opt2(sb, JOURNAL_FAST_COMMIT) && in ext4_fill_super()
4837 !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0, in ext4_fill_super()
4839 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4846 switch (test_opt(sb, DATA_FLAGS)) { in ext4_fill_super()
4854 set_opt(sb, ORDERED_DATA); in ext4_fill_super()
4857 set_opt(sb, JOURNAL_DATA); in ext4_fill_super()
4866 ext4_msg(sb, KERN_ERR, "Journal does not support " in ext4_fill_super()
4874 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA && in ext4_fill_super()
4875 test_opt(sb, JOURNAL_ASYNC_COMMIT)) { in ext4_fill_super()
4876 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_fill_super()
4889 if (!test_opt(sb, NO_MBCACHE)) { in ext4_fill_super()
4892 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4897 if (ext4_has_feature_ea_inode(sb)) { in ext4_fill_super()
4900 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
4907 if (ext4_has_feature_verity(sb) && blocksize != PAGE_SIZE) { in ext4_fill_super()
4908 ext4_msg(sb, KERN_ERR, "Unsupported blocksize for fs-verity"); in ext4_fill_super()
4925 if (!ext4_has_feature_bigalloc(sb)) in ext4_fill_super()
4928 err = ext4_calculate_overhead(sb); in ext4_fill_super()
4937 EXT4_SB(sb)->rsv_conversion_wq = in ext4_fill_super()
4939 if (!EXT4_SB(sb)->rsv_conversion_wq) { in ext4_fill_super()
4950 root = ext4_iget(sb, EXT4_ROOT_INO, EXT4_IGET_SPECIAL); in ext4_fill_super()
4952 ext4_msg(sb, KERN_ERR, "get root inode failed"); in ext4_fill_super()
4958 ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck"); in ext4_fill_super()
4964 if (sb->s_encoding) in ext4_fill_super()
4965 sb->s_d_op = &ext4_dentry_ops; in ext4_fill_super()
4968 sb->s_root = d_make_root(root); in ext4_fill_super()
4969 if (!sb->s_root) { in ext4_fill_super()
4970 ext4_msg(sb, KERN_ERR, "get root dentry failed"); in ext4_fill_super()
4975 ret = ext4_setup_super(sb, es, sb_rdonly(sb)); in ext4_fill_super()
4977 sb->s_flags |= SB_RDONLY; in ext4_fill_super()
4982 ext4_set_resv_clusters(sb); in ext4_fill_super()
4984 if (test_opt(sb, BLOCK_VALIDITY)) { in ext4_fill_super()
4985 err = ext4_setup_system_zone(sb); in ext4_fill_super()
4987 ext4_msg(sb, KERN_ERR, "failed to initialize system " in ext4_fill_super()
4992 ext4_fc_replay_cleanup(sb); in ext4_fill_super()
4994 ext4_ext_init(sb); in ext4_fill_super()
4995 err = ext4_mb_init(sb); in ext4_fill_super()
4997 ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", in ext4_fill_super()
5010 block = ext4_count_free_clusters(sb); in ext4_fill_super()
5016 unsigned long freei = ext4_count_free_inodes(sb); in ext4_fill_super()
5028 ext4_superblock_csum_set(sb); in ext4_fill_super()
5031 ext4_count_dirs(sb), GFP_KERNEL); in ext4_fill_super()
5042 ext4_msg(sb, KERN_ERR, "insufficient memory"); in ext4_fill_super()
5046 if (ext4_has_feature_flex_bg(sb)) in ext4_fill_super()
5047 if (!ext4_fill_flex_info(sb)) { in ext4_fill_super()
5048 ext4_msg(sb, KERN_ERR, in ext4_fill_super()
5055 err = ext4_register_li_request(sb, first_not_zeroed); in ext4_fill_super()
5059 err = ext4_register_sysfs(sb); in ext4_fill_super()
5065 if (ext4_has_feature_quota(sb) && !sb_rdonly(sb)) { in ext4_fill_super()
5066 err = ext4_enable_quotas(sb); in ext4_fill_super()
5077 errseq_check_and_advance(&sb->s_bdev->bd_inode->i_mapping->wb_err, in ext4_fill_super()
5079 sb->s_bdev->bd_super = sb; in ext4_fill_super()
5080 EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS; in ext4_fill_super()
5081 ext4_orphan_cleanup(sb, es); in ext4_fill_super()
5082 EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS; in ext4_fill_super()
5084 ext4_msg(sb, KERN_INFO, "recovery complete"); in ext4_fill_super()
5085 err = ext4_mark_recovery_complete(sb, es); in ext4_fill_super()
5089 if (EXT4_SB(sb)->s_journal) { in ext4_fill_super()
5090 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) in ext4_fill_super()
5092 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) in ext4_fill_super()
5099 if (test_opt(sb, DISCARD)) { in ext4_fill_super()
5100 struct request_queue *q = bdev_get_queue(sb->s_bdev); in ext4_fill_super()
5102 ext4_msg(sb, KERN_WARNING, in ext4_fill_super()
5108 ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. " in ext4_fill_super()
5129 ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); in ext4_fill_super()
5133 ext4_unregister_sysfs(sb); in ext4_fill_super()
5136 ext4_unregister_li_request(sb); in ext4_fill_super()
5138 ext4_mb_release(sb); in ext4_fill_super()
5154 ext4_ext_release(sb); in ext4_fill_super()
5155 ext4_release_system_zone(sb); in ext4_fill_super()
5157 dput(sb->s_root); in ext4_fill_super()
5158 sb->s_root = NULL; in ext4_fill_super()
5160 ext4_msg(sb, KERN_ERR, "mount failed"); in ext4_fill_super()
5161 if (EXT4_SB(sb)->rsv_conversion_wq) in ext4_fill_super()
5162 destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq); in ext4_fill_super()
5195 utf8_unload(sb->s_encoding); in ext4_fill_super()
5200 kfree(get_qf_name(sb, sbi, i)); in ext4_fill_super()
5207 invalidate_bdev(sb->s_bdev); in ext4_fill_super()
5208 sb->s_fs_info = NULL; in ext4_fill_super()
5222 static void ext4_init_journal_params(struct super_block *sb, journal_t *journal) in ext4_init_journal_params() argument
5224 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_init_journal_params()
5229 ext4_fc_init(sb, journal); in ext4_init_journal_params()
5232 if (test_opt(sb, BARRIER)) in ext4_init_journal_params()
5236 if (test_opt(sb, DATA_ERR_ABORT)) in ext4_init_journal_params()
5243 static struct inode *ext4_get_journal_inode(struct super_block *sb, in ext4_get_journal_inode() argument
5253 journal_inode = ext4_iget(sb, journal_inum, EXT4_IGET_SPECIAL); in ext4_get_journal_inode()
5255 ext4_msg(sb, KERN_ERR, "no journal found"); in ext4_get_journal_inode()
5261 ext4_msg(sb, KERN_ERR, "journal inode is deleted"); in ext4_get_journal_inode()
5268 ext4_msg(sb, KERN_ERR, "invalid journal inode"); in ext4_get_journal_inode()
5275 static journal_t *ext4_get_journal(struct super_block *sb, in ext4_get_journal() argument
5281 if (WARN_ON_ONCE(!ext4_has_feature_journal(sb))) in ext4_get_journal()
5284 journal_inode = ext4_get_journal_inode(sb, journal_inum); in ext4_get_journal()
5290 ext4_msg(sb, KERN_ERR, "Could not load journal inode"); in ext4_get_journal()
5294 journal->j_private = sb; in ext4_get_journal()
5295 ext4_init_journal_params(sb, journal); in ext4_get_journal()
5299 static journal_t *ext4_get_dev_journal(struct super_block *sb, in ext4_get_dev_journal() argument
5312 if (WARN_ON_ONCE(!ext4_has_feature_journal(sb))) in ext4_get_dev_journal()
5315 bdev = ext4_blkdev_get(j_dev, sb); in ext4_get_dev_journal()
5319 blocksize = sb->s_blocksize; in ext4_get_dev_journal()
5322 ext4_msg(sb, KERN_ERR, in ext4_get_dev_journal()
5331 ext4_msg(sb, KERN_ERR, "couldn't read superblock of " in ext4_get_dev_journal()
5340 ext4_msg(sb, KERN_ERR, "external journal has " in ext4_get_dev_journal()
5348 es->s_checksum != ext4_superblock_csum(sb, es)) { in ext4_get_dev_journal()
5349 ext4_msg(sb, KERN_ERR, "external journal has " in ext4_get_dev_journal()
5355 if (memcmp(EXT4_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { in ext4_get_dev_journal()
5356 ext4_msg(sb, KERN_ERR, "journal UUID does not match"); in ext4_get_dev_journal()
5365 journal = jbd2_journal_init_dev(bdev, sb->s_bdev, in ext4_get_dev_journal()
5368 ext4_msg(sb, KERN_ERR, "failed to create device journal"); in ext4_get_dev_journal()
5371 journal->j_private = sb; in ext4_get_dev_journal()
5373 ext4_msg(sb, KERN_ERR, "I/O error on journal device"); in ext4_get_dev_journal()
5377 ext4_msg(sb, KERN_ERR, "External journal has more than one " in ext4_get_dev_journal()
5382 EXT4_SB(sb)->s_journal_bdev = bdev; in ext4_get_dev_journal()
5383 ext4_init_journal_params(sb, journal); in ext4_get_dev_journal()
5393 static int ext4_load_journal(struct super_block *sb, in ext4_load_journal() argument
5404 if (WARN_ON_ONCE(!ext4_has_feature_journal(sb))) in ext4_load_journal()
5409 ext4_msg(sb, KERN_INFO, "external journal device major/minor " in ext4_load_journal()
5416 ext4_msg(sb, KERN_ERR, in ext4_load_journal()
5422 journal = ext4_get_journal(sb, journal_inum); in ext4_load_journal()
5426 journal = ext4_get_dev_journal(sb, journal_dev); in ext4_load_journal()
5432 really_read_only = bdev_read_only(sb->s_bdev) | journal_dev_ro; in ext4_load_journal()
5434 if (journal_dev_ro && !sb_rdonly(sb)) { in ext4_load_journal()
5435 ext4_msg(sb, KERN_ERR, in ext4_load_journal()
5446 if (ext4_has_feature_journal_needs_recovery(sb)) { in ext4_load_journal()
5447 if (sb_rdonly(sb)) { in ext4_load_journal()
5448 ext4_msg(sb, KERN_INFO, "INFO: recovery " in ext4_load_journal()
5451 ext4_msg(sb, KERN_ERR, "write access " in ext4_load_journal()
5457 ext4_msg(sb, KERN_INFO, "write access will " in ext4_load_journal()
5463 ext4_msg(sb, KERN_INFO, "barriers disabled"); in ext4_load_journal()
5465 if (!ext4_has_feature_journal_needs_recovery(sb)) in ext4_load_journal()
5480 ext4_msg(sb, KERN_ERR, "error loading journal"); in ext4_load_journal()
5484 EXT4_SB(sb)->s_journal = journal; in ext4_load_journal()
5485 err = ext4_clear_journal_err(sb, es); in ext4_load_journal()
5487 EXT4_SB(sb)->s_journal = NULL; in ext4_load_journal()
5497 ext4_commit_super(sb); in ext4_load_journal()
5507 /* Copy state of EXT4_SB(sb) into buffer for on-disk superblock */
5508 static void ext4_update_super(struct super_block *sb) in ext4_update_super() argument
5510 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_update_super()
5525 if (!(sb->s_flags & SB_RDONLY)) in ext4_update_super()
5527 if (sb->s_bdev->bd_part) in ext4_update_super()
5530 ((part_stat_read(sb->s_bdev->bd_part, in ext4_update_super()
5583 ext4_superblock_csum_set(sb); in ext4_update_super()
5587 static int ext4_commit_super(struct super_block *sb) in ext4_commit_super() argument
5589 struct buffer_head *sbh = EXT4_SB(sb)->s_sbh; in ext4_commit_super()
5594 if (block_device_ejected(sb)) in ext4_commit_super()
5597 ext4_update_super(sb); in ext4_commit_super()
5608 ext4_msg(sb, KERN_ERR, "previous I/O error to " in ext4_commit_super()
5616 REQ_SYNC | (test_opt(sb, BARRIER) ? REQ_FUA : 0)); in ext4_commit_super()
5618 ext4_msg(sb, KERN_ERR, "I/O error while writing " in ext4_commit_super()
5631 static int ext4_mark_recovery_complete(struct super_block *sb, in ext4_mark_recovery_complete() argument
5635 journal_t *journal = EXT4_SB(sb)->s_journal; in ext4_mark_recovery_complete()
5637 if (!ext4_has_feature_journal(sb)) { in ext4_mark_recovery_complete()
5639 ext4_error(sb, "Journal got removed while the fs was " in ext4_mark_recovery_complete()
5650 if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) { in ext4_mark_recovery_complete()
5651 ext4_clear_feature_journal_needs_recovery(sb); in ext4_mark_recovery_complete()
5652 ext4_commit_super(sb); in ext4_mark_recovery_complete()
5664 static int ext4_clear_journal_err(struct super_block *sb, in ext4_clear_journal_err() argument
5671 if (!ext4_has_feature_journal(sb)) { in ext4_clear_journal_err()
5672 ext4_error(sb, "Journal got removed while the fs was mounted!"); in ext4_clear_journal_err()
5676 journal = EXT4_SB(sb)->s_journal; in ext4_clear_journal_err()
5687 errstr = ext4_decode_error(sb, j_errno, nbuf); in ext4_clear_journal_err()
5688 ext4_warning(sb, "Filesystem error recorded " in ext4_clear_journal_err()
5690 ext4_warning(sb, "Marking fs in need of filesystem check."); in ext4_clear_journal_err()
5692 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; in ext4_clear_journal_err()
5694 ext4_commit_super(sb); in ext4_clear_journal_err()
5706 int ext4_force_commit(struct super_block *sb) in ext4_force_commit() argument
5710 if (sb_rdonly(sb)) in ext4_force_commit()
5713 journal = EXT4_SB(sb)->s_journal; in ext4_force_commit()
5717 static int ext4_sync_fs(struct super_block *sb, int wait) in ext4_sync_fs() argument
5722 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_sync_fs()
5727 trace_ext4_sync_fs(sb, wait); in ext4_sync_fs()
5733 dquot_writeback_dquots(sb, -1); in ext4_sync_fs()
5750 } else if (wait && test_opt(sb, BARRIER)) in ext4_sync_fs()
5754 err = blkdev_issue_flush(sb->s_bdev, GFP_KERNEL); in ext4_sync_fs()
5770 static int ext4_freeze(struct super_block *sb) in ext4_freeze() argument
5775 if (sb_rdonly(sb)) in ext4_freeze()
5778 journal = EXT4_SB(sb)->s_journal; in ext4_freeze()
5793 ext4_clear_feature_journal_needs_recovery(sb); in ext4_freeze()
5796 error = ext4_commit_super(sb); in ext4_freeze()
5808 static int ext4_unfreeze(struct super_block *sb) in ext4_unfreeze() argument
5810 if (sb_rdonly(sb) || ext4_forced_shutdown(EXT4_SB(sb))) in ext4_unfreeze()
5813 if (EXT4_SB(sb)->s_journal) { in ext4_unfreeze()
5815 ext4_set_feature_journal_needs_recovery(sb); in ext4_unfreeze()
5818 ext4_commit_super(sb); in ext4_unfreeze()
5838 static int ext4_remount(struct super_block *sb, int *flags, char *data) in ext4_remount() argument
5841 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_remount()
5858 old_sb_flags = sb->s_flags; in ext4_remount()
5870 char *qf_name = get_qf_name(sb, sbi, i); in ext4_remount()
5891 sb->s_flags = (sb->s_flags & ~vfs_flags) | (*flags & vfs_flags); in ext4_remount()
5893 if (!parse_options(data, sb, NULL, &journal_ioprio, 1)) { in ext4_remount()
5899 test_opt(sb, JOURNAL_CHECKSUM)) { in ext4_remount()
5900 ext4_msg(sb, KERN_ERR, "changing journal_checksum " in ext4_remount()
5905 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { in ext4_remount()
5906 if (test_opt2(sb, EXPLICIT_DELALLOC)) { in ext4_remount()
5907 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_remount()
5912 if (test_opt(sb, DIOREAD_NOLOCK)) { in ext4_remount()
5913 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_remount()
5918 } else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) { in ext4_remount()
5919 if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) { in ext4_remount()
5920 ext4_msg(sb, KERN_ERR, "can't mount with " in ext4_remount()
5928 ext4_msg(sb, KERN_ERR, "can't enable nombcache during remount"); in ext4_remount()
5933 if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED)) in ext4_remount()
5934 ext4_abort(sb, EXT4_ERR_ESHUTDOWN, "Abort forced by user"); in ext4_remount()
5936 sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | in ext4_remount()
5937 (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); in ext4_remount()
5942 ext4_init_journal_params(sb, sbi->s_journal); in ext4_remount()
5949 if ((bool)(*flags & SB_RDONLY) != sb_rdonly(sb)) { in ext4_remount()
5950 if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED)) { in ext4_remount()
5956 err = sync_filesystem(sb); in ext4_remount()
5959 err = dquot_suspend(sb, -1); in ext4_remount()
5967 sb->s_flags |= SB_RDONLY; in ext4_remount()
5983 ext4_mark_recovery_complete(sb, es); in ext4_remount()
5987 if (ext4_has_feature_readonly(sb) || in ext4_remount()
5988 !ext4_feature_set_ok(sb, 0)) { in ext4_remount()
5998 ext4_get_group_desc(sb, g, NULL); in ext4_remount()
6000 if (!ext4_group_desc_csum_verify(sb, g, gdp)) { in ext4_remount()
6001 ext4_msg(sb, KERN_ERR, in ext4_remount()
6003 g, le16_to_cpu(ext4_group_desc_csum(sb, g, gdp)), in ext4_remount()
6016 ext4_msg(sb, KERN_WARNING, "Couldn't " in ext4_remount()
6031 err = ext4_clear_journal_err(sb, es); in ext4_remount()
6038 err = ext4_setup_super(sb, es, 0); in ext4_remount()
6042 sb->s_flags &= ~SB_RDONLY; in ext4_remount()
6043 if (ext4_has_feature_mmp(sb)) { in ext4_remount()
6044 err = ext4_multi_mount_protect(sb, in ext4_remount()
6060 if (test_opt(sb, BLOCK_VALIDITY) && !sbi->s_system_blks) { in ext4_remount()
6061 err = ext4_setup_system_zone(sb); in ext4_remount()
6067 err = ext4_commit_super(sb); in ext4_remount()
6074 if (sb_any_quota_suspended(sb)) in ext4_remount()
6075 dquot_resume(sb, -1); in ext4_remount()
6076 else if (ext4_has_feature_quota(sb)) { in ext4_remount()
6077 err = ext4_enable_quotas(sb); in ext4_remount()
6086 if (!test_opt(sb, BLOCK_VALIDITY) && sbi->s_system_blks) in ext4_remount()
6087 ext4_release_system_zone(sb); in ext4_remount()
6093 if (sb_rdonly(sb) || !test_opt(sb, INIT_INODE_TABLE)) in ext4_remount()
6094 ext4_unregister_li_request(sb); in ext4_remount()
6097 first_not_zeroed = ext4_has_uninit_itable(sb); in ext4_remount()
6098 ext4_register_li_request(sb, first_not_zeroed); in ext4_remount()
6101 if (!ext4_has_feature_mmp(sb) || sb_rdonly(sb)) in ext4_remount()
6109 *flags = (*flags & ~vfs_flags) | (sb->s_flags & vfs_flags); in ext4_remount()
6111 ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s", orig_data); in ext4_remount()
6120 if ((sb->s_flags & SB_RDONLY) && !(old_sb_flags & SB_RDONLY) && in ext4_remount()
6121 sb_any_quota_suspended(sb)) in ext4_remount()
6122 dquot_resume(sb, -1); in ext4_remount()
6123 sb->s_flags = old_sb_flags; in ext4_remount()
6131 if (!test_opt(sb, BLOCK_VALIDITY) && sbi->s_system_blks) in ext4_remount()
6132 ext4_release_system_zone(sb); in ext4_remount()
6136 to_free[i] = get_qf_name(sb, sbi, i); in ext4_remount()
6143 if (!ext4_has_feature_mmp(sb) || sb_rdonly(sb)) in ext4_remount()
6150 static int ext4_statfs_project(struct super_block *sb, in ext4_statfs_project() argument
6159 dquot = dqget(sb, qid); in ext4_statfs_project()
6166 limit >>= sb->s_blocksize_bits; in ext4_statfs_project()
6170 dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; in ext4_statfs_project()
6194 struct super_block *sb = dentry->d_sb; in ext4_statfs() local
6195 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_statfs()
6202 if (!test_opt(sb, MINIX_DF)) in ext4_statfs()
6206 buf->f_bsize = sb->s_blocksize; in ext4_statfs()
6225 sb_has_quota_limits_enabled(sb, PRJQUOTA)) in ext4_statfs()
6226 ext4_statfs_project(sb, EXT4_I(dentry->d_inode)->i_projid, buf); in ext4_statfs()
6298 struct super_block *sb = dquot->dq_sb; in ext4_mark_dquot_dirty() local
6299 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_mark_dquot_dirty()
6302 if (ext4_has_feature_quota(sb) || in ext4_mark_dquot_dirty()
6311 static int ext4_write_info(struct super_block *sb, int type) in ext4_write_info() argument
6317 handle = ext4_journal_start_sb(sb, EXT4_HT_QUOTA, 2); in ext4_write_info()
6320 ret = dquot_commit_info(sb, type); in ext4_write_info()
6331 static int ext4_quota_on_mount(struct super_block *sb, int type) in ext4_quota_on_mount() argument
6333 return dquot_quota_on_mount(sb, get_qf_name(sb, EXT4_SB(sb), type), in ext4_quota_on_mount()
6334 EXT4_SB(sb)->s_jquota_fmt, type); in ext4_quota_on_mount()
6354 static int ext4_quota_on(struct super_block *sb, int type, int format_id, in ext4_quota_on() argument
6359 if (!test_opt(sb, QUOTA)) in ext4_quota_on()
6363 if (path->dentry->d_sb != sb) in ext4_quota_on()
6371 if (EXT4_SB(sb)->s_qf_names[type]) { in ext4_quota_on()
6373 if (path->dentry->d_parent != sb->s_root) in ext4_quota_on()
6374 ext4_msg(sb, KERN_WARNING, in ext4_quota_on()
6377 sb_dqopt(sb)->flags |= DQUOT_NOLIST_DIRTY; in ext4_quota_on()
6383 sb_dqopt(sb)->flags &= ~DQUOT_NOLIST_DIRTY; in ext4_quota_on()
6390 if (EXT4_SB(sb)->s_journal && in ext4_quota_on()
6396 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); in ext4_quota_on()
6397 err = jbd2_journal_flush(EXT4_SB(sb)->s_journal); in ext4_quota_on()
6398 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); in ext4_quota_on()
6404 err = dquot_quota_on(sb, type, format_id, path); in ext4_quota_on()
6426 dquot_quota_off(sb, type); in ext4_quota_on()
6448 static int ext4_quota_enable(struct super_block *sb, int type, int format_id, in ext4_quota_enable() argument
6454 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), in ext4_quota_enable()
6455 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum), in ext4_quota_enable()
6456 le32_to_cpu(EXT4_SB(sb)->s_es->s_prj_quota_inum) in ext4_quota_enable()
6459 BUG_ON(!ext4_has_feature_quota(sb)); in ext4_quota_enable()
6465 ext4_error(sb, "Bad quota inum: %lu, type: %d", in ext4_quota_enable()
6470 qf_inode = ext4_iget(sb, qf_inums[type], EXT4_IGET_SPECIAL); in ext4_quota_enable()
6472 ext4_error(sb, "Bad quota inode: %lu, type: %d", in ext4_quota_enable()
6489 static int ext4_enable_quotas(struct super_block *sb) in ext4_enable_quotas() argument
6493 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), in ext4_enable_quotas()
6494 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum), in ext4_enable_quotas()
6495 le32_to_cpu(EXT4_SB(sb)->s_es->s_prj_quota_inum) in ext4_enable_quotas()
6498 test_opt(sb, USRQUOTA), in ext4_enable_quotas()
6499 test_opt(sb, GRPQUOTA), in ext4_enable_quotas()
6500 test_opt(sb, PRJQUOTA), in ext4_enable_quotas()
6503 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NOLIST_DIRTY; in ext4_enable_quotas()
6506 err = ext4_quota_enable(sb, type, QFMT_VFS_V1, in ext4_enable_quotas()
6510 ext4_warning(sb, in ext4_enable_quotas()
6518 inode = sb_dqopt(sb)->files[type]; in ext4_enable_quotas()
6521 dquot_quota_off(sb, type); in ext4_enable_quotas()
6536 static int ext4_quota_off(struct super_block *sb, int type) in ext4_quota_off() argument
6538 struct inode *inode = sb_dqopt(sb)->files[type]; in ext4_quota_off()
6544 if (test_opt(sb, DELALLOC)) in ext4_quota_off()
6545 sync_filesystem(sb); in ext4_quota_off()
6550 err = dquot_quota_off(sb, type); in ext4_quota_off()
6551 if (err || ext4_has_feature_quota(sb)) in ext4_quota_off()
6577 return dquot_quota_off(sb, type); in ext4_quota_off()
6584 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, in ext4_quota_read() argument
6587 struct inode *inode = sb_dqopt(sb)->files[type]; in ext4_quota_read()
6588 ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); in ext4_quota_read()
6589 int offset = off & (sb->s_blocksize - 1); in ext4_quota_read()
6601 tocopy = sb->s_blocksize - offset < toread ? in ext4_quota_read()
6602 sb->s_blocksize - offset : toread; in ext4_quota_read()
6621 static ssize_t ext4_quota_write(struct super_block *sb, int type, in ext4_quota_write() argument
6624 struct inode *inode = sb_dqopt(sb)->files[type]; in ext4_quota_write()
6625 ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); in ext4_quota_write()
6626 int err = 0, err2 = 0, offset = off & (sb->s_blocksize - 1); in ext4_quota_write()
6632 ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" in ext4_quota_write()
6641 if (sb->s_blocksize - offset < len) { in ext4_quota_write()
6642 ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" in ext4_quota_write()
6702 static inline int ext2_feature_set_ok(struct super_block *sb) in ext2_feature_set_ok() argument
6704 if (ext4_has_unknown_ext2_incompat_features(sb)) in ext2_feature_set_ok()
6706 if (sb_rdonly(sb)) in ext2_feature_set_ok()
6708 if (ext4_has_unknown_ext2_ro_compat_features(sb)) in ext2_feature_set_ok()
6715 static inline int ext2_feature_set_ok(struct super_block *sb) { return 0; } in ext2_feature_set_ok() argument
6731 static inline int ext3_feature_set_ok(struct super_block *sb) in ext3_feature_set_ok() argument
6733 if (ext4_has_unknown_ext3_incompat_features(sb)) in ext3_feature_set_ok()
6735 if (!ext4_has_feature_journal(sb)) in ext3_feature_set_ok()
6737 if (sb_rdonly(sb)) in ext3_feature_set_ok()
6739 if (ext4_has_unknown_ext3_ro_compat_features(sb)) in ext3_feature_set_ok()