[Ocfs2-commits] mfasheh commits r1489 - branches/dlm-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Sep 24 18:38:52 CDT 2004


Author: mfasheh
Date: 2004-09-24 18:38:50 -0500 (Fri, 24 Sep 2004)
New Revision: 1489

Modified:
   branches/dlm-changes/src/file.c
   branches/dlm-changes/src/file.h
Log:
* pull the overallocation stuff into it's own function.

* land the disctontiguous allocation code now. 
  - split the *allocation* extender from the i_size changer. If you want
    both, call ocfs_extend_file with a target i_size and it'll handle all the
    details. All others should just call ocfs_extend_allocation to add more
    allocation and deal with the other stuff themselves.
  - ocfs_extend_file is called in far fewer places now as most others really 
    just wanted to extend allocation.
  - unfortunately, all the code including and below ocfs_allocate_extent
    still sucks. One day we'll fix that too.



Modified: branches/dlm-changes/src/file.c
===================================================================
--- branches/dlm-changes/src/file.c	2004-09-24 23:29:44 UTC (rev 1488)
+++ branches/dlm-changes/src/file.c	2004-09-24 23:38:50 UTC (rev 1489)
@@ -46,6 +46,7 @@
 #include "sysfile.h"
 #include "inode.h"
 #include "ioctl.h"
+#include "suballoc.h"
 #include "util.h"
 
 #include "ocfs_journal.h"
@@ -55,6 +56,10 @@
 
 static int ocfs2_zero_extend(struct inode *inode);
 
+static unsigned int ocfs_calc_overalloc_bits(ocfs_super *osb, 
+					     ocfs2_dinode *fe,
+					     u64 new_size);
+
 static void ocfs_fe_set_attributes(ocfs2_dinode *fe, struct iattr *attr)
 {
 	if (attr->ia_valid & ATTR_SIZE)
@@ -450,6 +455,7 @@
 		LOG_ERROR_STATUS(status);
 		goto leave;
 	}
+	ocfs_handle_set_always_commits(handle, 1);
 
 	fe = (ocfs2_dinode *) bh->b_data;
 
@@ -639,8 +645,7 @@
 		LOG_TRACE_ARGS
 		    ("Writing at EOF, will need more allocation: have=%llu, "
 		     "need=%llu\n", OCFS_I(inode)->ip_alloc_size, newsize);
