diff options
Diffstat (limited to 'fs/ocfs2/extent_map.c')
-rw-r--r-- | fs/ocfs2/extent_map.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index ba2b2ab1c6e4..03c1d365c78b 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -109,17 +109,14 @@ static int ocfs2_extent_map_lookup(struct inode *inode, unsigned int cpos, | |||
109 | */ | 109 | */ |
110 | void ocfs2_extent_map_trunc(struct inode *inode, unsigned int cpos) | 110 | void ocfs2_extent_map_trunc(struct inode *inode, unsigned int cpos) |
111 | { | 111 | { |
112 | struct list_head *p, *n; | 112 | struct ocfs2_extent_map_item *emi, *n; |
113 | struct ocfs2_extent_map_item *emi; | ||
114 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 113 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
115 | struct ocfs2_extent_map *em = &oi->ip_extent_map; | 114 | struct ocfs2_extent_map *em = &oi->ip_extent_map; |
116 | LIST_HEAD(tmp_list); | 115 | LIST_HEAD(tmp_list); |
117 | unsigned int range; | 116 | unsigned int range; |
118 | 117 | ||
119 | spin_lock(&oi->ip_lock); | 118 | spin_lock(&oi->ip_lock); |
120 | list_for_each_safe(p, n, &em->em_list) { | 119 | list_for_each_entry_safe(emi, n, &em->em_list, ei_list) { |
121 | emi = list_entry(p, struct ocfs2_extent_map_item, ei_list); | ||
122 | |||
123 | if (emi->ei_cpos >= cpos) { | 120 | if (emi->ei_cpos >= cpos) { |
124 | /* Full truncate of this record. */ | 121 | /* Full truncate of this record. */ |
125 | list_move(&emi->ei_list, &tmp_list); | 122 | list_move(&emi->ei_list, &tmp_list); |
@@ -136,8 +133,7 @@ void ocfs2_extent_map_trunc(struct inode *inode, unsigned int cpos) | |||
136 | } | 133 | } |
137 | spin_unlock(&oi->ip_lock); | 134 | spin_unlock(&oi->ip_lock); |
138 | 135 | ||
139 | list_for_each_safe(p, n, &tmp_list) { | 136 | list_for_each_entry_safe(emi, n, &tmp_list, ei_list) { |
140 | emi = list_entry(p, struct ocfs2_extent_map_item, ei_list); | ||
141 | list_del(&emi->ei_list); | 137 | list_del(&emi->ei_list); |
142 | kfree(emi); | 138 | kfree(emi); |
143 | } | 139 | } |
@@ -377,37 +373,6 @@ out: | |||
377 | return ret; | 373 | return ret; |
378 | } | 374 | } |
379 | 375 | ||
380 | /* | ||
381 | * Return the index of the extent record which contains cluster #v_cluster. | ||
382 | * -1 is returned if it was not found. | ||
383 | * | ||
384 | * Should work fine on interior and exterior nodes. | ||
385 | */ | ||
386 | static int ocfs2_search_extent_list(struct ocfs2_extent_list *el, | ||
387 | u32 v_cluster) | ||
388 | { | ||
389 | int ret = -1; | ||
390 | int i; | ||
391 | struct ocfs2_extent_rec *rec; | ||
392 | u32 rec_end, rec_start, clusters; | ||
393 | |||
394 | for(i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { | ||
395 | rec = &el->l_recs[i]; | ||
396 | |||
397 | rec_start = le32_to_cpu(rec->e_cpos); | ||
398 | clusters = ocfs2_rec_clusters(el, rec); | ||
399 | |||
400 | rec_end = rec_start + clusters; | ||
401 | |||
402 | if (v_cluster >= rec_start && v_cluster < rec_end) { | ||
403 | ret = i; | ||
404 | break; | ||
405 | } | ||
406 | } | ||
407 | |||
408 | return ret; | ||
409 | } | ||
410 | |||
411 | int ocfs2_get_clusters(struct inode *inode, u32 v_cluster, | 376 | int ocfs2_get_clusters(struct inode *inode, u32 v_cluster, |
412 | u32 *p_cluster, u32 *num_clusters, | 377 | u32 *p_cluster, u32 *num_clusters, |
413 | unsigned int *extent_flags) | 378 | unsigned int *extent_flags) |