[Ocfs2-tools-commits] jlbec commits r421 - trunk/libocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Nov 18 21:46:23 CST 2004


Author: jlbec
Date: 2004-11-18 21:46:21 -0600 (Thu, 18 Nov 2004)
New Revision: 421

Modified:
   trunk/libocfs2/extend_file.c
Log:
fix a couple bugs

Modified: trunk/libocfs2/extend_file.c
===================================================================
--- trunk/libocfs2/extend_file.c	2004-11-19 03:22:50 UTC (rev 420)
+++ trunk/libocfs2/extend_file.c	2004-11-19 03:46:21 UTC (rev 421)
@@ -50,6 +50,9 @@
 	char *buf;
 	ocfs2_extent_block *last_eb;
 
+	if (!ctxt->di->i_last_eb_blk)
+		return OCFS2_ET_INTERNAL_FAILURE;
+
 	ret = ocfs2_malloc_block(ctxt->fs->fs_io, &buf);
 	if (ret)
 		return ret;
@@ -166,7 +169,8 @@
 		if (ret != OCFS2_ET_NO_SPACE)
 			return ret;
 		
-		if (el->l_next_free_rec == el->l_count)
+		if ((el->l_next_free_rec == el->l_count) &&
+		    (el->l_recs[el->l_next_free_rec - 1].e_blkno))
 			return OCFS2_ET_NO_SPACE;
 
 		ret = append_eb(ctxt, el);
@@ -280,8 +284,10 @@
 			ret = insert_extent_el(&ctxt,
 					       &ctxt.di->id2.i_list);
 	}
-	if (!ret)
+	if (!ret) {
+		ctxt.di->i_clusters += clusters;
 		ret = ocfs2_write_inode(fs, ino, buf);
+	}
 
 out_free_buf:
 	ocfs2_free(&buf);
@@ -295,13 +301,11 @@
 	/*
 	 * This should be, in essence:
 	 *
-	 * read_inode();
 	 * while (new_clusters) {
 	 * 	n_clusters = ocfs2_new_clusters();
 	 * 	ocfs2_insert_extent(n_clusters);
 	 * 	new_clusters -= n_clusters;
-	 * 	}
-	 * write_inode();
+	 * }
 	 */
 
 	return 0;



More information about the Ocfs2-tools-commits mailing list