Lines Matching refs:sb
63 static int nilfs_setup_super(struct super_block *sb, int is_mount);
64 static int nilfs_remount(struct super_block *sb, int *flags, char *data);
66 void __nilfs_msg(struct super_block *sb, const char *fmt, ...) in __nilfs_msg() argument
78 if (sb) in __nilfs_msg()
80 KERN_SOH_ASCII, level, sb->s_id, &vaf); in __nilfs_msg()
88 static void nilfs_set_error(struct super_block *sb) in nilfs_set_error() argument
90 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_set_error()
96 sbp = nilfs_prepare_super(sb, 0); in nilfs_set_error()
101 nilfs_commit_super(sb, NILFS_SB_COMMIT_ALL); in nilfs_set_error()
120 void __nilfs_error(struct super_block *sb, const char *function, in __nilfs_error() argument
123 struct the_nilfs *nilfs = sb->s_fs_info; in __nilfs_error()
133 sb->s_id, function, &vaf); in __nilfs_error()
137 if (!sb_rdonly(sb)) { in __nilfs_error()
138 nilfs_set_error(sb); in __nilfs_error()
142 sb->s_flags |= SB_RDONLY; in __nilfs_error()
148 sb->s_id); in __nilfs_error()
151 struct inode *nilfs_alloc_inode(struct super_block *sb) in nilfs_alloc_inode() argument
174 static int nilfs_sync_super(struct super_block *sb, int flag) in nilfs_sync_super() argument
176 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_sync_super()
189 nilfs_err(sb, "unable to write superblock: err=%d", err); in nilfs_sync_super()
247 struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb, in nilfs_prepare_super() argument
250 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_prepare_super()
259 nilfs_crit(sb, "superblock broke"); in nilfs_prepare_super()
273 int nilfs_commit_super(struct super_block *sb, int flag) in nilfs_commit_super() argument
275 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_commit_super()
298 return nilfs_sync_super(sb, flag); in nilfs_commit_super()
309 int nilfs_cleanup_super(struct super_block *sb) in nilfs_cleanup_super() argument
311 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_cleanup_super()
316 sbp = nilfs_prepare_super(sb, 0); in nilfs_cleanup_super()
329 ret = nilfs_commit_super(sb, flag); in nilfs_cleanup_super()
339 static int nilfs_move_2nd_super(struct super_block *sb, loff_t sb2off) in nilfs_move_2nd_super() argument
341 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_move_2nd_super()
367 nsbh = sb_getblk(sb, newblocknr); in nilfs_move_2nd_super()
369 nilfs_warn(sb, in nilfs_move_2nd_super()
420 int nilfs_resize_fs(struct super_block *sb, __u64 newsize) in nilfs_resize_fs() argument
422 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_resize_fs()
429 devsize = i_size_read(sb->s_bdev->bd_inode); in nilfs_resize_fs()
458 ret = nilfs_construct_segment(sb); in nilfs_resize_fs()
463 nilfs_move_2nd_super(sb, sb2off); in nilfs_resize_fs()
465 sbp = nilfs_prepare_super(sb, 0); in nilfs_resize_fs()
479 ret = nilfs_commit_super(sb, NILFS_SB_COMMIT_ALL); in nilfs_resize_fs()
495 static void nilfs_put_super(struct super_block *sb) in nilfs_put_super() argument
497 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_put_super()
499 nilfs_detach_log_writer(sb); in nilfs_put_super()
501 if (!sb_rdonly(sb)) { in nilfs_put_super()
503 nilfs_cleanup_super(sb); in nilfs_put_super()
513 sb->s_fs_info = NULL; in nilfs_put_super()
516 static int nilfs_sync_fs(struct super_block *sb, int wait) in nilfs_sync_fs() argument
518 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_sync_fs()
524 err = nilfs_construct_segment(sb); in nilfs_sync_fs()
528 sbp = nilfs_prepare_super(sb, nilfs_sb_will_flip(nilfs)); in nilfs_sync_fs()
531 nilfs_commit_super(sb, NILFS_SB_COMMIT); in nilfs_sync_fs()
542 int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt, in nilfs_attach_checkpoint() argument
545 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_attach_checkpoint()
565 nilfs_err(sb, in nilfs_attach_checkpoint()
573 err = nilfs_ifile_read(sb, root, nilfs->ns_inode_size, in nilfs_attach_checkpoint()
597 static int nilfs_freeze(struct super_block *sb) in nilfs_freeze() argument
599 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_freeze()
602 if (sb_rdonly(sb)) in nilfs_freeze()
607 err = nilfs_cleanup_super(sb); in nilfs_freeze()
612 static int nilfs_unfreeze(struct super_block *sb) in nilfs_unfreeze() argument
614 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_unfreeze()
616 if (sb_rdonly(sb)) in nilfs_unfreeze()
620 nilfs_setup_super(sb, false); in nilfs_unfreeze()
627 struct super_block *sb = dentry->d_sb; in nilfs_statfs() local
630 u64 id = huge_encode_dev(sb->s_bdev->bd_dev); in nilfs_statfs()
663 nilfs_warn(sb, "failed to count free inodes: err=%d", err); in nilfs_statfs()
679 buf->f_bsize = sb->s_blocksize; in nilfs_statfs()
694 struct super_block *sb = dentry->d_sb; in nilfs_show_options() local
695 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_show_options()
750 static int parse_options(char *options, struct super_block *sb, int is_remount) in parse_options() argument
752 struct the_nilfs *nilfs = sb->s_fs_info; in parse_options()
794 nilfs_err(sb, in parse_options()
810 nilfs_err(sb, "unrecognized mount option \"%s\"", p); in parse_options()
818 nilfs_set_default_options(struct super_block *sb, in nilfs_set_default_options() argument
821 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_set_default_options()
827 static int nilfs_setup_super(struct super_block *sb, int is_mount) in nilfs_setup_super() argument
829 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_setup_super()
835 sbp = nilfs_prepare_super(sb, 0); in nilfs_setup_super()
846 nilfs_warn(sb, "mounting fs with errors"); in nilfs_setup_super()
849 nilfs_warn(sb, "maximal mount count reached"); in nilfs_setup_super()
864 return nilfs_commit_super(sb, NILFS_SB_COMMIT_ALL); in nilfs_setup_super()
867 struct nilfs_super_block *nilfs_read_super_block(struct super_block *sb, in nilfs_read_super_block() argument
875 *pbh = sb_bread(sb, sb_index); in nilfs_read_super_block()
881 int nilfs_store_magic_and_option(struct super_block *sb, in nilfs_store_magic_and_option() argument
885 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_store_magic_and_option()
887 sb->s_magic = le16_to_cpu(sbp->s_magic); in nilfs_store_magic_and_option()
891 sb->s_flags |= SB_NOATIME; in nilfs_store_magic_and_option()
894 nilfs_set_default_options(sb, sbp); in nilfs_store_magic_and_option()
901 return !parse_options(data, sb, 0) ? -EINVAL : 0; in nilfs_store_magic_and_option()
904 int nilfs_check_feature_compatibility(struct super_block *sb, in nilfs_check_feature_compatibility() argument
912 nilfs_err(sb, in nilfs_check_feature_compatibility()
919 if (!sb_rdonly(sb) && features) { in nilfs_check_feature_compatibility()
920 nilfs_err(sb, in nilfs_check_feature_compatibility()
928 static int nilfs_get_root_dentry(struct super_block *sb, in nilfs_get_root_dentry() argument
936 inode = nilfs_iget(sb, root, NILFS_ROOT_INO); in nilfs_get_root_dentry()
939 nilfs_err(sb, "error %d getting root inode", ret); in nilfs_get_root_dentry()
944 nilfs_err(sb, "corrupt root inode"); in nilfs_get_root_dentry()
972 nilfs_err(sb, "error %d getting root dentry", ret); in nilfs_get_root_dentry()
1025 int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno) in nilfs_checkpoint_is_mounted() argument
1027 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_checkpoint_is_mounted()
1042 inode = nilfs_ilookup(sb, root, NILFS_ROOT_INO); in nilfs_checkpoint_is_mounted()
1066 nilfs_fill_super(struct super_block *sb, void *data, int silent) in nilfs_fill_super() argument
1073 nilfs = alloc_nilfs(sb); in nilfs_fill_super()
1077 sb->s_fs_info = nilfs; in nilfs_fill_super()
1079 err = init_nilfs(nilfs, sb, (char *)data); in nilfs_fill_super()
1083 sb->s_op = &nilfs_sops; in nilfs_fill_super()
1084 sb->s_export_op = &nilfs_export_ops; in nilfs_fill_super()
1085 sb->s_root = NULL; in nilfs_fill_super()
1086 sb->s_time_gran = 1; in nilfs_fill_super()
1087 sb->s_max_links = NILFS_LINK_MAX; in nilfs_fill_super()
1089 sb->s_bdi = bdi_get(sb->s_bdev->bd_disk->bdi); in nilfs_fill_super()
1091 err = load_nilfs(nilfs, sb); in nilfs_fill_super()
1096 err = nilfs_attach_checkpoint(sb, cno, true, &fsroot); in nilfs_fill_super()
1098 nilfs_err(sb, in nilfs_fill_super()
1104 if (!sb_rdonly(sb)) { in nilfs_fill_super()
1105 err = nilfs_attach_log_writer(sb, fsroot); in nilfs_fill_super()
1110 err = nilfs_get_root_dentry(sb, fsroot, &sb->s_root); in nilfs_fill_super()
1116 if (!sb_rdonly(sb)) { in nilfs_fill_super()
1118 nilfs_setup_super(sb, true); in nilfs_fill_super()
1125 nilfs_detach_log_writer(sb); in nilfs_fill_super()
1141 static int nilfs_remount(struct super_block *sb, int *flags, char *data) in nilfs_remount() argument
1143 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_remount()
1148 sync_filesystem(sb); in nilfs_remount()
1149 old_sb_flags = sb->s_flags; in nilfs_remount()
1152 if (!parse_options(data, sb, 1)) { in nilfs_remount()
1156 sb->s_flags = (sb->s_flags & ~SB_POSIXACL); in nilfs_remount()
1161 nilfs_warn(sb, in nilfs_remount()
1166 if ((bool)(*flags & SB_RDONLY) == sb_rdonly(sb)) in nilfs_remount()
1169 sb->s_flags |= SB_RDONLY; in nilfs_remount()
1176 nilfs_cleanup_super(sb); in nilfs_remount()
1192 nilfs_warn(sb, in nilfs_remount()
1199 sb->s_flags &= ~SB_RDONLY; in nilfs_remount()
1201 root = NILFS_I(d_inode(sb->s_root))->i_root; in nilfs_remount()
1202 err = nilfs_attach_log_writer(sb, root); in nilfs_remount()
1207 nilfs_setup_super(sb, true); in nilfs_remount()
1214 sb->s_flags = old_sb_flags; in nilfs_remount()