diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 13:52:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 13:52:55 -0400 |
commit | add096909da63ef32d6766f6771c07c9f16c6ee5 (patch) | |
tree | 58594bcf68cbb6f777d5270d098ab8ca69cbaee3 /fs/ocfs2/extent_map.c | |
parent | e245befce7af0a1e1347079ed62695b059594bd4 (diff) | |
parent | 54c57dc3b6578356c0a428c767d4bf080254a2ee (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2: (32 commits)
[PATCH] ocfs2: zero_user_page conversion
ocfs2: Support xfs style space reservation ioctls
ocfs2: support for removing file regions
ocfs2: update truncate handling of partial clusters
ocfs2: btree support for removal of arbirtrary extents
ocfs2: Support creation of unwritten extents
ocfs2: support writing of unwritten extents
ocfs2: small cleanup of ocfs2_write_begin_nolock()
ocfs2: btree changes for unwritten extents
ocfs2: abstract btree growing calls
ocfs2: use all extent block suballocators
ocfs2: plug truncate into cached dealloc routines
ocfs2: simplify deallocation locking
ocfs2: harden buffer check during mapping of page blocks
ocfs2: shared writeable mmap
ocfs2: factor out write aops into nolock variants
ocfs2: rework ocfs2_buffered_write_cluster()
ocfs2: take ip_alloc_sem during entire truncate
ocfs2: Add "preferred slot" mount option
[KJ PATCH] Replacing memset(<addr>,0,PAGE_SIZE) with clear_page() in fs/ocfs2/dlm/dlmrecovery.c
...
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) |