[Ocfs2-commits] mfasheh commits r2681 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Nov 8 15:28:57 CST 2005


Author: mfasheh
Signed-off-by: jlbec
Date: 2005-11-08 15:28:56 -0600 (Tue, 08 Nov 2005)
New Revision: 2681

Modified:
   trunk/fs/ocfs2/extent_map.c
Log:
* add error tracing in extent_map.c

Signed-off-by: jlbec



Modified: trunk/fs/ocfs2/extent_map.c
===================================================================
--- trunk/fs/ocfs2/extent_map.c	2005-11-08 20:55:17 UTC (rev 2680)
+++ trunk/fs/ocfs2/extent_map.c	2005-11-08 21:28:56 UTC (rev 2681)
@@ -178,21 +178,27 @@
 				   le32_to_cpu(rec->e_clusters));
 
 			ret = -EBADR;
-			if (rec_end > OCFS2_I(inode)->ip_clusters)
+			if (rec_end > OCFS2_I(inode)->ip_clusters) {
+				mlog_errno(ret);
 				goto out_free;
+			}
 
 			if (rec_end <= cpos) {
 				ret = ocfs2_extent_map_insert(inode, rec,
 						le16_to_cpu(el->l_tree_depth));
-				if (ret && (ret != -EEXIST))
+				if (ret && (ret != -EEXIST)) {
+					mlog_errno(ret);
 					goto out_free;
+				}
 				continue;
 			}
 			if ((cpos + clusters) <= le32_to_cpu(rec->e_cpos)) {
 				ret = ocfs2_extent_map_insert(inode, rec,
 						le16_to_cpu(el->l_tree_depth));
-				if (ret && (ret != -EEXIST))
+				if (ret && (ret != -EEXIST)) {
+					mlog_errno(ret);
 					goto out_free;
+				}
 				continue;
 			}
 
@@ -206,8 +212,10 @@
 			ret = -ESRCH;
 			if (!ocfs2_extent_rec_contains_clusters(rec,
 							        cpos,
-								clusters))
+								clusters)) {
+				mlog_errno(ret);
 				goto out_free;
+			}
 
 			/*
 			 * If we've already found a record, the el has
@@ -215,8 +223,10 @@
 			 * EEEK!
 			 */
 			ret = -EBADR;
-			if (blkno)
+			if (blkno) {
+				mlog_errno(ret);
 				goto out_free;
+			}
 
 			blkno = le64_to_cpu(rec->e_blkno);
 		}
@@ -226,8 +236,10 @@
 		 * in the branches, so we'd better have found someone
 		 */
 		ret = -EBADR;
-		if (!blkno)
+		if (!blkno) {
+			mlog_errno(ret);
 			goto out_free;
+		}
 
 		if (eb_bh) {
 			brelse(eb_bh);
@@ -236,8 +248,10 @@
 		ret = ocfs2_read_block(OCFS2_SB(inode->i_sb),
 				       blkno, &eb_bh, OCFS2_BH_CACHED,
 				       inode);
-		if (ret)
+		if (ret) {
+			mlog_errno(ret);
 			goto out_free;
+		}
 		eb = (ocfs2_extent_block *)eb_bh->b_data;
 		if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) {
 			OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb);
@@ -254,8 +268,10 @@
 		rec = &el->l_recs[i];
 		ret = ocfs2_extent_map_insert(inode, rec,
 					      le16_to_cpu(el->l_tree_depth));
-		if (ret)
+		if (ret) {
+			mlog_errno(ret);
 			goto out_free;
+		}
 	}
 
 	ret = 0;
