aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/extent_map.c
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2006-03-14 18:05:45 -0500
committerDave Kleikamp <shaggy@austin.ibm.com>2006-03-14 18:05:45 -0500
commitc5111f504d2a9b0d258d7c4752b4093523315989 (patch)
tree6a52864aff79691689aea21cb0cb928327d5de5b /fs/ocfs2/extent_map.c
parent69eb66d7da7dba2696281981347698e1693c2340 (diff)
parenta488edc914aa1d766a4e2c982b5ae03d5657ec1b (diff)
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'fs/ocfs2/extent_map.c')
-rw-r--r--fs/ocfs2/extent_map.c50
1 files changed, 41 insertions, 9 deletions
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index f2fb40cd296a..e6f207eebab4 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -181,6 +181,12 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
181 ret = -EBADR; 181 ret = -EBADR;
182 if (rec_end > OCFS2_I(inode)->ip_clusters) { 182 if (rec_end > OCFS2_I(inode)->ip_clusters) {
183 mlog_errno(ret); 183 mlog_errno(ret);
184 ocfs2_error(inode->i_sb,
185 "Extent %d at e_blkno %"MLFu64" of inode %"MLFu64" goes past ip_clusters of %u\n",
186 i,
187 le64_to_cpu(rec->e_blkno),
188 OCFS2_I(inode)->ip_blkno,
189 OCFS2_I(inode)->ip_clusters);
184 goto out_free; 190 goto out_free;
185 } 191 }
186 192
@@ -226,6 +232,12 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
226 ret = -EBADR; 232 ret = -EBADR;
227 if (blkno) { 233 if (blkno) {
228 mlog_errno(ret); 234 mlog_errno(ret);
235 ocfs2_error(inode->i_sb,
236 "Multiple extents for (cpos = %u, clusters = %u) on inode %"MLFu64"; e_blkno %"MLFu64" and rec %d at e_blkno %"MLFu64"\n",
237 cpos, clusters,
238 OCFS2_I(inode)->ip_blkno,
239 blkno, i,
240 le64_to_cpu(rec->e_blkno));
229 goto out_free; 241 goto out_free;
230 } 242 }
231 243
@@ -238,6 +250,10 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
238 */ 250 */
239 ret = -EBADR; 251 ret = -EBADR;
240 if (!blkno) { 252 if (!blkno) {
253 ocfs2_error(inode->i_sb,
254 "No record found for (cpos = %u, clusters = %u) on inode %"MLFu64"\n",
255 cpos, clusters,
256 OCFS2_I(inode)->ip_blkno);
241 mlog_errno(ret); 257 mlog_errno(ret);
242 goto out_free; 258 goto out_free;
243 } 259 }
@@ -262,11 +278,24 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
262 el = &eb->h_list; 278 el = &eb->h_list;
263 } 279 }
264 280
265 if (el->l_tree_depth) 281 BUG_ON(el->l_tree_depth);
266 BUG();
267 282
268 for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { 283 for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) {
269 rec = &el->l_recs[i]; 284 rec = &el->l_recs[i];
285
286 if ((le32_to_cpu(rec->e_cpos) + le32_to_cpu(rec->e_clusters)) >
287 OCFS2_I(inode)->ip_clusters) {
288 ret = -EBADR;
289 mlog_errno(ret);
290 ocfs2_error(inode->i_sb,
291 "Extent %d at e_blkno %"MLFu64" of inode %"MLFu64" goes past ip_clusters of %u\n",
292 i,
293 le64_to_cpu(rec->e_blkno),
294 OCFS2_I(inode)->ip_blkno,
295 OCFS2_I(inode)->ip_clusters);
296 return ret;
297 }
298
270 ret = ocfs2_extent_map_insert(inode, rec, 299 ret = ocfs2_extent_map_insert(inode, rec,
271 le16_to_cpu(el->l_tree_depth)); 300 le16_to_cpu(el->l_tree_depth));
272 if (ret) { 301 if (ret) {
@@ -364,8 +393,8 @@ static int ocfs2_extent_map_lookup_read(struct inode *inode,
364 return ret; 393 return ret;
365 } 394 }
366 395
367 if (ent->e_tree_depth) 396 /* FIXME: Make sure this isn't a corruption */
368 BUG(); /* FIXME: Make sure this isn't a corruption */ 397 BUG_ON(ent->e_tree_depth);
369 398
370 *ret_ent = ent; 399 *ret_ent = ent;
371 400
@@ -423,8 +452,7 @@ static int ocfs2_extent_map_try_insert(struct inode *inode,
423 le32_to_cpu(rec->e_clusters), NULL, 452 le32_to_cpu(rec->e_clusters), NULL,
424 NULL); 453 NULL);
425 454
426 if (!old_ent) 455 BUG_ON(!old_ent);
427 BUG();
428 456
429 ret = -EEXIST; 457 ret = -EEXIST;
430 if (old_ent->e_tree_depth < tree_depth) 458 if (old_ent->e_tree_depth < tree_depth)
@@ -528,6 +556,10 @@ static int ocfs2_extent_map_insert(struct inode *inode,
528 OCFS2_I(inode)->ip_map.em_clusters) { 556 OCFS2_I(inode)->ip_map.em_clusters) {
529 ret = -EBADR; 557 ret = -EBADR;
530 mlog_errno(ret); 558 mlog_errno(ret);
559 ocfs2_error(inode->i_sb,
560 "Zero e_clusters on non-tail extent record at e_blkno %"MLFu64" on inode %"MLFu64"\n",
561 le64_to_cpu(rec->e_blkno),
562 OCFS2_I(inode)->ip_blkno);
531 return ret; 563 return ret;
532 } 564 }
533 565
@@ -590,12 +622,12 @@ static int ocfs2_extent_map_insert(struct inode *inode,
590 * Existing record in the extent map: 622 * Existing record in the extent map:
591 * 623 *
592 * cpos = 10, len = 10 624 * cpos = 10, len = 10
593 * |---------| 625 * |---------|
594 * 626 *
595 * New Record: 627 * New Record:
596 * 628 *
597 * cpos = 10, len = 20 629 * cpos = 10, len = 20
598 * |------------------| 630 * |------------------|
599 * 631 *
600 * The passed record is the new on-disk record. The new_clusters value 632 * The passed record is the new on-disk record. The new_clusters value
601 * is how many clusters were added to the file. If the append is a 633 * is how many clusters were added to the file. If the append is a
@@ -988,7 +1020,7 @@ int __init init_ocfs2_extent_maps(void)
988 return 0; 1020 return 0;
989} 1021}
990 1022
991void __exit exit_ocfs2_extent_maps(void) 1023void exit_ocfs2_extent_maps(void)
992{ 1024{
993 kmem_cache_destroy(ocfs2_em_ent_cachep); 1025 kmem_cache_destroy(ocfs2_em_ent_cachep);
994} 1026}