Lines Matching refs:nilfs
83 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_set_error() local
86 down_write(&nilfs->ns_sem); in nilfs_set_error()
87 if (!(nilfs->ns_mount_state & NILFS_ERROR_FS)) { in nilfs_set_error()
88 nilfs->ns_mount_state |= NILFS_ERROR_FS; in nilfs_set_error()
97 up_write(&nilfs->ns_sem); in nilfs_set_error()
116 struct the_nilfs *nilfs = sb->s_fs_info; in __nilfs_error() local
133 if (nilfs_test_opt(nilfs, ERRORS_RO)) { in __nilfs_error()
139 if (nilfs_test_opt(nilfs, ERRORS_PANIC)) in __nilfs_error()
176 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_sync_super() local
180 set_buffer_dirty(nilfs->ns_sbh[0]); in nilfs_sync_super()
181 if (nilfs_test_opt(nilfs, BARRIER)) { in nilfs_sync_super()
182 err = __sync_dirty_buffer(nilfs->ns_sbh[0], in nilfs_sync_super()
185 err = sync_dirty_buffer(nilfs->ns_sbh[0]); in nilfs_sync_super()
191 if (err == -EIO && nilfs->ns_sbh[1]) { in nilfs_sync_super()
196 memcpy(nilfs->ns_sbp[1], nilfs->ns_sbp[0], in nilfs_sync_super()
197 nilfs->ns_sbsize); in nilfs_sync_super()
198 nilfs_fall_back_super_block(nilfs); in nilfs_sync_super()
202 struct nilfs_super_block *sbp = nilfs->ns_sbp[0]; in nilfs_sync_super()
204 nilfs->ns_sbwcount++; in nilfs_sync_super()
210 clear_nilfs_discontinued(nilfs); in nilfs_sync_super()
213 if (nilfs->ns_sbh[1]) { in nilfs_sync_super()
215 set_buffer_dirty(nilfs->ns_sbh[1]); in nilfs_sync_super()
216 if (sync_dirty_buffer(nilfs->ns_sbh[1]) < 0) in nilfs_sync_super()
219 if (le64_to_cpu(nilfs->ns_sbp[1]->s_last_cno) < in nilfs_sync_super()
220 le64_to_cpu(nilfs->ns_sbp[0]->s_last_cno)) in nilfs_sync_super()
221 sbp = nilfs->ns_sbp[1]; in nilfs_sync_super()
224 spin_lock(&nilfs->ns_last_segment_lock); in nilfs_sync_super()
225 nilfs->ns_prot_seq = le64_to_cpu(sbp->s_last_seq); in nilfs_sync_super()
226 spin_unlock(&nilfs->ns_last_segment_lock); in nilfs_sync_super()
233 struct the_nilfs *nilfs) in nilfs_set_log_cursor() argument
238 nilfs_count_free_blocks(nilfs, &nfreeblocks); in nilfs_set_log_cursor()
241 spin_lock(&nilfs->ns_last_segment_lock); in nilfs_set_log_cursor()
242 sbp->s_last_seq = cpu_to_le64(nilfs->ns_last_seq); in nilfs_set_log_cursor()
243 sbp->s_last_pseg = cpu_to_le64(nilfs->ns_last_pseg); in nilfs_set_log_cursor()
244 sbp->s_last_cno = cpu_to_le64(nilfs->ns_last_cno); in nilfs_set_log_cursor()
245 spin_unlock(&nilfs->ns_last_segment_lock); in nilfs_set_log_cursor()
251 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_prepare_super() local
252 struct nilfs_super_block **sbp = nilfs->ns_sbp; in nilfs_prepare_super()
258 memcpy(sbp[0], sbp[1], nilfs->ns_sbsize); in nilfs_prepare_super()
265 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_prepare_super()
269 nilfs_swap_super_block(nilfs); in nilfs_prepare_super()
276 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_commit_super() local
277 struct nilfs_super_block **sbp = nilfs->ns_sbp; in nilfs_commit_super()
282 nilfs->ns_sbwtime = t; in nilfs_commit_super()
285 sbp[0]->s_sum = cpu_to_le32(crc32_le(nilfs->ns_crc_seed, in nilfs_commit_super()
287 nilfs->ns_sbsize)); in nilfs_commit_super()
291 sbp[1]->s_sum = cpu_to_le32(crc32_le(nilfs->ns_crc_seed, in nilfs_commit_super()
293 nilfs->ns_sbsize)); in nilfs_commit_super()
295 clear_nilfs_sb_dirty(nilfs); in nilfs_commit_super()
296 nilfs->ns_flushed_device = 1; in nilfs_commit_super()
312 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_cleanup_super() local
319 sbp[0]->s_state = cpu_to_le16(nilfs->ns_mount_state); in nilfs_cleanup_super()
320 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_cleanup_super()
342 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_move_2nd_super() local
351 if (nilfs->ns_sbh[1] && in nilfs_move_2nd_super()
352 nilfs->ns_sbh[1]->b_blocknr > nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
354 blocknr = nilfs->ns_sbh[1]->b_blocknr; in nilfs_move_2nd_super()
355 } else if (nilfs->ns_sbh[0]->b_blocknr > nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
357 blocknr = nilfs->ns_sbh[0]->b_blocknr; in nilfs_move_2nd_super()
362 if (sb2i >= 0 && (u64)blocknr << nilfs->ns_blocksize_bits == sb2off) in nilfs_move_2nd_super()
366 newblocknr = sb2off >> nilfs->ns_blocksize_bits; in nilfs_move_2nd_super()
367 offset = sb2off & (nilfs->ns_blocksize - 1); in nilfs_move_2nd_super()
386 memcpy(nsbp, nilfs->ns_sbp[sb2i], nilfs->ns_sbsize); in nilfs_move_2nd_super()
393 memset((void *)nsbp + nilfs->ns_sbsize, 0, in nilfs_move_2nd_super()
394 nsbh->b_size - offset - nilfs->ns_sbsize); in nilfs_move_2nd_super()
402 brelse(nilfs->ns_sbh[sb2i]); in nilfs_move_2nd_super()
403 nilfs->ns_sbh[sb2i] = nsbh; in nilfs_move_2nd_super()
404 nilfs->ns_sbp[sb2i] = nsbp; in nilfs_move_2nd_super()
405 } else if (nilfs->ns_sbh[0]->b_blocknr < nilfs->ns_first_data_block) { in nilfs_move_2nd_super()
407 nilfs->ns_sbh[1] = nsbh; in nilfs_move_2nd_super()
408 nilfs->ns_sbp[1] = nsbp; in nilfs_move_2nd_super()
423 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_resize_fs() local
448 down_write(&nilfs->ns_segctor_sem); in nilfs_resize_fs()
451 newnsegs = sb2off >> nilfs->ns_blocksize_bits; in nilfs_resize_fs()
452 do_div(newnsegs, nilfs->ns_blocks_per_segment); in nilfs_resize_fs()
454 ret = nilfs_sufile_resize(nilfs->ns_sufile, newnsegs); in nilfs_resize_fs()
455 up_write(&nilfs->ns_segctor_sem); in nilfs_resize_fs()
463 down_write(&nilfs->ns_sem); in nilfs_resize_fs()
468 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_resize_fs()
477 sbp[0]->s_nsegments = cpu_to_le64(nilfs->ns_nsegments); in nilfs_resize_fs()
479 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_resize_fs()
482 up_write(&nilfs->ns_sem); in nilfs_resize_fs()
491 nilfs_sufile_set_alloc_range(nilfs->ns_sufile, 0, newnsegs - 1); in nilfs_resize_fs()
498 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_put_super() local
503 down_write(&nilfs->ns_sem); in nilfs_put_super()
505 up_write(&nilfs->ns_sem); in nilfs_put_super()
508 nilfs_sysfs_delete_device_group(nilfs); in nilfs_put_super()
509 iput(nilfs->ns_sufile); in nilfs_put_super()
510 iput(nilfs->ns_cpfile); in nilfs_put_super()
511 iput(nilfs->ns_dat); in nilfs_put_super()
513 destroy_nilfs(nilfs); in nilfs_put_super()
519 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_sync_fs() local
527 down_write(&nilfs->ns_sem); in nilfs_sync_fs()
528 if (nilfs_sb_dirty(nilfs)) { in nilfs_sync_fs()
529 sbp = nilfs_prepare_super(sb, nilfs_sb_will_flip(nilfs)); in nilfs_sync_fs()
531 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_sync_fs()
535 up_write(&nilfs->ns_sem); in nilfs_sync_fs()
538 err = nilfs_flush_device(nilfs); in nilfs_sync_fs()
546 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_attach_checkpoint() local
553 nilfs, curr_mnt ? NILFS_CPTREE_CURRENT_CNO : cno); in nilfs_attach_checkpoint()
560 down_read(&nilfs->ns_segctor_sem); in nilfs_attach_checkpoint()
561 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, in nilfs_attach_checkpoint()
563 up_read(&nilfs->ns_segctor_sem); in nilfs_attach_checkpoint()
574 err = nilfs_ifile_read(sb, root, nilfs->ns_inode_size, in nilfs_attach_checkpoint()
584 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); in nilfs_attach_checkpoint()
591 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); in nilfs_attach_checkpoint()
600 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_freeze() local
607 down_write(&nilfs->ns_sem); in nilfs_freeze()
609 up_write(&nilfs->ns_sem); in nilfs_freeze()
615 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_unfreeze() local
620 down_write(&nilfs->ns_sem); in nilfs_unfreeze()
622 up_write(&nilfs->ns_sem); in nilfs_unfreeze()
630 struct the_nilfs *nilfs = root->nilfs; in nilfs_statfs() local
645 blocks = nilfs->ns_blocks_per_segment * nilfs->ns_nsegments in nilfs_statfs()
646 - nilfs->ns_first_data_block; in nilfs_statfs()
647 nrsvblocks = nilfs->ns_nrsvsegs * nilfs->ns_blocks_per_segment; in nilfs_statfs()
657 err = nilfs_count_free_blocks(nilfs, &nfreeblocks); in nilfs_statfs()
698 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_show_options() local
701 if (!nilfs_test_opt(nilfs, BARRIER)) in nilfs_show_options()
705 if (nilfs_test_opt(nilfs, ERRORS_PANIC)) in nilfs_show_options()
707 if (nilfs_test_opt(nilfs, ERRORS_CONT)) in nilfs_show_options()
709 if (nilfs_test_opt(nilfs, STRICT_ORDER)) in nilfs_show_options()
711 if (nilfs_test_opt(nilfs, NORECOVERY)) in nilfs_show_options()
713 if (nilfs_test_opt(nilfs, DISCARD)) in nilfs_show_options()
755 struct the_nilfs *nilfs = sb->s_fs_info; in parse_options() local
771 nilfs_set_opt(nilfs, BARRIER); in parse_options()
774 nilfs_clear_opt(nilfs, BARRIER); in parse_options()
779 nilfs_clear_opt(nilfs, STRICT_ORDER); in parse_options()
782 nilfs_set_opt(nilfs, STRICT_ORDER); in parse_options()
787 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_PANIC); in parse_options()
790 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_RO); in parse_options()
793 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_CONT); in parse_options()
804 nilfs_set_opt(nilfs, NORECOVERY); in parse_options()
807 nilfs_set_opt(nilfs, DISCARD); in parse_options()
810 nilfs_clear_opt(nilfs, DISCARD); in parse_options()
825 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_set_default_options() local
827 nilfs->ns_mount_opt = in nilfs_set_default_options()
833 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_setup_super() local
849 if (nilfs->ns_mount_state & NILFS_ERROR_FS) { in nilfs_setup_super()
867 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); in nilfs_setup_super()
889 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_store_magic_and_option() local
900 nilfs->ns_resuid = le16_to_cpu(sbp->s_def_resuid); in nilfs_store_magic_and_option()
901 nilfs->ns_resgid = le16_to_cpu(sbp->s_def_resgid); in nilfs_store_magic_and_option()
902 nilfs->ns_interval = le32_to_cpu(sbp->s_c_interval); in nilfs_store_magic_and_option()
903 nilfs->ns_watermark = le32_to_cpu(sbp->s_c_block_max); in nilfs_store_magic_and_option()
983 struct the_nilfs *nilfs = s->s_fs_info; in nilfs_attach_snapshot() local
987 mutex_lock(&nilfs->ns_snapshot_mount_mutex); in nilfs_attach_snapshot()
989 down_read(&nilfs->ns_segctor_sem); in nilfs_attach_snapshot()
990 ret = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, cno); in nilfs_attach_snapshot()
991 up_read(&nilfs->ns_segctor_sem); in nilfs_attach_snapshot()
1013 mutex_unlock(&nilfs->ns_snapshot_mount_mutex); in nilfs_attach_snapshot()
1031 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_checkpoint_is_mounted() local
1037 if (cno > nilfs->ns_cno) in nilfs_checkpoint_is_mounted()
1040 if (cno >= nilfs_last_cno(nilfs)) in nilfs_checkpoint_is_mounted()
1044 root = nilfs_lookup_root(nilfs, cno); in nilfs_checkpoint_is_mounted()
1072 struct the_nilfs *nilfs; in nilfs_fill_super() local
1077 nilfs = alloc_nilfs(sb); in nilfs_fill_super()
1078 if (!nilfs) in nilfs_fill_super()
1081 sb->s_fs_info = nilfs; in nilfs_fill_super()
1083 err = init_nilfs(nilfs, sb, (char *)data); in nilfs_fill_super()
1095 err = load_nilfs(nilfs, sb); in nilfs_fill_super()
1099 cno = nilfs_last_cno(nilfs); in nilfs_fill_super()
1121 down_write(&nilfs->ns_sem); in nilfs_fill_super()
1123 up_write(&nilfs->ns_sem); in nilfs_fill_super()
1135 nilfs_sysfs_delete_device_group(nilfs); in nilfs_fill_super()
1136 iput(nilfs->ns_sufile); in nilfs_fill_super()
1137 iput(nilfs->ns_cpfile); in nilfs_fill_super()
1138 iput(nilfs->ns_dat); in nilfs_fill_super()
1141 destroy_nilfs(nilfs); in nilfs_fill_super()
1147 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_remount() local
1154 old_mount_opt = nilfs->ns_mount_opt; in nilfs_remount()
1164 if (!nilfs_valid_fs(nilfs)) { in nilfs_remount()
1179 down_write(&nilfs->ns_sem); in nilfs_remount()
1181 up_write(&nilfs->ns_sem); in nilfs_remount()
1191 down_read(&nilfs->ns_sem); in nilfs_remount()
1192 features = le64_to_cpu(nilfs->ns_sbp[0]->s_feature_compat_ro) & in nilfs_remount()
1194 up_read(&nilfs->ns_sem); in nilfs_remount()
1210 down_write(&nilfs->ns_sem); in nilfs_remount()
1212 up_write(&nilfs->ns_sem); in nilfs_remount()
1219 nilfs->ns_mount_opt = old_mount_opt; in nilfs_remount()