@@ -300,6 +316,7 @@
 		ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), blkno, &bh,
 				       OCFS2_BH_CACHED, inode);
 		if (ret) {
+			mlog_errno(ret);
 			if (bh)
 				brelse(bh);
 			return ret;
@@ -318,6 +335,7 @@
 				       OCFS2_I(inode)->ip_blkno, &bh,
 				       OCFS2_BH_CACHED, inode);
 		if (ret) {
+			mlog_errno(ret);
 			if (bh)
 				brelse(bh);
 			return ret;
@@ -333,12 +351,17 @@
 
 	ret = ocfs2_extent_map_find_leaf(inode, cpos, clusters, el);
 	brelse(bh);
-	if (ret)
+	if (ret) {
+		mlog_errno(ret);
 		return ret;
+	}
 
 	ent = ocfs2_extent_map_lookup(em, cpos, clusters, NULL, NULL);
-	if (!ent)
-		return -ESRCH;
+	if (!ent) {
+		ret = -ESRCH;
+		mlog_errno(ret);
+		return ret;
+	}
 
 	if (ent->e_tree_depth)
 		BUG();  /* FIXME: Make sure this isn't a corruption */
@@ -491,14 +514,20 @@
 	struct ocfs2_em_insert_context ctxt = {0, };
 
 	if ((le32_to_cpu(rec->e_cpos) + le32_to_cpu(rec->e_clusters)) >
-	    OCFS2_I(inode)->ip_map.em_clusters)
-		return -EBADR;
+	    OCFS2_I(inode)->ip_map.em_clusters) {
+		ret = -EBADR;
+		mlog_errno(ret);
+		return ret;
+	}
 
 	/* Zero e_clusters means a truncated tail record.  It better be EOF */
 	if (!rec->e_clusters) {
 		if ((le32_to_cpu(rec->e_cpos) + le32_to_cpu(rec->e_clusters)) !=
-		    OCFS2_I(inode)->ip_map.em_clusters)
-			return -EBADR;
+		    OCFS2_I(inode)->ip_map.em_clusters) {
+			ret = -EBADR;
+			mlog_errno(ret);
+			return ret;
+		}
 
 		/* Ignore the truncated tail */
 		return 0;
@@ -507,8 +536,10 @@
 	ret = -ENOMEM;
 	ctxt.new_ent = kmem_cache_alloc(ocfs2_em_ent_cachep,
 					GFP_KERNEL);
-	if (!ctxt.new_ent)
+	if (!ctxt.new_ent) {
+		mlog_errno(ret);
 		return ret;
+	}
 
 	ctxt.new_ent->e_rec = *rec;
 	ctxt.new_ent->e_tree_depth = tree_depth;
@@ -534,6 +565,9 @@
 						  tree_depth, &ctxt);
 	} while (ret == -EAGAIN);
 
+	if (ret < 0)
+		mlog_errno(ret);
+
 	if (ctxt.left_ent)
 		kmem_cache_free(ocfs2_em_ent_cachep, ctxt.left_ent);
 	if (ctxt.right_ent)
@@ -631,7 +665,8 @@
 
 	if (ret == -ENOENT)
 		ret = ocfs2_extent_map_insert(inode, rec, 0);
-
+	if (ret < 0)
+		mlog_errno(ret);
 	return ret;
 }
 
@@ -761,8 +796,11 @@
 	cpos = ocfs2_blocks_to_clusters(inode->i_sb, v_blkno);
 	clusters = ocfs2_blocks_to_clusters(inode->i_sb,
 					    (u64)count + bpc - 1);
-	if ((cpos + clusters) > OCFS2_I(inode)->ip_clusters)
-		return -EINVAL;
+	if ((cpos + clusters) > OCFS2_I(inode)->ip_clusters) {
+		ret = -EINVAL;
+		mlog_errno(ret);
+		return ret;
+	}
 
 	if ((cpos + clusters) > em->em_clusters) {
 		/*
@@ -775,16 +813,21 @@
 	}
 
 	ret = ocfs2_extent_map_lookup_read(inode, cpos, clusters, &ent);
-	if (ret)
+	if (ret) {
+		mlog_errno(ret);
 		return ret;
+	}
 
 	if (ent)
 	{
 		rec = &ent->e_rec;
 
 		/* We should never find ourselves straddling an interval */
-		if (!ocfs2_extent_rec_contains_clusters(rec, cpos, clusters))
-			return -ESRCH;
+		if (!ocfs2_extent_rec_contains_clusters(rec, cpos, clusters)) {
+			ret = -ESRCH;
+			mlog_errno(ret);
+			return ret;
+		}
 
 		boff = ocfs2_clusters_to_blocks(inode->i_sb, cpos -
 						le32_to_cpu(rec->e_cpos));



More information about the Ocfs2-commits mailing list