Lines Matching refs:nilfs
89 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_set_error() local
92 down_write(&nilfs->ns_sem); in nilfs_set_error()
93 if (!(nilfs->ns_mount_state & NILFS_ERROR_FS)) { in nilfs_set_error()
94 nilfs->ns_mount_state |= NILFS_ERROR_FS; in nilfs_set_error()
103 up_write(&nilfs->ns_sem); in nilfs_set_error()
122 struct the_nilfs *nilfs = sb->s_fs_info; in __nilfs_error() local
139 if (nilfs_test_opt(nilfs, ERRORS_RO)) { in __nilfs_error()
145 if (nilfs_test_opt(nilfs, ERRORS_PANIC)) in __nilfs_error()
174 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_sync_super() local
178 set_buffer_dirty(nilfs->ns_sbh[0]); in nilfs_sync_super()
179 if (nilfs_test_opt(nilfs, BARRIER)) { in nilfs_sync_super()
180 err = __sync_dirty_buffer(nilfs->ns_sbh[0], in nilfs_sync_super()
183 err = sync_dirty_buffer(nilfs->ns_sbh[0]); in nilfs_sync_super()
188 if (err == -EIO && nilfs->ns_sbh[1]) { in nilfs_sync_super()
193 memcpy(nilfs->ns_sbp[1], nilfs->ns_sbp[0], in nilfs_sync_super()
194 nilfs->ns_sbsize); in nilfs_sync_super()
195 nilfs_fall_back_super_block(nilfs); in nilfs_sync_super()
199 struct nilfs_super_block *sbp = nilfs->ns_sbp[0]; in nilfs_sync_super()
201 nilfs->ns_sbwcount++; in nilfs_sync_super()
207 clear_nilfs_discontinued(nilfs); in nilfs_sync_super()
210 if (nilfs->ns_sbh[1]) { in nilfs_sync_super()
212 set_buffer_dirty(nilfs->ns_sbh[1]); in nilfs_sync_super()
213 if (sync_dirty_buffer(nilfs->ns_sbh[1]) < 0) in nilfs_sync_super()
216 if (le64_to_cpu(nilfs->ns_sbp[1]->s_last_cno) < in nilfs_sync_super()
217 le64_to_cpu(nilfs->ns_sbp[0]->s_last_cno)) in nilfs_sync_super()
218 sbp = nilfs->ns_sbp[1]; in nilfs_sync_super()
221 spin_lock(&nilfs->ns_last_segment_lock); in nilfs_sync_super()
222 nilfs->ns_prot_seq = le64_to_cpu(sbp->s_last_seq); in nilfs_sync_super()
223 spin_unlock(&nilfs->ns_last_segment_lock); in nilfs_sync_super()
230 struct the_nilfs *nilfs) in nilfs_set_log_cursor() argument
235 nilfs_count_free_blocks(nilfs, &nfreeblocks); in nilfs_set_log_cursor()
238 spin_lock(&nilfs->ns_last_segment_lock); in nilfs_set_log_cursor()
239 sbp->s_last_seq = cpu_to_le64(nilfs->ns_last_seq); in nilfs_set_log_cursor()
240 sbp->s_last_pseg = cpu_to_le64(nilfs->ns_last_pseg); in nilfs_set_log_cursor()
241 sbp->s_last_cno = cpu_to_le64(nilfs->ns_last_cno); in nilfs_set_log_cursor()
242 spin_unlock(&nilfs->ns_last_segment_lock); in nilfs_set_log_cursor()
248 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_prepare_super() local
249 struct nilfs_super_block **sbp = nilfs->ns_sbp; in nilfs_prepare_super()
255 memcpy(sbp[0], sbp[1], nilfs->ns_sbsize); in nilfs_prepare_super()
262 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_prepare_super()
266 nilfs_swap_super_block(nilfs); in nilfs_prepare_super()
273 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_commit_super() local
274 struct nilfs_super_block **sbp = nilfs->ns_sbp; in nilfs_commit_super()
279 nilfs->ns_sbwtime = t; in nilfs_commit_super()
282 sbp[0]->s_sum = cpu_to_le32(crc32_le(nilfs->ns_crc_seed, in nilfs_commit_super()
284 nilfs->ns_sbsize)); in nilfs_commit_super()
288 sbp[1]->s_sum = cpu_to_le32(crc32_le(nilfs->ns_crc_seed, in nilfs_commit_super()
290 nilfs->ns_sbsize)); in nilfs_commit_super()
292 clear_nilfs_sb_dirty(nilfs); in nilfs_commit_super()
293 nilfs->ns_flushed_device = 1; in nilfs_commit_super()
309 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_cleanup_super() local
316 sbp[0]->s_state = cpu_to_le16(nilfs->ns_mount_state); in nilfs_cleanup_super()
317 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_cleanup_super()
339 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_move_2nd_super() local
348 if (nilfs->ns_sbh[1] && in nilfs_move_2nd_super()
349 nilfs->ns_sbh[1]->b_blocknr > nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
351 blocknr = nilfs->ns_sbh[1]->b_blocknr; in nilfs_move_2nd_super()
352 } else if (nilfs->ns_sbh[0]->b_blocknr > nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
354 blocknr = nilfs->ns_sbh[0]->b_blocknr; in nilfs_move_2nd_super()
359 if (sb2i >= 0 && (u64)blocknr << nilfs->ns_blocksize_bits == sb2off) in nilfs_move_2nd_super()
363 newblocknr = sb2off >> nilfs->ns_blocksize_bits; in nilfs_move_2nd_super()
364 offset = sb2off & (nilfs->ns_blocksize - 1); in nilfs_move_2nd_super()
374 memset(nsbp, 0, nilfs->ns_blocksize); in nilfs_move_2nd_super()
377 memcpy(nsbp, nilfs->ns_sbp[sb2i], nilfs->ns_sbsize); in nilfs_move_2nd_super()
378 brelse(nilfs->ns_sbh[sb2i]); in nilfs_move_2nd_super()
379 nilfs->ns_sbh[sb2i] = nsbh; in nilfs_move_2nd_super()
380 nilfs->ns_sbp[sb2i] = nsbp; in nilfs_move_2nd_super()
381 } else if (nilfs->ns_sbh[0]->b_blocknr < nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
383 nilfs->ns_sbh[1] = nsbh; in nilfs_move_2nd_super()
384 nilfs->ns_sbp[1] = nsbp; in nilfs_move_2nd_super()
399 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_resize_fs() local
415 down_write(&nilfs->ns_segctor_sem); in nilfs_resize_fs()
418 newnsegs = sb2off >> nilfs->ns_blocksize_bits; in nilfs_resize_fs()
419 do_div(newnsegs, nilfs->ns_blocks_per_segment); in nilfs_resize_fs()
421 ret = nilfs_sufile_resize(nilfs->ns_sufile, newnsegs); in nilfs_resize_fs()
422 up_write(&nilfs->ns_segctor_sem); in nilfs_resize_fs()
430 down_write(&nilfs->ns_sem); in nilfs_resize_fs()
435 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_resize_fs()
444 sbp[0]->s_nsegments = cpu_to_le64(nilfs->ns_nsegments); in nilfs_resize_fs()
446 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_resize_fs()
449 up_write(&nilfs->ns_sem); in nilfs_resize_fs()
458 nilfs_sufile_set_alloc_range(nilfs->ns_sufile, 0, newnsegs - 1); in nilfs_resize_fs()
465 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_put_super() local
470 down_write(&nilfs->ns_sem); in nilfs_put_super()
472 up_write(&nilfs->ns_sem); in nilfs_put_super()
475 iput(nilfs->ns_sufile); in nilfs_put_super()
476 iput(nilfs->ns_cpfile); in nilfs_put_super()
477 iput(nilfs->ns_dat); in nilfs_put_super()
479 destroy_nilfs(nilfs); in nilfs_put_super()
485 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_sync_fs() local
493 down_write(&nilfs->ns_sem); in nilfs_sync_fs()
494 if (nilfs_sb_dirty(nilfs)) { in nilfs_sync_fs()
495 sbp = nilfs_prepare_super(sb, nilfs_sb_will_flip(nilfs)); in nilfs_sync_fs()
497 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_sync_fs()
501 up_write(&nilfs->ns_sem); in nilfs_sync_fs()
504 err = nilfs_flush_device(nilfs); in nilfs_sync_fs()
512 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_attach_checkpoint() local
519 nilfs, curr_mnt ? NILFS_CPTREE_CURRENT_CNO : cno); in nilfs_attach_checkpoint()
526 down_read(&nilfs->ns_segctor_sem); in nilfs_attach_checkpoint()
527 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, in nilfs_attach_checkpoint()
529 up_read(&nilfs->ns_segctor_sem); in nilfs_attach_checkpoint()
540 err = nilfs_ifile_read(sb, root, nilfs->ns_inode_size, in nilfs_attach_checkpoint()
550 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); in nilfs_attach_checkpoint()
557 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); in nilfs_attach_checkpoint()
566 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_freeze() local
573 down_write(&nilfs->ns_sem); in nilfs_freeze()
575 up_write(&nilfs->ns_sem); in nilfs_freeze()
581 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_unfreeze() local
586 down_write(&nilfs->ns_sem); in nilfs_unfreeze()
588 up_write(&nilfs->ns_sem); in nilfs_unfreeze()
596 struct the_nilfs *nilfs = root->nilfs; in nilfs_statfs() local
611 blocks = nilfs->ns_blocks_per_segment * nilfs->ns_nsegments in nilfs_statfs()
612 - nilfs->ns_first_data_block; in nilfs_statfs()
613 nrsvblocks = nilfs->ns_nrsvsegs * nilfs->ns_blocks_per_segment; in nilfs_statfs()
623 err = nilfs_count_free_blocks(nilfs, &nfreeblocks); in nilfs_statfs()
662 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_show_options() local
665 if (!nilfs_test_opt(nilfs, BARRIER)) in nilfs_show_options()
669 if (nilfs_test_opt(nilfs, ERRORS_PANIC)) in nilfs_show_options()
671 if (nilfs_test_opt(nilfs, ERRORS_CONT)) in nilfs_show_options()
673 if (nilfs_test_opt(nilfs, STRICT_ORDER)) in nilfs_show_options()
675 if (nilfs_test_opt(nilfs, NORECOVERY)) in nilfs_show_options()
677 if (nilfs_test_opt(nilfs, DISCARD)) in nilfs_show_options()
719 struct the_nilfs *nilfs = sb->s_fs_info; in parse_options() local
735 nilfs_set_opt(nilfs, BARRIER); in parse_options()
738 nilfs_clear_opt(nilfs, BARRIER); in parse_options()
743 nilfs_clear_opt(nilfs, STRICT_ORDER); in parse_options()
746 nilfs_set_opt(nilfs, STRICT_ORDER); in parse_options()
751 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_PANIC); in parse_options()
754 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_RO); in parse_options()
757 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_CONT); in parse_options()
768 nilfs_set_opt(nilfs, NORECOVERY); in parse_options()
771 nilfs_set_opt(nilfs, DISCARD); in parse_options()
774 nilfs_clear_opt(nilfs, DISCARD); in parse_options()
788 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_set_default_options() local
790 nilfs->ns_mount_opt = in nilfs_set_default_options()
796 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_setup_super() local
812 if (nilfs->ns_mount_state & NILFS_ERROR_FS) { in nilfs_setup_super()
830 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_setup_super()
852 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_store_magic_and_option() local
863 nilfs->ns_resuid = le16_to_cpu(sbp->s_def_resuid); in nilfs_store_magic_and_option()
864 nilfs->ns_resgid = le16_to_cpu(sbp->s_def_resgid); in nilfs_store_magic_and_option()
865 nilfs->ns_interval = le32_to_cpu(sbp->s_c_interval); in nilfs_store_magic_and_option()
866 nilfs->ns_watermark = le32_to_cpu(sbp->s_c_block_max); in nilfs_store_magic_and_option()
946 struct the_nilfs *nilfs = s->s_fs_info; in nilfs_attach_snapshot() local
950 mutex_lock(&nilfs->ns_snapshot_mount_mutex); in nilfs_attach_snapshot()
952 down_read(&nilfs->ns_segctor_sem); in nilfs_attach_snapshot()
953 ret = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, cno); in nilfs_attach_snapshot()
954 up_read(&nilfs->ns_segctor_sem); in nilfs_attach_snapshot()
976 mutex_unlock(&nilfs->ns_snapshot_mount_mutex); in nilfs_attach_snapshot()
994 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_checkpoint_is_mounted() local
1000 if (cno > nilfs->ns_cno) in nilfs_checkpoint_is_mounted()
1003 if (cno >= nilfs_last_cno(nilfs)) in nilfs_checkpoint_is_mounted()
1007 root = nilfs_lookup_root(nilfs, cno); in nilfs_checkpoint_is_mounted()
1035 struct the_nilfs *nilfs; in nilfs_fill_super() local
1040 nilfs = alloc_nilfs(sb); in nilfs_fill_super()
1041 if (!nilfs) in nilfs_fill_super()
1044 sb->s_fs_info = nilfs; in nilfs_fill_super()
1046 err = init_nilfs(nilfs, sb, (char *)data); in nilfs_fill_super()
1058 err = load_nilfs(nilfs, sb); in nilfs_fill_super()
1062 cno = nilfs_last_cno(nilfs); in nilfs_fill_super()
1084 down_write(&nilfs->ns_sem); in nilfs_fill_super()
1086 up_write(&nilfs->ns_sem); in nilfs_fill_super()
1098 iput(nilfs->ns_sufile); in nilfs_fill_super()
1099 iput(nilfs->ns_cpfile); in nilfs_fill_super()
1100 iput(nilfs->ns_dat); in nilfs_fill_super()
1103 destroy_nilfs(nilfs); in nilfs_fill_super()
1109 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_remount() local
1116 old_mount_opt = nilfs->ns_mount_opt; in nilfs_remount()
1126 if (!nilfs_valid_fs(nilfs)) { in nilfs_remount()
1143 down_write(&nilfs->ns_sem); in nilfs_remount()
1145 up_write(&nilfs->ns_sem); in nilfs_remount()
1155 down_read(&nilfs->ns_sem); in nilfs_remount()
1156 features = le64_to_cpu(nilfs->ns_sbp[0]->s_feature_compat_ro) & in nilfs_remount()
1158 up_read(&nilfs->ns_sem); in nilfs_remount()
1174 down_write(&nilfs->ns_sem); in nilfs_remount()
1176 up_write(&nilfs->ns_sem); in nilfs_remount()
1183 nilfs->ns_mount_opt = old_mount_opt; in nilfs_remount()