Lines Matching refs:osb
221 struct ocfs2_super *osb = OCFS2_SB(oi->vfs_inode.i_sb); in ocfs2_dinode_insert_check() local
224 mlog_bug_on_msg(!ocfs2_sparse_alloc(osb) && in ocfs2_dinode_insert_check()
228 osb->dev_str, in ocfs2_dinode_insert_check()
997 struct ocfs2_super *osb = in ocfs2_create_new_meta_bhs() local
1016 bhs[i] = sb_getblk(osb->sb, first_blkno); in ocfs2_create_new_meta_bhs()
1032 memset(bhs[i]->b_data, 0, osb->sb->s_blocksize); in ocfs2_create_new_meta_bhs()
1037 eb->h_fs_generation = cpu_to_le32(osb->fs_generation); in ocfs2_create_new_meta_bhs()
1043 cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); in ocfs2_create_new_meta_bhs()
3106 static int ocfs2_remove_rightmost_empty_extent(struct ocfs2_super *osb, in ocfs2_remove_rightmost_empty_extent() argument
3115 handle = ocfs2_start_trans(osb, credits); in ocfs2_remove_rightmost_empty_extent()
3126 ocfs2_commit_trans(osb, handle); in ocfs2_remove_rightmost_empty_extent()
4788 struct ocfs2_super *osb = in ocfs2_add_clusters_in_btree() local
4841 block = ocfs2_clusters_to_blocks(osb->sb, bit_off); in ocfs2_add_clusters_in_btree()
4867 ocfs2_free_local_alloc_bits(osb, handle, data_ac, in ocfs2_add_clusters_in_btree()
4873 ocfs2_clusters_to_blocks(osb->sb, bit_off), in ocfs2_add_clusters_in_btree()
5659 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_reserve_blocks_for_rec_trunc() local
5671 (ocfs2_sparse_alloc(osb) && num_free_extents < max_recs_needed)) in ocfs2_reserve_blocks_for_rec_trunc()
5675 ret = ocfs2_reserve_new_metadata_blocks(osb, extra_blocks, ac); in ocfs2_reserve_blocks_for_rec_trunc()
5701 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_remove_btree_range() local
5702 struct inode *tl_inode = osb->osb_tl_inode; in ocfs2_remove_btree_range()
5711 ret = ocfs2_lock_refcount_tree(osb, refcount_loc, 1, in ocfs2_remove_btree_range()
5740 if (ocfs2_truncate_log_needs_flush(osb)) { in ocfs2_remove_btree_range()
5741 ret = __ocfs2_flush_truncate_log(osb); in ocfs2_remove_btree_range()
5748 handle = ocfs2_start_trans(osb, in ocfs2_remove_btree_range()
5749 ocfs2_remove_extent_credits(osb->sb) + credits); in ocfs2_remove_btree_range()
5780 ocfs2_blocks_to_clusters(osb->sb, in ocfs2_remove_btree_range()
5785 ret = ocfs2_truncate_log_append(osb, handle, in ocfs2_remove_btree_range()
5793 ocfs2_commit_trans(osb, handle); in ocfs2_remove_btree_range()
5801 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_remove_btree_range()
5806 int ocfs2_truncate_log_needs_flush(struct ocfs2_super *osb) in ocfs2_truncate_log_needs_flush() argument
5808 struct buffer_head *tl_bh = osb->osb_tl_bh; in ocfs2_truncate_log_needs_flush()
5817 "%u, count = %u\n", osb->slot_num, in ocfs2_truncate_log_needs_flush()
5839 int ocfs2_truncate_log_append(struct ocfs2_super *osb, in ocfs2_truncate_log_append() argument
5846 struct inode *tl_inode = osb->osb_tl_inode; in ocfs2_truncate_log_append()
5847 struct buffer_head *tl_bh = osb->osb_tl_bh; in ocfs2_truncate_log_append()
5853 start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); in ocfs2_truncate_log_append()
5864 mlog_bug_on_msg(tl_count > ocfs2_truncate_recs_per_inode(osb->sb) || in ocfs2_truncate_log_append()
5869 ocfs2_truncate_recs_per_inode(osb->sb), in ocfs2_truncate_log_append()
5910 osb->truncated_clusters += num_clusters; in ocfs2_truncate_log_append()
5915 static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, in ocfs2_replay_truncate_records() argument
5926 struct inode *tl_inode = osb->osb_tl_inode; in ocfs2_replay_truncate_records()
5927 struct buffer_head *tl_bh = osb->osb_tl_bh; in ocfs2_replay_truncate_records()
5934 handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC); in ocfs2_replay_truncate_records()
5975 ocfs2_commit_trans(osb, handle); in ocfs2_replay_truncate_records()
5979 osb->truncated_clusters = 0; in ocfs2_replay_truncate_records()
5986 int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) in __ocfs2_flush_truncate_log() argument
5990 struct inode *tl_inode = osb->osb_tl_inode; in __ocfs2_flush_truncate_log()
5992 struct buffer_head *tl_bh = osb->osb_tl_bh; in __ocfs2_flush_truncate_log()
5996 struct ocfs2_journal *journal = osb->journal; in __ocfs2_flush_truncate_log()
6031 data_alloc_inode = ocfs2_get_system_file_inode(osb, in __ocfs2_flush_truncate_log()
6048 status = ocfs2_replay_truncate_records(osb, data_alloc_inode, in __ocfs2_flush_truncate_log()
6064 int ocfs2_flush_truncate_log(struct ocfs2_super *osb) in ocfs2_flush_truncate_log() argument
6067 struct inode *tl_inode = osb->osb_tl_inode; in ocfs2_flush_truncate_log()
6070 status = __ocfs2_flush_truncate_log(osb); in ocfs2_flush_truncate_log()
6079 struct ocfs2_super *osb = in ocfs2_truncate_log_worker() local
6083 status = ocfs2_flush_truncate_log(osb); in ocfs2_truncate_log_worker()
6087 ocfs2_init_steal_slots(osb); in ocfs2_truncate_log_worker()
6091 void ocfs2_schedule_truncate_log_flush(struct ocfs2_super *osb, in ocfs2_schedule_truncate_log_flush() argument
6094 if (osb->osb_tl_inode && in ocfs2_schedule_truncate_log_flush()
6095 atomic_read(&osb->osb_tl_disable) == 0) { in ocfs2_schedule_truncate_log_flush()
6099 cancel_delayed_work(&osb->osb_truncate_log_wq); in ocfs2_schedule_truncate_log_flush()
6101 queue_delayed_work(osb->ocfs2_wq, &osb->osb_truncate_log_wq, in ocfs2_schedule_truncate_log_flush()
6111 int ocfs2_try_to_free_truncate_log(struct ocfs2_super *osb, in ocfs2_try_to_free_truncate_log() argument
6118 inode_lock(osb->osb_tl_inode); in ocfs2_try_to_free_truncate_log()
6119 truncated_clusters = osb->truncated_clusters; in ocfs2_try_to_free_truncate_log()
6120 inode_unlock(osb->osb_tl_inode); in ocfs2_try_to_free_truncate_log()
6129 ret = ocfs2_flush_truncate_log(osb); in ocfs2_try_to_free_truncate_log()
6135 if (jbd2_journal_start_commit(osb->journal->j_journal, &target)) { in ocfs2_try_to_free_truncate_log()
6136 jbd2_log_wait_commit(osb->journal->j_journal, target); in ocfs2_try_to_free_truncate_log()
6143 static int ocfs2_get_truncate_log_info(struct ocfs2_super *osb, in ocfs2_get_truncate_log_info() argument
6152 inode = ocfs2_get_system_file_inode(osb, in ocfs2_get_truncate_log_info()
6178 int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb, in ocfs2_begin_truncate_log_recovery() argument
6192 status = ocfs2_get_truncate_log_info(osb, slot_num, &tl_inode, &tl_bh); in ocfs2_begin_truncate_log_recovery()
6224 ocfs2_compute_meta_ecc(osb->sb, tl_bh->b_data, &di->i_check); in ocfs2_begin_truncate_log_recovery()
6225 status = ocfs2_write_block(osb, tl_bh, INODE_CACHE(tl_inode)); in ocfs2_begin_truncate_log_recovery()
6245 int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, in ocfs2_complete_truncate_log_recovery() argument
6253 struct inode *tl_inode = osb->osb_tl_inode; in ocfs2_complete_truncate_log_recovery()
6269 if (ocfs2_truncate_log_needs_flush(osb)) { in ocfs2_complete_truncate_log_recovery()
6270 status = __ocfs2_flush_truncate_log(osb); in ocfs2_complete_truncate_log_recovery()
6277 handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_UPDATE); in ocfs2_complete_truncate_log_recovery()
6286 start_blk = ocfs2_clusters_to_blocks(osb->sb, start_cluster); in ocfs2_complete_truncate_log_recovery()
6288 status = ocfs2_truncate_log_append(osb, handle, in ocfs2_complete_truncate_log_recovery()
6290 ocfs2_commit_trans(osb, handle); in ocfs2_complete_truncate_log_recovery()
6303 void ocfs2_truncate_log_shutdown(struct ocfs2_super *osb) in ocfs2_truncate_log_shutdown() argument
6306 struct inode *tl_inode = osb->osb_tl_inode; in ocfs2_truncate_log_shutdown()
6308 atomic_set(&osb->osb_tl_disable, 1); in ocfs2_truncate_log_shutdown()
6311 cancel_delayed_work(&osb->osb_truncate_log_wq); in ocfs2_truncate_log_shutdown()
6312 flush_workqueue(osb->ocfs2_wq); in ocfs2_truncate_log_shutdown()
6314 status = ocfs2_flush_truncate_log(osb); in ocfs2_truncate_log_shutdown()
6318 brelse(osb->osb_tl_bh); in ocfs2_truncate_log_shutdown()
6319 iput(osb->osb_tl_inode); in ocfs2_truncate_log_shutdown()
6323 int ocfs2_truncate_log_init(struct ocfs2_super *osb) in ocfs2_truncate_log_init() argument
6329 status = ocfs2_get_truncate_log_info(osb, in ocfs2_truncate_log_init()
6330 osb->slot_num, in ocfs2_truncate_log_init()
6339 INIT_DELAYED_WORK(&osb->osb_truncate_log_wq, in ocfs2_truncate_log_init()
6341 atomic_set(&osb->osb_tl_disable, 0); in ocfs2_truncate_log_init()
6342 osb->osb_tl_bh = tl_bh; in ocfs2_truncate_log_init()
6343 osb->osb_tl_inode = tl_inode; in ocfs2_truncate_log_init()
6386 static int ocfs2_free_cached_blocks(struct ocfs2_super *osb, in ocfs2_free_cached_blocks() argument
6398 inode = ocfs2_get_system_file_inode(osb, sysfile_type, slot); in ocfs2_free_cached_blocks()
6419 handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE); in ocfs2_free_cached_blocks()
6434 ocfs2_commit_trans(osb, handle); in ocfs2_free_cached_blocks()
6481 static int ocfs2_free_cached_clusters(struct ocfs2_super *osb, in ocfs2_free_cached_clusters() argument
6485 struct inode *tl_inode = osb->osb_tl_inode; in ocfs2_free_cached_clusters()
6492 if (ocfs2_truncate_log_needs_flush(osb)) { in ocfs2_free_cached_clusters()
6493 ret = __ocfs2_flush_truncate_log(osb); in ocfs2_free_cached_clusters()
6500 handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_UPDATE); in ocfs2_free_cached_clusters()
6507 ret = ocfs2_truncate_log_append(osb, handle, head->free_blk, in ocfs2_free_cached_clusters()
6510 ocfs2_commit_trans(osb, handle); in ocfs2_free_cached_clusters()
6533 int ocfs2_run_deallocs(struct ocfs2_super *osb, in ocfs2_run_deallocs() argument
6548 ret2 = ocfs2_free_cached_blocks(osb, in ocfs2_run_deallocs()
6563 ret2 = ocfs2_free_cached_clusters(osb, in ocfs2_run_deallocs()
6662 struct ocfs2_super *osb = in ocfs2_reuse_blk_from_dealloc() local
6678 osb->slot_num, &real_slot, in ocfs2_reuse_blk_from_dealloc()
6691 new_eb_bh[i] = sb_getblk(osb->sb, bf->free_blk); in ocfs2_reuse_blk_from_dealloc()
6700 bf->free_blk, osb->slot_num, real_slot); in ocfs2_reuse_blk_from_dealloc()
6712 memset(new_eb_bh[i]->b_data, 0, osb->sb->s_blocksize); in ocfs2_reuse_blk_from_dealloc()
6720 eb->h_fs_generation = cpu_to_le32(osb->fs_generation); in ocfs2_reuse_blk_from_dealloc()
6725 cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); in ocfs2_reuse_blk_from_dealloc()
7057 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_convert_inline_data_to_extents() local
7061 loff_t end = osb->s_clustersize; in ocfs2_convert_inline_data_to_extents()
7068 pages = kcalloc(ocfs2_pages_per_cluster(osb->sb), in ocfs2_convert_inline_data_to_extents()
7076 ret = ocfs2_reserve_clusters(osb, 1, &data_ac); in ocfs2_convert_inline_data_to_extents()
7083 handle = ocfs2_start_trans(osb, in ocfs2_convert_inline_data_to_extents()
7084 ocfs2_inline_to_extents_credits(osb->sb)); in ocfs2_convert_inline_data_to_extents()
7103 ocfs2_clusters_to_bytes(osb->sb, 1)); in ocfs2_convert_inline_data_to_extents()
7127 if (!ocfs2_sparse_alloc(osb) && in ocfs2_convert_inline_data_to_extents()
7128 PAGE_SIZE < osb->s_clustersize) in ocfs2_convert_inline_data_to_extents()
7150 if (PAGE_SIZE > osb->s_clustersize) in ocfs2_convert_inline_data_to_extents()
7151 page_end = osb->s_clustersize; in ocfs2_convert_inline_data_to_extents()
7192 ocfs2_clusters_to_bytes(osb->sb, 1)); in ocfs2_convert_inline_data_to_extents()
7196 ocfs2_free_local_alloc_bits(osb, handle, data_ac, in ocfs2_convert_inline_data_to_extents()
7202 ocfs2_clusters_to_blocks(osb->sb, bit_off), in ocfs2_convert_inline_data_to_extents()
7206 ocfs2_commit_trans(osb, handle); in ocfs2_convert_inline_data_to_extents()
7222 int ocfs2_commit_truncate(struct ocfs2_super *osb, in ocfs2_commit_truncate() argument
7242 new_highest_cpos = ocfs2_clusters_for_bytes(osb->sb, in ocfs2_commit_truncate()
7314 status = ocfs2_remove_rightmost_empty_extent(osb, in ocfs2_commit_truncate()
7356 status = ocfs2_lock_refcount_tree(osb, refcount_loc, 1, in ocfs2_commit_truncate()
7382 ocfs2_unlock_refcount_tree(osb, ref_tree, 1); in ocfs2_commit_truncate()
7384 ocfs2_schedule_truncate_log_flush(osb, 1); in ocfs2_commit_truncate()
7386 ocfs2_run_deallocs(osb, &dealloc); in ocfs2_commit_truncate()
7402 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_truncate_inline() local
7413 !ocfs2_supports_inline_data(osb)) { in ocfs2_truncate_inline()
7419 osb->s_feature_incompat); in ocfs2_truncate_inline()
7424 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); in ocfs2_truncate_inline()
7462 ocfs2_commit_trans(osb, handle); in ocfs2_truncate_inline()
7473 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_trim_extent() local
7486 if (group != osb->first_cluster_group_blkno) in ocfs2_trim_extent()
7542 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_trim_mainbm() local
7552 start = range->start >> osb->s_clustersize_bits; in ocfs2_trim_mainbm()
7553 len = range->len >> osb->s_clustersize_bits; in ocfs2_trim_mainbm()
7554 minlen = range->minlen >> osb->s_clustersize_bits; in ocfs2_trim_mainbm()
7556 if (minlen >= osb->bitmap_cpg || range->len < sb->s_blocksize) in ocfs2_trim_mainbm()
7562 main_bm_inode = ocfs2_get_system_file_inode(osb, in ocfs2_trim_mainbm()
7597 if (first_group == osb->first_cluster_group_blkno) in ocfs2_trim_mainbm()
7608 if (first_bit + len >= osb->bitmap_cpg) in ocfs2_trim_mainbm()
7609 last_bit = osb->bitmap_cpg; in ocfs2_trim_mainbm()
7633 len -= osb->bitmap_cpg - first_bit; in ocfs2_trim_mainbm()
7635 if (group == osb->first_cluster_group_blkno) in ocfs2_trim_mainbm()
7636 group = ocfs2_clusters_to_blocks(sb, osb->bitmap_cpg); in ocfs2_trim_mainbm()
7638 group += ocfs2_clusters_to_blocks(sb, osb->bitmap_cpg); in ocfs2_trim_mainbm()
7664 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_trim_fs() local
7667 ocfs2_trim_fs_lock_res_init(osb); in ocfs2_trim_fs()
7671 ret = ocfs2_trim_fs_lock(osb, NULL, 1); in ocfs2_trim_fs()
7675 ocfs2_trim_fs_lock_res_uninit(osb); in ocfs2_trim_fs()
7681 osb->dev_str); in ocfs2_trim_fs()
7682 ret = ocfs2_trim_fs_lock(osb, &info, 0); in ocfs2_trim_fs()
7685 ocfs2_trim_fs_lock_res_uninit(osb); in ocfs2_trim_fs()
7696 osb->dev_str, info.tf_nodenum); in ocfs2_trim_fs()
7702 info.tf_nodenum = osb->node_num; in ocfs2_trim_fs()
7713 ocfs2_trim_fs_unlock(osb, pinfo); in ocfs2_trim_fs()
7714 ocfs2_trim_fs_lock_res_uninit(osb); in ocfs2_trim_fs()