[Ocfs2-commits] jlbec commits r2779 - branches/ocfs2-1.2/fs/ocfs2

svn-commits@oss.oracle.com svn-commits at oss.oracle.com
Wed Mar 1 15:55:40 CST 2006


Author: jlbec
Signed-off-by: mfasheh
Date: 2006-03-01 15:55:39 -0600 (Wed, 01 Mar 2006)
New Revision: 2779

Modified:
   branches/ocfs2-1.2/fs/ocfs2/extent_map.c
Log:

o Backport revision 2681 from trunk.

Signed-off-by: mfasheh

e-This line, and those below, will be ignored--

M    fs/ocfs2/extent_map.c


Modified: branches/ocfs2-1.2/fs/ocfs2/extent_map.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/extent_map.c	2006-03-01 00:14:44 UTC (rev 2778)
+++ branches/ocfs2-1.2/fs/ocfs2/extent_map.c	2006-03-01 21:55:39 UTC (rev 2779)
@@ -176,21 +176,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;
 			}
 
@@ -204,8 +210,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
@@ -213,8 +221,10 @@
 			 * EEEK!
 			 */
 			ret = -EBADR;
-			if (blkno)
+			if (blkno) {
+				mlog_errno(ret);
 				goto out_free;
+			}
 
 			blkno = le64_to_cpu(rec->e_blkno);
 		}
@@ -224,8 +234,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);
@@ -234,8 +246,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 = (struct ocfs2_extent_block *)eb_bh->b_data;
 		if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) {
 			OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb);
@@ -252,8 +266,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;
@@ -298,6 +314,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;
@@ -316,6 +333,7 @@
 				       OCFS2_I(inode)->ip_blkno, &bh,
 				       OCFS2_BH_CACHED, inode);
 		if (ret) {
+			mlog_errno(ret);
 			if (bh)
 				brelse(bh);
 			return ret;
@@ -331,12 +349,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 */
@@ -489,14 +512,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;
@@ -505,8 +534,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;
@@ -532,6 +563,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)
@@ -630,7 +664,8 @@
 
 	if (ret == -ENOENT)
 		ret = ocfs2_extent_map_insert(inode, rec, 0);
-
+	if (ret < 0)
+		mlog_errno(ret);
 	return ret;
 }
 
@@ -754,8 +789,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) {
 		/*
@@ -768,16 +806,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