Lines Matching refs:emi
53 struct ocfs2_extent_map_item *emi; in __ocfs2_extent_map_lookup() local
57 list_for_each_entry(emi, &em->em_list, ei_list) { in __ocfs2_extent_map_lookup()
58 range = emi->ei_cpos + emi->ei_clusters; in __ocfs2_extent_map_lookup()
60 if (cpos >= emi->ei_cpos && cpos < range) { in __ocfs2_extent_map_lookup()
61 list_move(&emi->ei_list, &em->em_list); in __ocfs2_extent_map_lookup()
63 *ret_emi = emi; in __ocfs2_extent_map_lookup()
75 struct ocfs2_extent_map_item *emi; in ocfs2_extent_map_lookup() local
79 __ocfs2_extent_map_lookup(&oi->ip_extent_map, cpos, &emi); in ocfs2_extent_map_lookup()
80 if (emi) { in ocfs2_extent_map_lookup()
81 coff = cpos - emi->ei_cpos; in ocfs2_extent_map_lookup()
82 *phys = emi->ei_phys + coff; in ocfs2_extent_map_lookup()
84 *len = emi->ei_clusters - coff; in ocfs2_extent_map_lookup()
86 *flags = emi->ei_flags; in ocfs2_extent_map_lookup()
91 if (emi == NULL) in ocfs2_extent_map_lookup()
102 struct ocfs2_extent_map_item *emi, *n; in ocfs2_extent_map_trunc() local
109 list_for_each_entry_safe(emi, n, &em->em_list, ei_list) { in ocfs2_extent_map_trunc()
110 if (emi->ei_cpos >= cpos) { in ocfs2_extent_map_trunc()
112 list_move(&emi->ei_list, &tmp_list); in ocfs2_extent_map_trunc()
118 range = emi->ei_cpos + emi->ei_clusters; in ocfs2_extent_map_trunc()
121 emi->ei_clusters = cpos - emi->ei_cpos; in ocfs2_extent_map_trunc()
126 list_for_each_entry_safe(emi, n, &tmp_list, ei_list) { in ocfs2_extent_map_trunc()
127 list_del(&emi->ei_list); in ocfs2_extent_map_trunc()
128 kfree(emi); in ocfs2_extent_map_trunc()
170 static int ocfs2_try_to_merge_extent_map(struct ocfs2_extent_map_item *emi, in ocfs2_try_to_merge_extent_map() argument
176 if (ins->ei_phys == (emi->ei_phys + emi->ei_clusters) && in ocfs2_try_to_merge_extent_map()
177 ins->ei_cpos == (emi->ei_cpos + emi->ei_clusters) && in ocfs2_try_to_merge_extent_map()
178 ins->ei_flags == emi->ei_flags) { in ocfs2_try_to_merge_extent_map()
179 emi->ei_clusters += ins->ei_clusters; in ocfs2_try_to_merge_extent_map()
181 } else if ((ins->ei_phys + ins->ei_clusters) == emi->ei_phys && in ocfs2_try_to_merge_extent_map()
182 (ins->ei_cpos + ins->ei_clusters) == emi->ei_cpos && in ocfs2_try_to_merge_extent_map()
183 ins->ei_flags == emi->ei_flags) { in ocfs2_try_to_merge_extent_map()
184 emi->ei_phys = ins->ei_phys; in ocfs2_try_to_merge_extent_map()
185 emi->ei_cpos = ins->ei_cpos; in ocfs2_try_to_merge_extent_map()
186 emi->ei_clusters += ins->ei_clusters; in ocfs2_try_to_merge_extent_map()
195 if (ocfs2_ei_is_contained(emi, ins) || in ocfs2_try_to_merge_extent_map()
196 ocfs2_ei_is_contained(ins, emi)) { in ocfs2_try_to_merge_extent_map()
197 ocfs2_copy_emi_fields(emi, ins); in ocfs2_try_to_merge_extent_map()
218 struct ocfs2_extent_map_item *emi, *new_emi = NULL; in ocfs2_extent_map_insert_rec() local
230 list_for_each_entry(emi, &em->em_list, ei_list) { in ocfs2_extent_map_insert_rec()
231 if (ocfs2_try_to_merge_extent_map(emi, &ins)) { in ocfs2_extent_map_insert_rec()
232 list_move(&emi->ei_list, &em->em_list); in ocfs2_extent_map_insert_rec()
262 emi = list_entry(em->em_list.prev, in ocfs2_extent_map_insert_rec()
264 list_move(&emi->ei_list, &em->em_list); in ocfs2_extent_map_insert_rec()
265 ocfs2_copy_emi_fields(emi, &ins); in ocfs2_extent_map_insert_rec()