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()
768 static void nilfs_dispose_list(struct the_nilfs *nilfs, in nilfs_dispose_list() argument
776 spin_lock(&nilfs->ns_inode_lock); in nilfs_dispose_list()
787 &nilfs->ns_dirty_files); in nilfs_dispose_list()
794 spin_unlock(&nilfs->ns_inode_lock); in nilfs_dispose_list()
805 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_iput_work_func() local
807 nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 0); in nilfs_iput_work_func()
810 static int nilfs_test_metadata_dirty(struct the_nilfs *nilfs, in nilfs_test_metadata_dirty() argument
817 if (nilfs_mdt_fetch_dirty(nilfs->ns_cpfile)) in nilfs_test_metadata_dirty()
819 if (nilfs_mdt_fetch_dirty(nilfs->ns_sufile)) in nilfs_test_metadata_dirty()
821 if ((ret || nilfs_doing_gc()) && nilfs_mdt_fetch_dirty(nilfs->ns_dat)) in nilfs_test_metadata_dirty()
836 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_confirm() local
839 if (nilfs_test_metadata_dirty(nilfs, sci->sc_root)) in nilfs_segctor_confirm()
842 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_confirm()
843 if (list_empty(&nilfs->ns_dirty_files) && nilfs_segctor_clean(sci)) in nilfs_segctor_confirm()
846 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_confirm()
852 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_clear_metadata_dirty() local
855 nilfs_mdt_clear_dirty(nilfs->ns_cpfile); in nilfs_segctor_clear_metadata_dirty()
856 nilfs_mdt_clear_dirty(nilfs->ns_sufile); in nilfs_segctor_clear_metadata_dirty()
857 nilfs_mdt_clear_dirty(nilfs->ns_dat); in nilfs_segctor_clear_metadata_dirty()
862 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_create_checkpoint() local
868 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 1, in nilfs_segctor_create_checkpoint()
877 nilfs_mdt_mark_dirty(nilfs->ns_cpfile); in nilfs_segctor_create_checkpoint()
879 nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); in nilfs_segctor_create_checkpoint()
888 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_fill_in_checkpoint() local
893 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 0, in nilfs_segctor_fill_in_checkpoint()
908 raw_cp->cp_cno = cpu_to_le64(nilfs->ns_cno); in nilfs_segctor_fill_in_checkpoint()
917 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); in nilfs_segctor_fill_in_checkpoint()
952 struct the_nilfs *nilfs) in nilfs_segctor_fill_in_super_root() argument
960 isz = nilfs->ns_inode_size; in nilfs_segctor_fill_in_super_root()
966 nilfs->ns_nongc_ctime : sci->sc_seg_ctime); in nilfs_segctor_fill_in_super_root()
969 nilfs_write_inode_common(nilfs->ns_dat, (void *)raw_sr + in nilfs_segctor_fill_in_super_root()
971 nilfs_write_inode_common(nilfs->ns_cpfile, (void *)raw_sr + in nilfs_segctor_fill_in_super_root()
973 nilfs_write_inode_common(nilfs->ns_sufile, (void *)raw_sr + in nilfs_segctor_fill_in_super_root()
975 memset((void *)raw_sr + srsz, 0, nilfs->ns_blocksize - srsz); in nilfs_segctor_fill_in_super_root()
1115 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_collect_blocks() local
1204 err = nilfs_segctor_scan_file(sci, nilfs->ns_cpfile, in nilfs_segctor_collect_blocks()
1211 err = nilfs_sufile_freev(nilfs->ns_sufile, sci->sc_freesegs, in nilfs_segctor_collect_blocks()
1214 nilfs_sufile_cancel_freev(nilfs->ns_sufile, in nilfs_segctor_collect_blocks()
1221 err = nilfs_segctor_scan_file(sci, nilfs->ns_sufile, in nilfs_segctor_collect_blocks()
1229 err = nilfs_segctor_scan_file(sci, nilfs->ns_dat, in nilfs_segctor_collect_blocks()
1279 struct the_nilfs *nilfs) in nilfs_segctor_begin_construction() argument
1290 nilfs_segbuf_map(segbuf, nilfs->ns_segnum, in nilfs_segctor_begin_construction()
1291 nilfs->ns_pseg_offset, nilfs); in nilfs_segctor_begin_construction()
1293 nilfs_shift_to_next_segment(nilfs); in nilfs_segctor_begin_construction()
1294 nilfs_segbuf_map(segbuf, nilfs->ns_segnum, 0, nilfs); in nilfs_segctor_begin_construction()
1297 segbuf->sb_sum.seg_seq = nilfs->ns_seg_seq; in nilfs_segctor_begin_construction()
1298 nextnum = nilfs->ns_nextnum; in nilfs_segctor_begin_construction()
1300 if (nilfs->ns_segnum == nilfs->ns_nextnum) in nilfs_segctor_begin_construction()
1311 nilfs_segbuf_map(segbuf, prev->sb_nextnum, 0, nilfs); in nilfs_segctor_begin_construction()
1317 err = nilfs_sufile_mark_dirty(nilfs->ns_sufile, segbuf->sb_segnum); in nilfs_segctor_begin_construction()
1322 err = nilfs_sufile_alloc(nilfs->ns_sufile, &nextnum); in nilfs_segctor_begin_construction()
1326 nilfs_segbuf_set_next_segnum(segbuf, nextnum, nilfs); in nilfs_segctor_begin_construction()
1339 struct the_nilfs *nilfs, int nadd) in nilfs_segctor_extend_segments() argument
1342 struct inode *sufile = nilfs->ns_sufile; in nilfs_segctor_extend_segments()
1366 nilfs_segbuf_map(segbuf, prev->sb_nextnum, 0, nilfs); in nilfs_segctor_extend_segments()
1375 nilfs_segbuf_set_next_segnum(segbuf, nextnextnum, nilfs); in nilfs_segctor_extend_segments()
1395 struct the_nilfs *nilfs) in nilfs_free_incomplete_logs() argument
1398 struct inode *sufile = nilfs->ns_sufile; in nilfs_free_incomplete_logs()
1402 if (nilfs->ns_nextnum != segbuf->sb_nextnum) { in nilfs_free_incomplete_logs()
1413 nilfs_terminate_segment(nilfs, segbuf->sb_fseg_start, in nilfs_free_incomplete_logs()
1416 set_nilfs_discontinued(nilfs); in nilfs_free_incomplete_logs()
1426 segbuf->sb_segnum != nilfs->ns_nextnum) in nilfs_free_incomplete_logs()
1485 struct the_nilfs *nilfs, int mode) in nilfs_segctor_collect() argument
1515 err = nilfs_sufile_cancel_freev(nilfs->ns_sufile, in nilfs_segctor_collect()
1523 err = nilfs_segctor_extend_segments(sci, nilfs, nadd); in nilfs_segctor_collect()
1530 nilfs_segctor_truncate_segments(sci, sci->sc_curseg, nilfs->ns_sufile); in nilfs_segctor_collect()
1698 struct the_nilfs *nilfs) in nilfs_segctor_write() argument
1702 ret = nilfs_write_logs(&sci->sc_segbufs, nilfs); in nilfs_segctor_write()
1787 struct the_nilfs *nilfs, int err) in nilfs_segctor_abort_construction() argument
1797 nilfs_cancel_segusage(&logs, nilfs->ns_sufile); in nilfs_segctor_abort_construction()
1798 nilfs_free_incomplete_logs(&logs, nilfs); in nilfs_segctor_abort_construction()
1801 ret = nilfs_sufile_cancel_freev(nilfs->ns_sufile, in nilfs_segctor_abort_construction()
1811 static void nilfs_set_next_segment(struct the_nilfs *nilfs, in nilfs_set_next_segment() argument
1814 nilfs->ns_segnum = segbuf->sb_segnum; in nilfs_set_next_segment()
1815 nilfs->ns_nextnum = segbuf->sb_nextnum; in nilfs_set_next_segment()
1816 nilfs->ns_pseg_offset = segbuf->sb_pseg_start - segbuf->sb_fseg_start in nilfs_set_next_segment()
1818 nilfs->ns_seg_seq = segbuf->sb_sum.seg_seq; in nilfs_set_next_segment()
1819 nilfs->ns_ctime = segbuf->sb_sum.ctime; in nilfs_set_next_segment()
1826 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_complete_write() local
1899 nilfs->ns_nongc_ctime = sci->sc_seg_ctime; in nilfs_segctor_complete_write()
1904 nilfs_set_next_segment(nilfs, segbuf); in nilfs_segctor_complete_write()
1907 nilfs->ns_flushed_device = 0; in nilfs_segctor_complete_write()
1908 nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start, in nilfs_segctor_complete_write()
1909 segbuf->sb_sum.seg_seq, nilfs->ns_cno++); in nilfs_segctor_complete_write()
1932 struct the_nilfs *nilfs) in nilfs_segctor_collect_dirty_files() argument
1937 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_collect_dirty_files()
1939 list_for_each_entry_safe(ii, n, &nilfs->ns_dirty_files, i_dirty) { in nilfs_segctor_collect_dirty_files()
1944 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_collect_dirty_files()
1953 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_collect_dirty_files()
1969 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_collect_dirty_files()
1975 struct the_nilfs *nilfs) in nilfs_segctor_drop_written_files() argument
1981 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_drop_written_files()
1999 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_drop_written_files()
2001 spin_lock(&nilfs->ns_inode_lock); in nilfs_segctor_drop_written_files()
2004 spin_unlock(&nilfs->ns_inode_lock); in nilfs_segctor_drop_written_files()
2015 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_do_construct() local
2019 sci->sc_cno = nilfs->ns_cno; in nilfs_segctor_do_construct()
2021 err = nilfs_segctor_collect_dirty_files(sci, nilfs); in nilfs_segctor_do_construct()
2025 if (nilfs_test_metadata_dirty(nilfs, sci->sc_root)) in nilfs_segctor_do_construct()
2034 err = nilfs_segctor_begin_construction(sci, nilfs); in nilfs_segctor_do_construct()
2041 err = nilfs_segctor_collect(sci, nilfs, mode); in nilfs_segctor_do_construct()
2048 nilfs_segctor_abort_construction(sci, nilfs, 1); in nilfs_segctor_do_construct()
2065 nilfs_segctor_fill_in_super_root(sci, nilfs); in nilfs_segctor_do_construct()
2067 nilfs_segctor_update_segusage(sci, nilfs->ns_sufile); in nilfs_segctor_do_construct()
2073 nilfs->ns_crc_seed); in nilfs_segctor_do_construct()
2075 err = nilfs_segctor_write(sci, nilfs); in nilfs_segctor_do_construct()
2080 nilfs->ns_blocksize_bits != PAGE_SHIFT) { in nilfs_segctor_do_construct()
2095 nilfs_segctor_drop_written_files(sci, nilfs); in nilfs_segctor_do_construct()
2105 nilfs_segctor_abort_construction(sci, nilfs, err); in nilfs_segctor_do_construct()
2148 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_flush_segment() local
2149 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_flush_segment()
2237 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_construct_segment() local
2238 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_construct_segment()
2275 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_construct_dsync_segment() local
2276 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_construct_dsync_segment()
2288 nilfs_test_opt(nilfs, STRICT_ORDER) || in nilfs_construct_dsync_segment()
2290 nilfs_discontinued(nilfs)) { in nilfs_construct_dsync_segment()
2296 spin_lock(&nilfs->ns_inode_lock); in nilfs_construct_dsync_segment()
2299 spin_unlock(&nilfs->ns_inode_lock); in nilfs_construct_dsync_segment()
2303 spin_unlock(&nilfs->ns_inode_lock); in nilfs_construct_dsync_segment()
2310 nilfs->ns_flushed_device = 0; in nilfs_construct_dsync_segment()
2368 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_construct() local
2374 if (nilfs_discontinued(nilfs)) in nilfs_segctor_construct()
2381 atomic_set(&nilfs->ns_ndirtyblks, 0); in nilfs_segctor_construct()
2383 nilfs_discontinued(nilfs)) { in nilfs_segctor_construct()
2384 down_write(&nilfs->ns_sem); in nilfs_segctor_construct()
2387 nilfs_sb_will_flip(nilfs)); in nilfs_segctor_construct()
2389 nilfs_set_log_cursor(sbp[0], nilfs); in nilfs_segctor_construct()
2393 up_write(&nilfs->ns_sem); in nilfs_segctor_construct()
2409 nilfs_remove_written_gcinodes(struct the_nilfs *nilfs, struct list_head *head) in nilfs_remove_written_gcinodes() argument
2426 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_clean_segments() local
2427 struct nilfs_sc_info *sci = nilfs->ns_writer; in nilfs_clean_segments()
2436 err = nilfs_mdt_save_to_shadow_map(nilfs->ns_dat); in nilfs_clean_segments()
2440 err = nilfs_ioctl_prepare_clean_segments(nilfs, argv, kbufs); in nilfs_clean_segments()
2442 nilfs_mdt_restore_from_shadow_map(nilfs->ns_dat); in nilfs_clean_segments()
2448 list_splice_tail_init(&nilfs->ns_gc_inodes, &sci->sc_gc_inodes); in nilfs_clean_segments()
2452 nilfs_remove_written_gcinodes(nilfs, &sci->sc_gc_inodes); in nilfs_clean_segments()
2461 if (nilfs_test_opt(nilfs, DISCARD)) { in nilfs_clean_segments()
2462 int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs, in nilfs_clean_segments()
2468 nilfs_clear_opt(nilfs, DISCARD); in nilfs_clean_segments()
2475 nilfs_mdt_clear_shadow_map(nilfs->ns_dat); in nilfs_clean_segments()
2540 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_thread() local
2602 if (nilfs_sb_dirty(nilfs) && nilfs_sb_need_update(nilfs)) in nilfs_segctor_thread()
2603 set_nilfs_discontinued(nilfs); in nilfs_segctor_thread()
2652 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_segctor_new() local
2680 if (nilfs->ns_interval) in nilfs_segctor_new()
2681 sci->sc_interval = HZ * nilfs->ns_interval; in nilfs_segctor_new()
2682 if (nilfs->ns_watermark) in nilfs_segctor_new()
2683 sci->sc_watermark = nilfs->ns_watermark; in nilfs_segctor_new()
2717 struct the_nilfs *nilfs = sci->sc_super->s_fs_info; in nilfs_segctor_destroy() local
2720 up_write(&nilfs->ns_segctor_sem); in nilfs_segctor_destroy()
2737 nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1); in nilfs_segctor_destroy()
2743 nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1); in nilfs_segctor_destroy()
2751 down_write(&nilfs->ns_segctor_sem); in nilfs_segctor_destroy()
2772 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_attach_log_writer() local
2775 if (nilfs->ns_writer) { in nilfs_attach_log_writer()
2784 nilfs->ns_writer = nilfs_segctor_new(sb, root); in nilfs_attach_log_writer()
2785 if (!nilfs->ns_writer) in nilfs_attach_log_writer()
2788 inode_attach_wb(nilfs->ns_bdev->bd_inode, NULL); in nilfs_attach_log_writer()
2790 err = nilfs_segctor_start_thread(nilfs->ns_writer); in nilfs_attach_log_writer()
2792 kfree(nilfs->ns_writer); in nilfs_attach_log_writer()
2793 nilfs->ns_writer = NULL; in nilfs_attach_log_writer()
2807 struct the_nilfs *nilfs = sb->s_fs_info; in nilfs_detach_log_writer() local
2810 down_write(&nilfs->ns_segctor_sem); in nilfs_detach_log_writer()
2811 if (nilfs->ns_writer) { in nilfs_detach_log_writer()
2812 nilfs_segctor_destroy(nilfs->ns_writer); in nilfs_detach_log_writer()
2813 nilfs->ns_writer = NULL; in nilfs_detach_log_writer()
2817 spin_lock(&nilfs->ns_inode_lock); in nilfs_detach_log_writer()
2818 if (!list_empty(&nilfs->ns_dirty_files)) { in nilfs_detach_log_writer()
2819 list_splice_init(&nilfs->ns_dirty_files, &garbage_list); in nilfs_detach_log_writer()
2823 spin_unlock(&nilfs->ns_inode_lock); in nilfs_detach_log_writer()
2824 up_write(&nilfs->ns_segctor_sem); in nilfs_detach_log_writer()
2826 nilfs_dispose_list(nilfs, &garbage_list, 1); in nilfs_detach_log_writer()