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()
175 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_sync_super() local
179 set_buffer_dirty(nilfs->ns_sbh[0]); in nilfs_sync_super()
180 if (nilfs_test_opt(nilfs, BARRIER)) { in nilfs_sync_super()
181 err = __sync_dirty_buffer(nilfs->ns_sbh[0], in nilfs_sync_super()
184 err = sync_dirty_buffer(nilfs->ns_sbh[0]); in nilfs_sync_super()
189 if (err == -EIO && nilfs->ns_sbh[1]) { in nilfs_sync_super()
194 memcpy(nilfs->ns_sbp[1], nilfs->ns_sbp[0], in nilfs_sync_super()
195 nilfs->ns_sbsize); in nilfs_sync_super()
196 nilfs_fall_back_super_block(nilfs); in nilfs_sync_super()
200 struct nilfs_super_block *sbp = nilfs->ns_sbp[0]; in nilfs_sync_super()
202 nilfs->ns_sbwcount++; in nilfs_sync_super()
208 clear_nilfs_discontinued(nilfs); in nilfs_sync_super()
211 if (nilfs->ns_sbh[1]) { in nilfs_sync_super()
213 set_buffer_dirty(nilfs->ns_sbh[1]); in nilfs_sync_super()
214 if (sync_dirty_buffer(nilfs->ns_sbh[1]) < 0) in nilfs_sync_super()
217 if (le64_to_cpu(nilfs->ns_sbp[1]->s_last_cno) < in nilfs_sync_super()
218 le64_to_cpu(nilfs->ns_sbp[0]->s_last_cno)) in nilfs_sync_super()
219 sbp = nilfs->ns_sbp[1]; in nilfs_sync_super()
222 spin_lock(&nilfs->ns_last_segment_lock); in nilfs_sync_super()
223 nilfs->ns_prot_seq = le64_to_cpu(sbp->s_last_seq); in nilfs_sync_super()
224 spin_unlock(&nilfs->ns_last_segment_lock); in nilfs_sync_super()
231 struct the_nilfs *nilfs) in nilfs_set_log_cursor() argument
236 nilfs_count_free_blocks(nilfs, &nfreeblocks); in nilfs_set_log_cursor()
239 spin_lock(&nilfs->ns_last_segment_lock); in nilfs_set_log_cursor()
240 sbp->s_last_seq = cpu_to_le64(nilfs->ns_last_seq); in nilfs_set_log_cursor()
241 sbp->s_last_pseg = cpu_to_le64(nilfs->ns_last_pseg); in nilfs_set_log_cursor()
242 sbp->s_last_cno = cpu_to_le64(nilfs->ns_last_cno); in nilfs_set_log_cursor()
243 spin_unlock(&nilfs->ns_last_segment_lock); in nilfs_set_log_cursor()
249 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_prepare_super() local
250 struct nilfs_super_block **sbp = nilfs->ns_sbp; in nilfs_prepare_super()
256 memcpy(sbp[0], sbp[1], nilfs->ns_sbsize); in nilfs_prepare_super()
263 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_prepare_super()
267 nilfs_swap_super_block(nilfs); in nilfs_prepare_super()
274 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_commit_super() local
275 struct nilfs_super_block **sbp = nilfs->ns_sbp; in nilfs_commit_super()
280 nilfs->ns_sbwtime = t; in nilfs_commit_super()
283 sbp[0]->s_sum = cpu_to_le32(crc32_le(nilfs->ns_crc_seed, in nilfs_commit_super()
285 nilfs->ns_sbsize)); in nilfs_commit_super()
289 sbp[1]->s_sum = cpu_to_le32(crc32_le(nilfs->ns_crc_seed, in nilfs_commit_super()
291 nilfs->ns_sbsize)); in nilfs_commit_super()
293 clear_nilfs_sb_dirty(nilfs); in nilfs_commit_super()
294 nilfs->ns_flushed_device = 1; in nilfs_commit_super()
310 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_cleanup_super() local
317 sbp[0]->s_state = cpu_to_le16(nilfs->ns_mount_state); in nilfs_cleanup_super()
318 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_cleanup_super()
340 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_move_2nd_super() local
349 if (nilfs->ns_sbh[1] && in nilfs_move_2nd_super()
350 nilfs->ns_sbh[1]->b_blocknr > nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
352 blocknr = nilfs->ns_sbh[1]->b_blocknr; in nilfs_move_2nd_super()
353 } else if (nilfs->ns_sbh[0]->b_blocknr > nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
355 blocknr = nilfs->ns_sbh[0]->b_blocknr; in nilfs_move_2nd_super()
360 if (sb2i >= 0 && (u64)blocknr << nilfs->ns_blocksize_bits == sb2off) in nilfs_move_2nd_super()
364 newblocknr = sb2off >> nilfs->ns_blocksize_bits; in nilfs_move_2nd_super()
365 offset = sb2off & (nilfs->ns_blocksize - 1); in nilfs_move_2nd_super()
375 memset(nsbp, 0, nilfs->ns_blocksize); in nilfs_move_2nd_super()
378 memcpy(nsbp, nilfs->ns_sbp[sb2i], nilfs->ns_sbsize); in nilfs_move_2nd_super()
379 brelse(nilfs->ns_sbh[sb2i]); in nilfs_move_2nd_super()
380 nilfs->ns_sbh[sb2i] = nsbh; in nilfs_move_2nd_super()
381 nilfs->ns_sbp[sb2i] = nsbp; in nilfs_move_2nd_super()
382 } else if (nilfs->ns_sbh[0]->b_blocknr < nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
384 nilfs->ns_sbh[1] = nsbh; in nilfs_move_2nd_super()
385 nilfs->ns_sbp[1] = nsbp; in nilfs_move_2nd_super()
400 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_resize_fs() local
416 down_write(&nilfs->ns_segctor_sem); in nilfs_resize_fs()
419 newnsegs = sb2off >> nilfs->ns_blocksize_bits; in nilfs_resize_fs()
420 do_div(newnsegs, nilfs->ns_blocks_per_segment); in nilfs_resize_fs()
422 ret = nilfs_sufile_resize(nilfs->ns_sufile, newnsegs); in nilfs_resize_fs()
423 up_write(&nilfs->ns_segctor_sem); in nilfs_resize_fs()
431 down_write(&nilfs->ns_sem); in nilfs_resize_fs()
436 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_resize_fs()
445 sbp[0]->s_nsegments = cpu_to_le64(nilfs->ns_nsegments); in nilfs_resize_fs()
447 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_resize_fs()
450 up_write(&nilfs->ns_sem); in nilfs_resize_fs()
459 nilfs_sufile_set_alloc_range(nilfs->ns_sufile, 0, newnsegs - 1); in nilfs_resize_fs()
466 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_put_super() local
471 down_write(&nilfs->ns_sem); in nilfs_put_super()
473 up_write(&nilfs->ns_sem); in nilfs_put_super()
476 iput(nilfs->ns_sufile); in nilfs_put_super()
477 iput(nilfs->ns_cpfile); in nilfs_put_super()
478 iput(nilfs->ns_dat); in nilfs_put_super()
480 destroy_nilfs(nilfs); in nilfs_put_super()
486 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_sync_fs() local
494 down_write(&nilfs->ns_sem); in nilfs_sync_fs()
495 if (nilfs_sb_dirty(nilfs)) { in nilfs_sync_fs()
496 sbp = nilfs_prepare_super(sb, nilfs_sb_will_flip(nilfs)); in nilfs_sync_fs()
498 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_sync_fs()
502 up_write(&nilfs->ns_sem); in nilfs_sync_fs()
505 err = nilfs_flush_device(nilfs); in nilfs_sync_fs()
513 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_attach_checkpoint() local
520 nilfs, curr_mnt ? NILFS_CPTREE_CURRENT_CNO : cno); in nilfs_attach_checkpoint()
527 down_read(&nilfs->ns_segctor_sem); in nilfs_attach_checkpoint()
528 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, in nilfs_attach_checkpoint()
530 up_read(&nilfs->ns_segctor_sem); in nilfs_attach_checkpoint()
541 err = nilfs_ifile_read(sb, root, nilfs->ns_inode_size, in nilfs_attach_checkpoint()
551 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); in nilfs_attach_checkpoint()
558 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); in nilfs_attach_checkpoint()
567 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_freeze() local
574 down_write(&nilfs->ns_sem); in nilfs_freeze()
576 up_write(&nilfs->ns_sem); in nilfs_freeze()
582 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_unfreeze() local
587 down_write(&nilfs->ns_sem); in nilfs_unfreeze()
589 up_write(&nilfs->ns_sem); in nilfs_unfreeze()
597 struct the_nilfs *nilfs = root->nilfs; in nilfs_statfs() local
612 blocks = nilfs->ns_blocks_per_segment * nilfs->ns_nsegments in nilfs_statfs()
613 - nilfs->ns_first_data_block; in nilfs_statfs()
614 nrsvblocks = nilfs->ns_nrsvsegs * nilfs->ns_blocks_per_segment; in nilfs_statfs()
624 err = nilfs_count_free_blocks(nilfs, &nfreeblocks); in nilfs_statfs()
663 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_show_options() local
666 if (!nilfs_test_opt(nilfs, BARRIER)) in nilfs_show_options()
670 if (nilfs_test_opt(nilfs, ERRORS_PANIC)) in nilfs_show_options()
672 if (nilfs_test_opt(nilfs, ERRORS_CONT)) in nilfs_show_options()
674 if (nilfs_test_opt(nilfs, STRICT_ORDER)) in nilfs_show_options()
676 if (nilfs_test_opt(nilfs, NORECOVERY)) in nilfs_show_options()
678 if (nilfs_test_opt(nilfs, DISCARD)) in nilfs_show_options()
720 struct the_nilfs *nilfs = sb->s_fs_info; in parse_options() local
736 nilfs_set_opt(nilfs, BARRIER); in parse_options()
739 nilfs_clear_opt(nilfs, BARRIER); in parse_options()
744 nilfs_clear_opt(nilfs, STRICT_ORDER); in parse_options()
747 nilfs_set_opt(nilfs, STRICT_ORDER); in parse_options()
752 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_PANIC); in parse_options()
755 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_RO); in parse_options()
758 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_CONT); in parse_options()
769 nilfs_set_opt(nilfs, NORECOVERY); in parse_options()
772 nilfs_set_opt(nilfs, DISCARD); in parse_options()
775 nilfs_clear_opt(nilfs, DISCARD); in parse_options()
789 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_set_default_options() local
791 nilfs->ns_mount_opt = in nilfs_set_default_options()
797 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_setup_super() local
813 if (nilfs->ns_mount_state & NILFS_ERROR_FS) { in nilfs_setup_super()
831 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_setup_super()
853 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_store_magic_and_option() local
864 nilfs->ns_resuid = le16_to_cpu(sbp->s_def_resuid); in nilfs_store_magic_and_option()
865 nilfs->ns_resgid = le16_to_cpu(sbp->s_def_resgid); in nilfs_store_magic_and_option()
866 nilfs->ns_interval = le32_to_cpu(sbp->s_c_interval); in nilfs_store_magic_and_option()
867 nilfs->ns_watermark = le32_to_cpu(sbp->s_c_block_max); in nilfs_store_magic_and_option()
947 struct the_nilfs *nilfs = s->s_fs_info; in nilfs_attach_snapshot() local
951 mutex_lock(&nilfs->ns_snapshot_mount_mutex); in nilfs_attach_snapshot()
953 down_read(&nilfs->ns_segctor_sem); in nilfs_attach_snapshot()
954 ret = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, cno); in nilfs_attach_snapshot()
955 up_read(&nilfs->ns_segctor_sem); in nilfs_attach_snapshot()
977 mutex_unlock(&nilfs->ns_snapshot_mount_mutex); in nilfs_attach_snapshot()
995 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_checkpoint_is_mounted() local
1001 if (cno > nilfs->ns_cno) in nilfs_checkpoint_is_mounted()
1004 if (cno >= nilfs_last_cno(nilfs)) in nilfs_checkpoint_is_mounted()
1008 root = nilfs_lookup_root(nilfs, cno); in nilfs_checkpoint_is_mounted()
1036 struct the_nilfs *nilfs; in nilfs_fill_super() local
1041 nilfs = alloc_nilfs(sb); in nilfs_fill_super()
1042 if (!nilfs) in nilfs_fill_super()
1045 sb->s_fs_info = nilfs; in nilfs_fill_super()
1047 err = init_nilfs(nilfs, sb, (char *)data); in nilfs_fill_super()
1059 err = load_nilfs(nilfs, sb); in nilfs_fill_super()
1063 cno = nilfs_last_cno(nilfs); in nilfs_fill_super()
1085 down_write(&nilfs->ns_sem); in nilfs_fill_super()
1087 up_write(&nilfs->ns_sem); in nilfs_fill_super()
1099 iput(nilfs->ns_sufile); in nilfs_fill_super()
1100 iput(nilfs->ns_cpfile); in nilfs_fill_super()
1101 iput(nilfs->ns_dat); in nilfs_fill_super()
1104 destroy_nilfs(nilfs); in nilfs_fill_super()
1110 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_remount() local
1117 old_mount_opt = nilfs->ns_mount_opt; in nilfs_remount()
1127 if (!nilfs_valid_fs(nilfs)) { in nilfs_remount()
1144 down_write(&nilfs->ns_sem); in nilfs_remount()
1146 up_write(&nilfs->ns_sem); in nilfs_remount()
1156 down_read(&nilfs->ns_sem); in nilfs_remount()
1157 features = le64_to_cpu(nilfs->ns_sbp[0]->s_feature_compat_ro) & in nilfs_remount()
1159 up_read(&nilfs->ns_sem); in nilfs_remount()
1175 down_write(&nilfs->ns_sem); in nilfs_remount()
1177 up_write(&nilfs->ns_sem); in nilfs_remount()
1184 nilfs->ns_mount_opt = old_mount_opt; in nilfs_remount()