Lines Matching refs:context

50 			       struct ocfs2_move_extents_context *context,  in __ocfs2_move_extent()  argument
55 struct inode *inode = context->inode; in __ocfs2_move_extent()
60 u64 ino = ocfs2_metadata_cache_owner(context->et.et_ci); in __ocfs2_move_extent()
76 path = ocfs2_new_path_from_et(&context->et); in __ocfs2_move_extent()
109 context->et.et_root_bh, in __ocfs2_move_extent()
116 ret = ocfs2_split_extent(handle, &context->et, path, index, in __ocfs2_move_extent()
117 &replace_rec, context->meta_ac, in __ocfs2_move_extent()
118 &context->dealloc); in __ocfs2_move_extent()
124 ocfs2_journal_dirty(handle, context->et.et_root_bh); in __ocfs2_move_extent()
126 context->new_phys_cpos = new_p_cpos; in __ocfs2_move_extent()
136 len, context->meta_ac, in __ocfs2_move_extent()
137 &context->dealloc, 1); in __ocfs2_move_extent()
205 static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context, in ocfs2_defrag_extent() argument
208 int ret, credits = 0, extra_blocks = 0, partial = context->partial; in ocfs2_defrag_extent()
210 struct inode *inode = context->inode; in ocfs2_defrag_extent()
220 BUG_ON(!context->refcount_loc); in ocfs2_defrag_extent()
222 ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1, in ocfs2_defrag_extent()
230 context->refcount_loc, in ocfs2_defrag_extent()
241 ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et, in ocfs2_defrag_extent()
243 &context->meta_ac, in ocfs2_defrag_extent()
276 ret = ocfs2_reserve_clusters(osb, *len, &context->data_ac); in ocfs2_defrag_extent()
289 ret = __ocfs2_claim_clusters(handle, context->data_ac, 1, *len, in ocfs2_defrag_extent()
305 context->range->me_flags &= ~OCFS2_MOVE_EXT_FL_COMPLETE; in ocfs2_defrag_extent()
315 ret = __ocfs2_move_extent(handle, context, cpos, new_len, phys_cpos, in ocfs2_defrag_extent()
327 ret = ocfs2_cow_sync_writeback(inode->i_sb, context->inode, cpos, *len); in ocfs2_defrag_extent()
332 if (need_free && context->data_ac) { in ocfs2_defrag_extent()
333 struct ocfs2_alloc_context *data_ac = context->data_ac; in ocfs2_defrag_extent()
335 if (context->data_ac->ac_which == OCFS2_AC_USE_LOCAL) in ocfs2_defrag_extent()
351 if (context->data_ac) { in ocfs2_defrag_extent()
352 ocfs2_free_alloc_context(context->data_ac); in ocfs2_defrag_extent()
353 context->data_ac = NULL; in ocfs2_defrag_extent()
356 if (context->meta_ac) { in ocfs2_defrag_extent()
357 ocfs2_free_alloc_context(context->meta_ac); in ocfs2_defrag_extent()
358 context->meta_ac = NULL; in ocfs2_defrag_extent()
571 static int ocfs2_move_extent(struct ocfs2_move_extents_context *context, in ocfs2_move_extent() argument
577 struct inode *inode = context->inode; in ocfs2_move_extent()
586 context->range->me_threshold); in ocfs2_move_extent()
593 BUG_ON(!context->refcount_loc); in ocfs2_move_extent()
595 ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1, in ocfs2_move_extent()
603 context->refcount_loc, in ocfs2_move_extent()
614 ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et, in ocfs2_move_extent()
616 &context->meta_ac, in ocfs2_move_extent()
681 ret = __ocfs2_move_extent(handle, context, cpos, len, phys_cpos, in ocfs2_move_extent()
708 ret = ocfs2_cow_sync_writeback(inode->i_sb, context->inode, cpos, len); in ocfs2_move_extent()
726 if (context->meta_ac) { in ocfs2_move_extent()
727 ocfs2_free_alloc_context(context->meta_ac); in ocfs2_move_extent()
728 context->meta_ac = NULL; in ocfs2_move_extent()
768 struct ocfs2_move_extents_context *context) in __ocfs2_move_extents_range() argument
774 struct inode *inode = context->inode; in __ocfs2_move_extents_range()
776 struct ocfs2_move_extents *range = context->range; in __ocfs2_move_extents_range()
785 context->refcount_loc = le64_to_cpu(di->i_refcount_loc); in __ocfs2_move_extents_range()
787 ocfs2_init_dinode_extent_tree(&context->et, INODE_CACHE(inode), di_bh); in __ocfs2_move_extents_range()
788 ocfs2_init_dealloc_ctxt(&context->dealloc); in __ocfs2_move_extents_range()
796 do_defrag = context->auto_defrag; in __ocfs2_move_extents_range()
866 ret = ocfs2_defrag_extent(context, cpos, phys_cpos, in __ocfs2_move_extents_range()
869 ret = ocfs2_move_extent(context, cpos, phys_cpos, in __ocfs2_move_extents_range()
881 context->clusters_moved += alloc_size; in __ocfs2_move_extents_range()
892 context->clusters_moved); in __ocfs2_move_extents_range()
894 context->new_phys_cpos); in __ocfs2_move_extents_range()
897 ocfs2_run_deallocs(osb, &context->dealloc); in __ocfs2_move_extents_range()
902 static int ocfs2_move_extents(struct ocfs2_move_extents_context *context) in ocfs2_move_extents() argument
906 struct inode *inode = context->inode; in ocfs2_move_extents()
936 status = __ocfs2_move_extents_range(di_bh, context); in ocfs2_move_extents()
989 struct ocfs2_move_extents_context *context; in ocfs2_ioctl_move_extents() local
1008 context = kzalloc(sizeof(struct ocfs2_move_extents_context), GFP_NOFS); in ocfs2_ioctl_move_extents()
1009 if (!context) { in ocfs2_ioctl_move_extents()
1015 context->inode = inode; in ocfs2_ioctl_move_extents()
1016 context->file = filp; in ocfs2_ioctl_move_extents()
1031 context->range = ⦥ in ocfs2_ioctl_move_extents()
1034 context->auto_defrag = 1; in ocfs2_ioctl_move_extents()
1047 context->partial = 1; in ocfs2_ioctl_move_extents()
1061 status = ocfs2_move_extents(context); in ocfs2_ioctl_move_extents()
1074 kfree(context); in ocfs2_ioctl_move_extents()