Lines Matching refs:nilfs
210 struct the_nilfs *nilfs; in nilfs_transaction_begin() local
227 nilfs = sb->s_fs_info; in nilfs_transaction_begin()
228 down_read(&nilfs->ns_segctor_sem); in nilfs_transaction_begin()
229 if (vacancy_check && nilfs_near_disk_full(nilfs)) { in nilfs_transaction_begin()
230 up_read(&nilfs->ns_segctor_sem); in nilfs_transaction_begin()
264 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_transaction_commit() local
275 if (nilfs->ns_writer) { in nilfs_transaction_commit()
276 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_transaction_commit()
280 if (atomic_read(&nilfs->ns_ndirtyblks) > sci->sc_watermark) in nilfs_transaction_commit()
283 up_read(&nilfs->ns_segctor_sem); in nilfs_transaction_commit()
300 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_transaction_abort() local
309 up_read(&nilfs->ns_segctor_sem); in nilfs_transaction_abort()
322 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_relax_pressure_in_lock() local
323 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_relax_pressure_in_lock()
329 up_read(&nilfs->ns_segctor_sem); in nilfs_relax_pressure_in_lock()
331 down_write(&nilfs->ns_segctor_sem); in nilfs_relax_pressure_in_lock()
340 downgrade_write(&nilfs->ns_segctor_sem); in nilfs_relax_pressure_in_lock()
348 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_transaction_lock() local
349 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_transaction_lock()
362 down_write(&nilfs->ns_segctor_sem); in nilfs_transaction_lock()
368 up_write(&nilfs->ns_segctor_sem); in nilfs_transaction_lock()
381 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_transaction_unlock() local
386 up_write(&nilfs->ns_segctor_sem); in nilfs_transaction_unlock()
795 static void nilfs_dispose_list(struct the_nilfs *nilfs, in nilfs_dispose_list() argument
803 spin_lock(&nilfs->ns_inode_lock); in nilfs_dispose_list()
814 &nilfs->ns_dirty_files); in nilfs_dispose_list()
821 spin_unlock(&nilfs->ns_inode_lock); in nilfs_dispose_list()
832 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_iput_work_func() local
834 nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 0); in nilfs_iput_work_func()
837 static int nilfs_test_metadata_dirty(struct the_nilfs *nilfs, in nilfs_test_metadata_dirty() argument
844 if (nilfs_mdt_fetch_dirty(nilfs->ns_cpfile)) in nilfs_test_metadata_dirty()
846 if (nilfs_mdt_fetch_dirty(nilfs->ns_sufile)) in nilfs_test_metadata_dirty()
848 if ((ret || nilfs_doing_gc()) && nilfs_mdt_fetch_dirty(nilfs->ns_dat)) in nilfs_test_metadata_dirty()
863 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_confirm() local
866 if (nilfs_test_metadata_dirty(nilfs, sci->sc_root)) in nilfs_segctor_confirm()
869 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_confirm()
870 if (list_empty(&nilfs->ns_dirty_files) && nilfs_segctor_clean(sci)) in nilfs_segctor_confirm()
873 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_confirm()
879 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_clear_metadata_dirty() local
882 nilfs_mdt_clear_dirty(nilfs->ns_cpfile); in nilfs_segctor_clear_metadata_dirty()
883 nilfs_mdt_clear_dirty(nilfs->ns_sufile); in nilfs_segctor_clear_metadata_dirty()
884 nilfs_mdt_clear_dirty(nilfs->ns_dat); in nilfs_segctor_clear_metadata_dirty()
889 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_create_checkpoint() local
895 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 1, in nilfs_segctor_create_checkpoint()
904 nilfs_mdt_mark_dirty(nilfs->ns_cpfile); in nilfs_segctor_create_checkpoint()
906 nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); in nilfs_segctor_create_checkpoint()
917 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_fill_in_checkpoint() local
922 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 0, in nilfs_segctor_fill_in_checkpoint()
941 raw_cp->cp_cno = cpu_to_le64(nilfs->ns_cno); in nilfs_segctor_fill_in_checkpoint()
950 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); in nilfs_segctor_fill_in_checkpoint()
985 struct the_nilfs *nilfs) in nilfs_segctor_fill_in_super_root() argument
995 isz = nilfs->ns_inode_size; in nilfs_segctor_fill_in_super_root()
1002 nilfs->ns_nongc_ctime : sci->sc_seg_ctime); in nilfs_segctor_fill_in_super_root()
1005 nilfs_write_inode_common(nilfs->ns_dat, (void *)raw_sr + in nilfs_segctor_fill_in_super_root()
1007 nilfs_write_inode_common(nilfs->ns_cpfile, (void *)raw_sr + in nilfs_segctor_fill_in_super_root()
1009 nilfs_write_inode_common(nilfs->ns_sufile, (void *)raw_sr + in nilfs_segctor_fill_in_super_root()
1011 memset((void *)raw_sr + srsz, 0, nilfs->ns_blocksize - srsz); in nilfs_segctor_fill_in_super_root()
1153 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_collect_blocks() local
1240 err = nilfs_segctor_scan_file(sci, nilfs->ns_cpfile, in nilfs_segctor_collect_blocks()
1246 err = nilfs_sufile_freev(nilfs->ns_sufile, sci->sc_freesegs, in nilfs_segctor_collect_blocks()
1249 nilfs_sufile_cancel_freev(nilfs->ns_sufile, in nilfs_segctor_collect_blocks()
1256 err = nilfs_segctor_scan_file(sci, nilfs->ns_sufile, in nilfs_segctor_collect_blocks()
1263 err = nilfs_segctor_scan_file(sci, nilfs->ns_dat, in nilfs_segctor_collect_blocks()
1312 struct the_nilfs *nilfs) in nilfs_segctor_begin_construction() argument
1323 nilfs_segbuf_map(segbuf, nilfs->ns_segnum, in nilfs_segctor_begin_construction()
1324 nilfs->ns_pseg_offset, nilfs); in nilfs_segctor_begin_construction()
1326 nilfs_shift_to_next_segment(nilfs); in nilfs_segctor_begin_construction()
1327 nilfs_segbuf_map(segbuf, nilfs->ns_segnum, 0, nilfs); in nilfs_segctor_begin_construction()
1330 segbuf->sb_sum.seg_seq = nilfs->ns_seg_seq; in nilfs_segctor_begin_construction()
1331 nextnum = nilfs->ns_nextnum; in nilfs_segctor_begin_construction()
1333 if (nilfs->ns_segnum == nilfs->ns_nextnum) in nilfs_segctor_begin_construction()
1344 nilfs_segbuf_map(segbuf, prev->sb_nextnum, 0, nilfs); in nilfs_segctor_begin_construction()
1350 err = nilfs_sufile_mark_dirty(nilfs->ns_sufile, segbuf->sb_segnum); in nilfs_segctor_begin_construction()
1355 err = nilfs_sufile_alloc(nilfs->ns_sufile, &nextnum); in nilfs_segctor_begin_construction()
1359 nilfs_segbuf_set_next_segnum(segbuf, nextnum, nilfs); in nilfs_segctor_begin_construction()
1372 struct the_nilfs *nilfs, int nadd) in nilfs_segctor_extend_segments() argument
1375 struct inode *sufile = nilfs->ns_sufile; in nilfs_segctor_extend_segments()
1399 nilfs_segbuf_map(segbuf, prev->sb_nextnum, 0, nilfs); in nilfs_segctor_extend_segments()
1408 nilfs_segbuf_set_next_segnum(segbuf, nextnextnum, nilfs); in nilfs_segctor_extend_segments()
1428 struct the_nilfs *nilfs) in nilfs_free_incomplete_logs() argument
1431 struct inode *sufile = nilfs->ns_sufile; in nilfs_free_incomplete_logs()
1435 if (nilfs->ns_nextnum != segbuf->sb_nextnum) { in nilfs_free_incomplete_logs()
1446 nilfs_terminate_segment(nilfs, segbuf->sb_fseg_start, in nilfs_free_incomplete_logs()
1449 set_nilfs_discontinued(nilfs); in nilfs_free_incomplete_logs()
1459 segbuf->sb_segnum != nilfs->ns_nextnum) in nilfs_free_incomplete_logs()
1518 struct the_nilfs *nilfs, int mode) in nilfs_segctor_collect() argument
1548 err = nilfs_sufile_cancel_freev(nilfs->ns_sufile, in nilfs_segctor_collect()
1556 err = nilfs_segctor_extend_segments(sci, nilfs, nadd); in nilfs_segctor_collect()
1564 nilfs_segctor_truncate_segments(sci, sci->sc_curseg, nilfs->ns_sufile); in nilfs_segctor_collect()
1732 struct the_nilfs *nilfs) in nilfs_segctor_write() argument
1736 ret = nilfs_write_logs(&sci->sc_segbufs, nilfs); in nilfs_segctor_write()
1823 struct the_nilfs *nilfs, int err) in nilfs_segctor_abort_construction() argument
1833 nilfs_cancel_segusage(&logs, nilfs->ns_sufile); in nilfs_segctor_abort_construction()
1834 nilfs_free_incomplete_logs(&logs, nilfs); in nilfs_segctor_abort_construction()
1837 ret = nilfs_sufile_cancel_freev(nilfs->ns_sufile, in nilfs_segctor_abort_construction()
1847 static void nilfs_set_next_segment(struct the_nilfs *nilfs, in nilfs_set_next_segment() argument
1850 nilfs->ns_segnum = segbuf->sb_segnum; in nilfs_set_next_segment()
1851 nilfs->ns_nextnum = segbuf->sb_nextnum; in nilfs_set_next_segment()
1852 nilfs->ns_pseg_offset = segbuf->sb_pseg_start - segbuf->sb_fseg_start in nilfs_set_next_segment()
1854 nilfs->ns_seg_seq = segbuf->sb_sum.seg_seq; in nilfs_set_next_segment()
1855 nilfs->ns_ctime = segbuf->sb_sum.ctime; in nilfs_set_next_segment()
1862 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_complete_write() local
1935 nilfs->ns_nongc_ctime = sci->sc_seg_ctime; in nilfs_segctor_complete_write()
1940 nilfs_set_next_segment(nilfs, segbuf); in nilfs_segctor_complete_write()
1943 nilfs->ns_flushed_device = 0; in nilfs_segctor_complete_write()
1944 nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start, in nilfs_segctor_complete_write()
1945 segbuf->sb_sum.seg_seq, nilfs->ns_cno++); in nilfs_segctor_complete_write()
1968 struct the_nilfs *nilfs) in nilfs_segctor_collect_dirty_files() argument
1973 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_collect_dirty_files()
1975 list_for_each_entry_safe(ii, n, &nilfs->ns_dirty_files, i_dirty) { in nilfs_segctor_collect_dirty_files()
1980 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_collect_dirty_files()
1989 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_collect_dirty_files()
2005 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_collect_dirty_files()
2011 struct the_nilfs *nilfs) in nilfs_segctor_drop_written_files() argument
2017 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_drop_written_files()
2035 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_drop_written_files()
2037 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_drop_written_files()
2040 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_drop_written_files()
2051 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_do_construct() local
2058 sci->sc_cno = nilfs->ns_cno; in nilfs_segctor_do_construct()
2060 err = nilfs_segctor_collect_dirty_files(sci, nilfs); in nilfs_segctor_do_construct()
2064 if (nilfs_test_metadata_dirty(nilfs, sci->sc_root)) in nilfs_segctor_do_construct()
2073 err = nilfs_segctor_begin_construction(sci, nilfs); in nilfs_segctor_do_construct()
2080 err = nilfs_segctor_collect(sci, nilfs, mode); in nilfs_segctor_do_construct()
2087 nilfs_segctor_abort_construction(sci, nilfs, 1); in nilfs_segctor_do_construct()
2104 nilfs_segctor_fill_in_super_root(sci, nilfs); in nilfs_segctor_do_construct()
2106 nilfs_segctor_update_segusage(sci, nilfs->ns_sufile); in nilfs_segctor_do_construct()
2112 nilfs->ns_crc_seed); in nilfs_segctor_do_construct()
2114 err = nilfs_segctor_write(sci, nilfs); in nilfs_segctor_do_construct()
2119 nilfs->ns_blocksize_bits != PAGE_SHIFT) { in nilfs_segctor_do_construct()
2134 nilfs_segctor_drop_written_files(sci, nilfs); in nilfs_segctor_do_construct()
2144 nilfs_segctor_abort_construction(sci, nilfs, err); in nilfs_segctor_do_construct()
2187 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_flush_segment() local
2188 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_flush_segment()
2276 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_construct_segment() local
2277 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_construct_segment()
2314 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_construct_dsync_segment() local
2315 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_construct_dsync_segment()
2327 nilfs_test_opt(nilfs, STRICT_ORDER) || in nilfs_construct_dsync_segment()
2329 nilfs_discontinued(nilfs)) { in nilfs_construct_dsync_segment()
2335 spin_lock(&nilfs->ns_inode_lock); in nilfs_construct_dsync_segment()
2338 spin_unlock(&nilfs->ns_inode_lock); in nilfs_construct_dsync_segment()
2342 spin_unlock(&nilfs->ns_inode_lock); in nilfs_construct_dsync_segment()
2349 nilfs->ns_flushed_device = 0; in nilfs_construct_dsync_segment()
2407 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_construct() local
2413 if (nilfs_discontinued(nilfs)) in nilfs_segctor_construct()
2420 atomic_set(&nilfs->ns_ndirtyblks, 0); in nilfs_segctor_construct()
2422 nilfs_discontinued(nilfs)) { in nilfs_segctor_construct()
2423 down_write(&nilfs->ns_sem); in nilfs_segctor_construct()
2426 nilfs_sb_will_flip(nilfs)); in nilfs_segctor_construct()
2428 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_segctor_construct()
2432 up_write(&nilfs->ns_sem); in nilfs_segctor_construct()
2448 nilfs_remove_written_gcinodes(struct the_nilfs *nilfs, struct list_head *head) in nilfs_remove_written_gcinodes() argument
2465 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_clean_segments() local
2466 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_clean_segments()
2475 err = nilfs_mdt_save_to_shadow_map(nilfs->ns_dat); in nilfs_clean_segments()
2479 err = nilfs_ioctl_prepare_clean_segments(nilfs, argv, kbufs); in nilfs_clean_segments()
2481 nilfs_mdt_restore_from_shadow_map(nilfs->ns_dat); in nilfs_clean_segments()
2487 list_splice_tail_init(&nilfs->ns_gc_inodes, &sci->sc_gc_inodes); in nilfs_clean_segments()
2491 nilfs_remove_written_gcinodes(nilfs, &sci->sc_gc_inodes); in nilfs_clean_segments()
2500 if (nilfs_test_opt(nilfs, DISCARD)) { in nilfs_clean_segments()
2501 int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs, in nilfs_clean_segments()
2507 nilfs_clear_opt(nilfs, DISCARD); in nilfs_clean_segments()
2514 nilfs_mdt_clear_shadow_map(nilfs->ns_dat); in nilfs_clean_segments()
2579 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_thread() local
2641 if (nilfs_sb_dirty(nilfs) && nilfs_sb_need_update(nilfs)) in nilfs_segctor_thread()
2642 set_nilfs_discontinued(nilfs); in nilfs_segctor_thread()
2690 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_segctor_new() local
2718 if (nilfs->ns_interval) in nilfs_segctor_new()
2719 sci->sc_interval = HZ * nilfs->ns_interval; in nilfs_segctor_new()
2720 if (nilfs->ns_watermark) in nilfs_segctor_new()
2721 sci->sc_watermark = nilfs->ns_watermark; in nilfs_segctor_new()
2755 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_destroy() local
2758 up_write(&nilfs->ns_segctor_sem); in nilfs_segctor_destroy()
2775 nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1); in nilfs_segctor_destroy()
2781 nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1); in nilfs_segctor_destroy()
2789 down_write(&nilfs->ns_segctor_sem); in nilfs_segctor_destroy()
2810 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_attach_log_writer() local
2813 if (nilfs->ns_writer) { in nilfs_attach_log_writer()
2823 nilfs->ns_writer = nilfs_segctor_new(sb, root); in nilfs_attach_log_writer()
2824 if (!nilfs->ns_writer) in nilfs_attach_log_writer()
2827 inode_attach_wb(nilfs->ns_bdev->bd_inode, NULL); in nilfs_attach_log_writer()
2829 err = nilfs_segctor_start_thread(nilfs->ns_writer); in nilfs_attach_log_writer()
2845 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_detach_log_writer() local
2848 down_write(&nilfs->ns_segctor_sem); in nilfs_detach_log_writer()
2849 if (nilfs->ns_writer) { in nilfs_detach_log_writer()
2850 nilfs_segctor_destroy(nilfs->ns_writer); in nilfs_detach_log_writer()
2851 nilfs->ns_writer = NULL; in nilfs_detach_log_writer()
2853 set_nilfs_purging(nilfs); in nilfs_detach_log_writer()
2856 spin_lock(&nilfs->ns_inode_lock); in nilfs_detach_log_writer()
2857 if (!list_empty(&nilfs->ns_dirty_files)) { in nilfs_detach_log_writer()
2858 list_splice_init(&nilfs->ns_dirty_files, &garbage_list); in nilfs_detach_log_writer()
2862 spin_unlock(&nilfs->ns_inode_lock); in nilfs_detach_log_writer()
2863 up_write(&nilfs->ns_segctor_sem); in nilfs_detach_log_writer()
2865 nilfs_dispose_list(nilfs, &garbage_list, 1); in nilfs_detach_log_writer()
2866 clear_nilfs_purging(nilfs); in nilfs_detach_log_writer()