Lines Matching full:context

52 			       struct ocfs2_move_extents_context *context,  in __ocfs2_move_extent()  argument
57 struct inode *inode = context->inode; in __ocfs2_move_extent()
62 u64 ino = ocfs2_metadata_cache_owner(context->et.et_ci); in __ocfs2_move_extent()
78 path = ocfs2_new_path_from_et(&context->et); in __ocfs2_move_extent()
111 context->et.et_root_bh, in __ocfs2_move_extent()
118 ret = ocfs2_split_extent(handle, &context->et, path, index, in __ocfs2_move_extent()
119 &replace_rec, context->meta_ac, in __ocfs2_move_extent()
120 &context->dealloc); in __ocfs2_move_extent()
126 ocfs2_journal_dirty(handle, context->et.et_root_bh); in __ocfs2_move_extent()
128 context->new_phys_cpos = new_p_cpos; in __ocfs2_move_extent()
138 len, context->meta_ac, in __ocfs2_move_extent()
139 &context->dealloc, 1); in __ocfs2_move_extent()
207 static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context, in ocfs2_defrag_extent() argument
210 int ret, credits = 0, extra_blocks = 0, partial = context->partial; in ocfs2_defrag_extent()
212 struct inode *inode = context->inode; in ocfs2_defrag_extent()
222 BUG_ON(!context->refcount_loc); in ocfs2_defrag_extent()
224 ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1, in ocfs2_defrag_extent()
232 context->refcount_loc, in ocfs2_defrag_extent()
243 ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et, in ocfs2_defrag_extent()
245 &context->meta_ac, in ocfs2_defrag_extent()
255 * if (context->data_ac) in ocfs2_defrag_extent()
256 * context->data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; in ocfs2_defrag_extent()
278 ret = ocfs2_reserve_clusters(osb, *len, &context->data_ac); in ocfs2_defrag_extent()
291 ret = __ocfs2_claim_clusters(handle, context->data_ac, 1, *len, in ocfs2_defrag_extent()
307 context->range->me_flags &= ~OCFS2_MOVE_EXT_FL_COMPLETE; in ocfs2_defrag_extent()
317 ret = __ocfs2_move_extent(handle, context, cpos, new_len, phys_cpos, in ocfs2_defrag_extent()
329 ret = ocfs2_cow_sync_writeback(inode->i_sb, context->inode, cpos, *len); in ocfs2_defrag_extent()
334 if (need_free && context->data_ac) { in ocfs2_defrag_extent()
335 struct ocfs2_alloc_context *data_ac = context->data_ac; in ocfs2_defrag_extent()
337 if (context->data_ac->ac_which == OCFS2_AC_USE_LOCAL) in ocfs2_defrag_extent()
353 if (context->data_ac) { in ocfs2_defrag_extent()
354 ocfs2_free_alloc_context(context->data_ac); in ocfs2_defrag_extent()
355 context->data_ac = NULL; in ocfs2_defrag_extent()
358 if (context->meta_ac) { in ocfs2_defrag_extent()
359 ocfs2_free_alloc_context(context->meta_ac); in ocfs2_defrag_extent()
360 context->meta_ac = NULL; in ocfs2_defrag_extent()
573 static int ocfs2_move_extent(struct ocfs2_move_extents_context *context, in ocfs2_move_extent() argument
579 struct inode *inode = context->inode; in ocfs2_move_extent()
588 context->range->me_threshold); in ocfs2_move_extent()
595 BUG_ON(!context->refcount_loc); in ocfs2_move_extent()
597 ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1, in ocfs2_move_extent()
605 context->refcount_loc, in ocfs2_move_extent()
616 ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et, in ocfs2_move_extent()
618 &context->meta_ac, in ocfs2_move_extent()
683 ret = __ocfs2_move_extent(handle, context, cpos, len, phys_cpos, in ocfs2_move_extent()
710 ret = ocfs2_cow_sync_writeback(inode->i_sb, context->inode, cpos, len); in ocfs2_move_extent()
728 if (context->meta_ac) { in ocfs2_move_extent()
729 ocfs2_free_alloc_context(context->meta_ac); in ocfs2_move_extent()
730 context->meta_ac = NULL; in ocfs2_move_extent()
770 struct ocfs2_move_extents_context *context) in __ocfs2_move_extents_range() argument
776 struct inode *inode = context->inode; in __ocfs2_move_extents_range()
778 struct ocfs2_move_extents *range = context->range; in __ocfs2_move_extents_range()
787 context->refcount_loc = le64_to_cpu(di->i_refcount_loc); in __ocfs2_move_extents_range()
789 ocfs2_init_dinode_extent_tree(&context->et, INODE_CACHE(inode), di_bh); in __ocfs2_move_extents_range()
790 ocfs2_init_dealloc_ctxt(&context->dealloc); in __ocfs2_move_extents_range()
798 do_defrag = context->auto_defrag; in __ocfs2_move_extents_range()
868 ret = ocfs2_defrag_extent(context, cpos, phys_cpos, in __ocfs2_move_extents_range()
871 ret = ocfs2_move_extent(context, cpos, phys_cpos, in __ocfs2_move_extents_range()
883 context->clusters_moved += alloc_size; in __ocfs2_move_extents_range()
894 context->clusters_moved); in __ocfs2_move_extents_range()
896 context->new_phys_cpos); in __ocfs2_move_extents_range()
899 ocfs2_run_deallocs(osb, &context->dealloc); in __ocfs2_move_extents_range()
904 static int ocfs2_move_extents(struct ocfs2_move_extents_context *context) in ocfs2_move_extents() argument
908 struct inode *inode = context->inode; in ocfs2_move_extents()
938 status = __ocfs2_move_extents_range(di_bh, context); in ocfs2_move_extents()
991 struct ocfs2_move_extents_context *context; in ocfs2_ioctl_move_extents() local
1010 context = kzalloc(sizeof(struct ocfs2_move_extents_context), GFP_NOFS); in ocfs2_ioctl_move_extents()
1011 if (!context) { in ocfs2_ioctl_move_extents()
1017 context->inode = inode; in ocfs2_ioctl_move_extents()
1018 context->file = filp; in ocfs2_ioctl_move_extents()
1033 context->range = ⦥ in ocfs2_ioctl_move_extents()
1036 context->auto_defrag = 1; in ocfs2_ioctl_move_extents()
1049 context->partial = 1; in ocfs2_ioctl_move_extents()
1063 status = ocfs2_move_extents(context); in ocfs2_ioctl_move_extents()
1076 kfree(context); in ocfs2_ioctl_move_extents()