-		status = ocfs_extend_file(osb, newsize,
-					  NULL, inode, NULL, 0, NULL);
+		status = ocfs_extend_file(osb, newsize, inode, NULL);
 		if (status < 0) {
 			if (status != -EINTR && status != -ENOSPC) {
 				LOG_ERROR_STATUS (status);
@@ -991,257 +996,340 @@
 	return res;
 }
 
-
-/* ocfs_extend_file()
- *
+/*
+ * extend allocation only here.
+ * we'll update all the disk stuff, and oip->alloc_size
+ * 
+ * expect stuff to be locked, a transaction started and enough data /
+ * metadata reservations in the contexts. I'll return -EAGAIN, if we
+ * run out of transaction credits, so the caller can restart us.
  */
-int ocfs_extend_file(ocfs_super *osb, __u64 file_size,
-		     ocfs_journal_handle *passed_handle,
-		     struct inode *inode, struct iattr *attr,
-		     int system_file, struct buffer_head *fe_bh)
+int ocfs_extend_allocation(ocfs_super *osb, 
+			   struct inode *inode, 
+			   u32 new_i_clusters, 
+			   struct buffer_head *fe_bh,
+			   ocfs_journal_handle *handle, 
+			   ocfs2_alloc_context *data_ac,
+			   ocfs2_alloc_context *meta_ac,
+			   enum ocfs2_alloc_restarted *reason)
 {
 	int status = 0;
-	ocfs2_dinode *fe;
-	__u64 tempOffset = 0;
-	__u64 current_alloc;
-	__u64 alloc_size;
-	u32 bitmapOffset = 0;
-	u32 numClustersAlloc = 0;
-	u64 block_off;
-	u64 num_blocks;
-	struct buffer_head *bh = NULL;
-	ocfs_journal_handle *handle = NULL;
-	int credits;
+	int credits_needed, free_extents, multi_pass;
+	ocfs2_dinode *fe = (ocfs2_dinode *) fe_bh->b_data;
+	unsigned int bits_wanted;
+	u32 bit_off, num_bits;
+	u64 block;
 
-	LOG_ENTRY_ARGS("(file_size=%llu, system=%s)\n",
-		       file_size, system_file?"yes":"no");
+	OCFS_ASSERT(new_i_clusters > fe->i_clusters);
 
-	if (!inode)
-		BUG();
-
-#ifdef PURE_EVIL
-	if (evil_filename_check(EVIL_INODE, inode)) {
-		LOG_ERROR_ARGS("EVIL EXTEND: file_size=%llu, oldsize=%llu\n",
-			       file_size, inode->i_size);
+	multi_pass = 0;
+again:
+	free_extents = ocfs_num_free_extents(osb, inode, fe);
+	if (free_extents < 0) {
+		status = free_extents;
+		LOG_ERROR_STATUS(status);
+		goto leave;
 	}
-#endif
 
-	if (file_size == 0)
+	/* there are two cases which could cause us to EAGAIN in the
+	 * we-need-more-metadata case: 
+	 * 1) we haven't reserved *any*
+	 * 2) we are so fragmented, we've needed to add metadata too 
+	 *    many times. */
+	if (!free_extents && !meta_ac) {
+		LOG_TRACE_STR("we haven't reserved any metadata!");
+		status = -EAGAIN;
+		if (reason)
+			*reason = RESTART_META;
 		goto leave;
+	} else if ((!free_extents)
+		   && (ocfs_alloc_context_bits_left(meta_ac)
+		       < ocfs2_extend_meta_needed(fe))) {
+		LOG_TRACE_STR("filesystem is really fragmented...");
+		status = -EAGAIN;
+		if (reason)
+			*reason = RESTART_META;
+		goto leave;
+	}
 
-	if (passed_handle == NULL) {
-		handle = ocfs_alloc_handle(osb);
-		if (handle == NULL) {
-			LOG_ERROR_STATUS(status = -ENOMEM);
-			goto leave;
-		}
+	bits_wanted = new_i_clusters - fe->i_clusters;
 
-		status = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE, 
-					    FLAG_FILE_EXTEND, &bh, inode);
-		if (status < 0) {
-			if (status != -EINTR)
-				LOG_ERROR_STATUS (status);
-			goto leave;
-		}
-		ocfs_handle_add_lock(handle, 
-				     OCFS_LKM_EXMODE,
-				     FLAG_FILE_EXTEND|FLAG_FILE_UPDATE_OIN,
-				     inode);
-		ocfs_handle_add_inode(handle, inode);
-	} else {
-		handle = passed_handle;
-		/* fe_bh is optional if you already have a transaction open. */
-		if (fe_bh)
-			bh = fe_bh;
-		else {
-			status = ocfs_read_bh(osb,
-					      OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
-					      &bh, OCFS_BH_CACHED, inode);
-			if (status < 0) {
-				LOG_ERROR_STATUS (status);
-				goto leave;
-			}
-		}
+	/* do we have enough credits for another single extend, of
+	 * what's left? */
+	/* fe + main bitmap fe + main bitmap bits */
+	if (!multi_pass)
+		credits_needed = 1 + 1 + 
+			ocfs_blocks_for_bits(osb->sb, bits_wanted);
+	else /* if we've already extended once, then we've already reserved. */
+		credits_needed = ocfs_blocks_for_bits(osb->sb, bits_wanted);
+	if (!free_extents) {
+		/* will need to extend the file: 
+		 * metadata suballoc fe + metadata suballoc bitmap 
+		 * + actual metadata blocks. */
+		credits_needed += 1 + 1 + ocfs2_extend_meta_needed(fe);
 	}
+	multi_pass = 1;
 
-	fe = (ocfs2_dinode *) bh->b_data;
-	OCFS_ASSERT(IS_VALID_FILE_ENTRY(fe));
+	if (credits_needed > (handle->max_buffs - handle->num_buffs)) {
+		LOG_TRACE_ARGS("Not enough credits for this extend: need %u, "
+			       "have %u\n", credits_needed, 
+			       (handle->max_buffs - handle->num_buffs));
+		status = -EAGAIN;
+		if (reason)
+			*reason = RESTART_TRANS;
+		goto leave;
+	}
 
-	current_alloc = (u64)fe->i_clusters << osb->s_clustersize_bits;
-	alloc_size = file_size - current_alloc;
-	LOG_TRACE_ARGS("current_alloc=%llu, alloc_size=%llu\n",
-		       current_alloc, alloc_size);
+	status = ocfs_claim_bits(osb, handle, data_ac, 1, &bit_off, &num_bits);
+	if (status < 0) {
+		LOG_ERROR_STATUS(free_extents);
+		goto leave;
+	}
 
-	if (passed_handle == NULL) {
-		credits = ocfs_calc_extend_credits(osb->sb, 
-						   (__u32) alloc_size); 
+	/* reserve our write early -- allocate_extent may update the inode */
+	status = ocfs_journal_access(handle, fe_bh, OCFS_JOURNAL_ACCESS_WRITE);
+	if (status < 0) {
+		LOG_ERROR_STATUS(status);
+		goto leave;
+	}
 
-		handle = ocfs_start_trans(osb, handle, credits);
-		if (handle == NULL) {
-			LOG_ERROR_STATUS(status = -ENOMEM);
-			goto leave;
-		}
+	block = ocfs_clusters_to_blocks(osb->sb, bit_off);
+	LOG_TRACE_ARGS("Allocating %u clusters at block %u for inode %llu\n",
+		       num_bits, bit_off, OCFS_I(inode)->ip_blkno);
+	status = ocfs_allocate_extent(osb, fe_bh, handle, block, num_bits, 
+				      inode, meta_ac);
+	if (status < 0) {
+		LOG_ERROR_STATUS(free_extents);
+		goto leave;
 	}
 
-	status = ocfs_journal_access(handle, bh, OCFS_JOURNAL_ACCESS_WRITE);
+	fe->i_clusters += num_bits;
+	down (&(OCFS_I(inode)->ip_sem));
+	OCFS_I(inode)->ip_alloc_size =
+		(u64)fe->i_clusters << osb->s_clustersize_bits;
+	up (&(OCFS_I(inode)->ip_sem));
+
+	status = ocfs_journal_dirty(handle, fe_bh);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
 		goto leave;
 	}
 
-	if (file_size <= (__s64)current_alloc)
-		goto no_alloc;
+	if (fe->i_clusters < new_i_clusters) {
+		LOG_TRACE_ARGS("need to alloc once more, clusters = %u, "
+			       "wanted = %u\n", 
+			       fe->i_clusters, new_i_clusters);
+		goto again;
+	}
 
-	alloc_size = file_size - current_alloc;
+leave:
+	LOG_EXIT_STATUS(status);
+	return(status);
+}
 
-	/* TODO: We can add something here so that after 2-3 allocations, 
-	 * we give a lot more disk space to the file than the alloc_size so 
-	 * in order to try to use the Extents of File Entry only and ofcourse 
-	 * the file will have more contigous disk space. */
+static unsigned int ocfs_calc_overalloc_bits(ocfs_super *osb, 
+					     ocfs2_dinode *fe,
+					     u64 new_size)
+{
+	u64 current_alloc = (u64)fe->i_clusters << osb->s_clustersize_bits;
+	int one_percentish_bits = 7;
+	u64 tmp_size, alloc_size = new_size - fe->i_size;
 
-	if (!system_file) {
-		int one_percentish_bits = 7;
-		__u64 tempSize = current_alloc;
+	tmp_size = (current_alloc > ONE_MEGA_BYTE) ? ONE_MEGA_BYTE 
+		: current_alloc;
 
-		if (tempSize > ONE_MEGA_BYTE)
-			tempSize = ONE_MEGA_BYTE;
-		alloc_size += (tempSize * 2);
+	alloc_size += (tmp_size * 2);
 
-		if (alloc_size <
-		    (current_alloc >> one_percentish_bits)) {
-			alloc_size = current_alloc >> one_percentish_bits;
-			tempSize = alloc_size;
-			// avoid using 64 bit mod
-			while (tempSize > (10*ONE_MEGA_BYTE))
-				tempSize -= (10*ONE_MEGA_BYTE);
-			tempSize = (10*ONE_MEGA_BYTE) - tempSize;
-			alloc_size += tempSize;
-		}
+	if (alloc_size <
+	    (current_alloc >> one_percentish_bits)) {
+		alloc_size = current_alloc >> one_percentish_bits;
+		tmp_size = alloc_size;
+		// avoid using 64 bit mod
+		while (tmp_size > (10*ONE_MEGA_BYTE))
+			tmp_size -= (10*ONE_MEGA_BYTE);
+		tmp_size = (10*ONE_MEGA_BYTE) - tmp_size;
+		alloc_size += tmp_size;
 	}
 
-	status = ocfs_find_space(osb, alloc_size, &bitmapOffset,
-				 &numClustersAlloc, system_file, handle);
-	LOG_TRACE_ARGS("find_space: alloc_size=%llu, returned off=%u"
-		       ", num=%u\n", alloc_size, bitmapOffset, 
-		       numClustersAlloc);
+	return(ocfs_clusters_for_bytes(osb->sb, alloc_size) - fe->i_clusters);
+}
+
+/* ocfs_extend_file()
+ *
+ * Ok, this function is heavy on the goto's - we need to clean it up a
+ * bit.
+ */
+int ocfs_extend_file(ocfs_super *osb, u64 new_i_size,
+		     struct inode *inode, struct iattr *attr)
+{
+	int status = 0;
+	int restart_func = 0;
+	int skip_overalloc = 0;
+	int credits, num_free_extents;
+	unsigned int overalloc_bits;
+	u32 new_i_clusters;
+	struct buffer_head *bh = NULL;
+	ocfs2_dinode *fe;
+	ocfs_journal_handle *handle = NULL;
+	ocfs2_alloc_context *data_ac = NULL;
+	ocfs2_alloc_context *meta_ac = NULL;
+	enum ocfs2_alloc_restarted why;
+
+	LOG_ENTRY_ARGS("(new_i_size=%llu)\n", new_i_size);
+
+	if (new_i_size == 0)
+		goto leave;
+
+restart_all:
+	handle = ocfs_alloc_handle(osb);
+	if (handle == NULL) {
+		LOG_ERROR_STATUS(status = -ENOMEM);
+		goto leave;
+	}
+
+	status = ocfs_acquire_lock(osb, OCFS_LKM_EXMODE, FLAG_FILE_EXTEND, 
+				    &bh, inode);
 	if (status < 0) {
-		if (status != -ENOSPC && status != -EINTR)
+		if (status != -EINTR)
 			LOG_ERROR_STATUS (status);
 		goto leave;
 	}
+	ocfs_handle_add_lock(handle, 
+			     OCFS_LKM_EXMODE,
+			     FLAG_FILE_EXTEND|FLAG_FILE_UPDATE_OIN,
+			     inode);
+	ocfs_handle_add_inode(handle, inode);
 
-	block_off = ocfs_clusters_to_blocks(osb->sb,
-					    bitmapOffset);
-	num_blocks = ocfs_clusters_to_blocks(osb->sb,
-					     numClustersAlloc);
+	fe = (ocfs2_dinode *) bh->b_data;
+	OCFS_ASSERT(IS_VALID_FILE_ENTRY(fe));
+	OCFS_ASSERT(new_i_size >= fe->i_size);
 
-#define	OCFS_MAX_ZERO_BLOCKS (4096)
+	new_i_clusters = ocfs_clusters_for_bytes(osb->sb, new_i_size);
 
-	if (system_file) {
-		struct buffer_head **bhs = NULL;
-		int i;
-		sector_t block;
-		u64 this_last;
+	if (new_i_size <= (fe->i_clusters << osb->s_clustersize_bits))
+		goto do_start_trans;
 
-//		printk("Extending system inode %llu (from %u, adding %u)\n", fe->i_blkno, fe->i_clusters, numClustersAlloc);
-		LOG_TRACE_ARGS("zeroing %llu blocks from offset %llu\n", 
-			       num_blocks, block_off);
-		bhs = kmalloc(OCFS_MAX_ZERO_BLOCKS * sizeof(struct buffer_head *),
-			      GFP_KERNEL);
-		if (!bhs) {
-			status = -ENOMEM;
-			LOG_ERROR_STATUS(status);
-			goto leave;
-		}
-		memset(bhs, 0, OCFS_MAX_ZERO_BLOCKS * 
-		       sizeof(struct buffer_head *));
+	if (!skip_overalloc) {
+		overalloc_bits = ocfs_calc_overalloc_bits(osb, fe, new_i_size);
+		new_i_clusters += overalloc_bits;
+		skip_overalloc = 1;
+	}
 
-		block = block_off;
-		while (block < (block_off + num_blocks)) {
-			this_last = block + OCFS_MAX_ZERO_BLOCKS;
-			if (this_last > (block_off + num_blocks))
-				this_last = block_off + num_blocks;
+	LOG_TRACE_ARGS("i_clusters=%u, wanted==%u\n",
+		       fe->i_clusters, new_i_clusters);
 
-			//LOG_TRACE_ARGS("block = %llu, this_last = %llu\n",
-			//	       (unsigned long long) block, this_last);
-			i = 0;
-			while (block < this_last) {
-				bhs[i] = sb_getblk(osb->sb, block);
-				if (!bhs[i]) {
-					status = -ENOMEM;
-					LOG_ERROR_STATUS(status);
-					break;
-				}
-				memset(bhs[i]->b_data, 0, 
-				       osb->sb->s_blocksize);
-				set_buffer_uptodate(bhs[i]);
-				i++;
-				block++;
-			}
-			if (status)
-				break;
-
-			//LOG_TRACE_ARGS("writing %d blocks\n", i);
-			status = ocfs_write_bhs(osb, bhs, i, inode);
-			if (status) {
-				LOG_ERROR_STATUS(status);
-				break;
-			}
-			for (i = 0; i < OCFS_MAX_ZERO_BLOCKS; i++)
-				if (bhs[i])
-				    brelse(bhs[i]);
-			memset(bhs, 0, OCFS_MAX_ZERO_BLOCKS * 
-			       sizeof(struct buffer_head *));
+	num_free_extents = ocfs_num_free_extents(osb, 
+						 inode, 
+						 fe);
+	if (num_free_extents < 0) {
+		status = num_free_extents;
+		LOG_ERROR_STATUS(status);
+		goto leave;
+	}
+	if (!num_free_extents) {
+		status = ocfs_reserve_new_metadata(osb, 
+						   handle, 
+						   inode, 
+						   fe, 
+						   &meta_ac);
+		if (status < 0) {
+			LOG_ERROR_STATUS (status);
+			goto leave;
 		}
+	}
 
-		for (i = 0; i < OCFS_MAX_ZERO_BLOCKS; i++)
-			if (bhs[i])
-				brelse(bhs[i]);
-		kfree(bhs);
+	status = ocfs_reserve_bits(osb, handle, new_i_clusters, &data_ac);
+	if (status < 0) {
+		LOG_ERROR_STATUS(status);
+		goto leave;
 	}
 
-//	ocfs_handle_add_inode(handle, ext_alloc_inode);
-	status = ocfs_allocate_extent(osb, bh, handle, block_off,
-				      numClustersAlloc, inode);
+do_start_trans:
+	credits = ocfs_calc_extend_credits(osb->sb, new_i_clusters);
+	handle = ocfs_start_trans(osb, handle, credits);
+	if (handle == NULL) {
+		LOG_ERROR_STATUS(status = -ENOMEM);
+		goto leave;
+	}
+
+restarted_transaction:
+	/* reserve a write to the file entry early on - that we if we
+	 * run out of credits in the allocation path, we can still
+	 * update i_size. */
+	status = ocfs_journal_access(handle, bh, OCFS_JOURNAL_ACCESS_WRITE);
 	if (status < 0) {
-		LOG_ERROR_STATUS (status);
+		LOG_ERROR_STATUS(status);
 		goto leave;
 	}
 
-	/* update the total allocation size here */
-	fe->i_clusters += numClustersAlloc;
+	if (new_i_size <= (fe->i_clusters << osb->s_clustersize_bits))
+		goto no_alloc;
 
-	down (&(OCFS_I(inode)->ip_sem));
-	OCFS_I(inode)->ip_alloc_size =
-		(u64)fe->i_clusters << osb->s_clustersize_bits;
-	up (&(OCFS_I(inode)->ip_sem));
+	status = ocfs_extend_allocation(osb, 
+					inode, 
+					new_i_clusters - fe->i_clusters,
+					bh,
+					handle,
+					data_ac,
+					meta_ac,
+					&why);
+	if ((status < 0) && (status != -EAGAIN)) {
+		LOG_ERROR_STATUS(status);
+		goto leave;
+	}
 
-	/* no need to do OCFS_SECTOR_ALIGN once the allocation size is
-	 * correct. */
+	if (status == -EAGAIN 
+	    && (new_i_size > 
+		(fe->i_clusters << osb->s_clustersize_bits))) {
+		new_i_clusters -= fe->i_clusters;
+
+		if (why == RESTART_META) {
+			restart_func = 1;
+		} else {
+			OCFS_ASSERT(why == RESTART_TRANS);
+
+			/* update i_size in case we crash after the
+			 * extend_trans */
+			fe->i_size = (u64) (fe->i_clusters << osb->s_clustersize_bits);
+			fe->i_mtime = OCFS_CURRENT_TIME;
+
+			status = ocfs_journal_dirty(handle, bh);
+			if (status < 0) {
+				LOG_ERROR_STATUS (status);
+				goto leave;
+			}
+
+			/* TODO: This can be more intelligent. */
+			credits = ocfs_calc_extend_credits(osb->sb, 
+							   new_i_clusters);
+			status = ocfs_extend_trans(handle, credits);
+			if (status < 0) {
+				/* handle still has to be committed /
+				 * aborted at this point. */
+				LOG_ERROR_STATUS(status = -ENOMEM);
+				goto leave;
+			}
+			goto restarted_transaction;
+		}
+	}
+	status = 0;
+
 no_alloc:
-	/* Update tha file size and add the new one to old one. */
-	fe->i_size = file_size;
+	/* Update the file size and add the new one to old one. */
+	fe->i_size = new_i_size;
+#warning "is there a reason why we don't update i_blocks here?"
 	LOG_TRACE_ARGS("fe: i_clusters = %u, i_size=%llu\n", 
 		       fe->i_clusters, fe->i_size);
 
-	/* NOTE: this is a bit of a hack; unlike regular files, 
-	 * system files do not have another opportunity to update
-	 * the inode/i_private fields */
-	if (system_file) {
-		OCFS_I(inode)->ip_alloc_size = (u64)fe->i_clusters << osb->s_clustersize_bits;
-		inode->i_size = fe->i_size;
-		inode->i_blocks = (inode->i_size + osb->sb->s_blocksize - 1) >> osb->sb->s_blocksize_bits;
-	}
 	LOG_TRACE_ARGS("inode: ip_alloc_size=%llu, i_size=%llu\n",
 		       OCFS_I(inode)->ip_alloc_size, inode->i_size);
 
-	if (attr)
+	if (attr) {
 		ocfs_fe_set_attributes(fe, attr);
-
+		attr = NULL;
+	}
 	fe->i_mtime = OCFS_CURRENT_TIME;
 
-	tempOffset = fe->i_blkno << osb->sb->s_blocksize_bits;
-
 	status = ocfs_journal_dirty(handle, bh);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
@@ -1249,19 +1337,29 @@
 	}
 
 leave:
-	if ((passed_handle == NULL) && handle) {
+	if (handle) {
 		if (status < 0)
 			ocfs_abort_trans(handle);
 		else 
 			ocfs_commit_trans(handle);
+		handle = NULL;
 	}
-
-	if (bh != NULL)
-		LOG_TRACE_ARGS("bh->b_count = %d\n", 
-			       atomic_read(&(bh->b_count)));
-	if (bh != NULL && fe_bh == NULL)
+	if (data_ac) {
+		ocfs_free_alloc_context(data_ac);
+		data_ac = NULL;
+	}
+	if (meta_ac) {
+		ocfs_free_alloc_context(meta_ac);
+		meta_ac = NULL;
+	}
+	if (bh) {
 		brelse(bh);
-
+		bh = NULL;
+	}
+	if ((!status) && restart_func) {
+		restart_func = 0;
+		goto restart_all;
+	}
 	LOG_EXIT_STATUS (status);
 	return status;
 }				/* ocfs_extend_file */
@@ -1343,8 +1441,7 @@
 						    inode);
 		}
 		else {
-			status = ocfs_extend_file(osb, newsize, NULL, 
-						  inode, attr, 0, NULL);
+			status = ocfs_extend_file(osb, newsize, inode, attr);
 			extended = 1;
 		}
 		if (status < 0) {

Modified: branches/dlm-changes/src/file.h
===================================================================
--- branches/dlm-changes/src/file.h	2004-09-24 23:29:44 UTC (rev 1488)
+++ branches/dlm-changes/src/file.h	2004-09-24 23:38:50 UTC (rev 1489)
@@ -33,10 +33,22 @@
 extern struct file_operations ocfs_dops;
 extern struct inode_operations ocfs_file_iops;
 
-int ocfs_extend_file(ocfs_super * osb, __u64 file_size,
-		     ocfs_journal_handle *passed_handle, 
-		     struct inode *inode, struct iattr *attr, 
-		     int system_file, struct buffer_head *fe_bh);
+enum ocfs2_alloc_restarted {
+	RESTART_TRANS = 0,
+	RESTART_META
+};
+int ocfs_extend_allocation(ocfs_super *osb, 
+			   struct inode *inode, 
+			   u32 new_i_clusters, 
+			   struct buffer_head *fe_bh,
+			   ocfs_journal_handle *handle, 
+			   ocfs2_alloc_context *data_ac,
+			   ocfs2_alloc_context *meta_ac,
+			   enum ocfs2_alloc_restarted *reason);
+int ocfs_extend_file(ocfs_super *osb, 
+		     u64 new_i_size,
+		     struct inode *inode, 
+		     struct iattr *attr);
 int ocfs_inode_fill_ext_map(ocfs_super *osb, struct buffer_head *fe_bh,
 			    struct inode *inode);
 int ocfs_setattr(struct dentry *dentry, struct iattr *attr);



More information about the Ocfs2-commits mailing list