-Index: linux-2.4.24-mb34/fs/ext3/extents.c
+Index: linux-2.4.24/fs/ext3/extents.c
===================================================================
---- linux-2.4.24-mb34.orig/fs/ext3/extents.c 1969-12-31 16:00:00.000000000 -0800
-+++ linux-2.4.24-mb34/fs/ext3/extents.c 2004-05-05 14:27:07.000000000 -0700
-@@ -0,0 +1,2346 @@
+--- linux-2.4.24.orig/fs/ext3/extents.c 2004-05-18 12:34:48.000000000 -0700
++++ linux-2.4.24/fs/ext3/extents.c 2004-05-18 12:43:40.000000000 -0700
+@@ -0,0 +1,2354 @@
+/*
+ * Copyright (C) 2003 Alex Tomas <alex@clusterfs.com>
+ *
+ eh->e_magic = EXT3_EXT_MAGIC;
+ eh->e_max = ext3_ext_space_root(tree);
+ ext3_ext_mark_root_dirty(handle, tree);
++ ext3_ext_invalidate_cache(tree);
+ return 0;
+}
+
+
+ if (err) {
+ /* free all allocated blocks in error case */
-+ for (i = 0; i < depth; i++)
++ for (i = 0; i < depth; i++) {
+ if (!ablocks[i])
+ continue;
+ ext3_free_blocks(handle, tree->inode, ablocks[i], 1);
++ }
+ }
+ kfree(ablocks);
+
+ kfree(npath);
+ }
+ ext3_ext_tree_changed(tree);
++ ext3_ext_invalidate_cache(tree);
+ return err;
+}
+
+ err = ext3_ext_get_access(handle, tree, path);
+ if (err == 0) {
+ EXT_ROOT_HDR(tree)->e_depth = 0;
++ EXT_ROOT_HDR(tree)->e_max = ext3_ext_space_root(tree);
+ err = ext3_ext_dirty(handle, tree, path);
+ }
+ }
+ int needed;
+
+ /* at present, extent can't cross block group */;
-+ needed = 3; /* bitmap + group desc + sb */
++ needed = 4; /* bitmap + group desc + sb + inode */
+
+#ifdef CONFIG_QUOTA
+ needed += 2 * EXT3_SINGLEDATA_TRANS_BLOCKS;
+
+ /* check in cache */
+ if (ext3_ext_in_cache(&tree, iblock, &newex)) {
-+ if (newex.e_start == 0xffffffff && !create) {
-+ /* block isn't allocated yet and
-+ * user don't want to allocate it */
-+ goto out2;
++ if (newex.e_start == 0xffffffff) {
++ /* this is cached gap */
++ if (!create) {
++ /* block isn't allocated yet and
++ * user don't want to allocate it */
++ goto out2;
++ }
++ /* we should allocate requested block */
+ } else if (newex.e_start) {
+ /* block is already allocated */
+ newblock = iblock - newex.e_block + newex.e_start;
+EXPORT_SYMBOL(ext3_ext_find_goal);
+EXPORT_SYMBOL(ext3_ext_calc_credits_for_insert);
+
-Index: linux-2.4.24-mb34/fs/ext3/ialloc.c
+Index: linux-2.4.24/fs/ext3/ialloc.c
===================================================================
---- linux-2.4.24-mb34.orig/fs/ext3/ialloc.c 2004-05-05 13:47:40.000000000 -0700
-+++ linux-2.4.24-mb34/fs/ext3/ialloc.c 2004-05-05 13:51:27.000000000 -0700
+--- linux-2.4.24.orig/fs/ext3/ialloc.c 2004-05-18 12:33:55.000000000 -0700
++++ linux-2.4.24/fs/ext3/ialloc.c 2004-05-18 12:34:48.000000000 -0700
@@ -592,10 +592,14 @@
iloc.bh = NULL;
goto fail;
unlock_super (sb);
if(DQUOT_ALLOC_INODE(inode)) {
-Index: linux-2.4.24-mb34/fs/ext3/inode.c
+Index: linux-2.4.24/fs/ext3/inode.c
===================================================================
---- linux-2.4.24-mb34.orig/fs/ext3/inode.c 2004-05-05 13:47:41.000000000 -0700
-+++ linux-2.4.24-mb34/fs/ext3/inode.c 2004-05-05 13:49:40.000000000 -0700
+--- linux-2.4.24.orig/fs/ext3/inode.c 2004-05-18 12:33:56.000000000 -0700
++++ linux-2.4.24/fs/ext3/inode.c 2004-05-18 12:34:48.000000000 -0700
@@ -848,6 +848,15 @@
goto reread;
}
if (rc) {
printk(KERN_INFO "ext3_map_inode_page: error %d "
"allocating block %ld\n", rc, iblock);
-Index: linux-2.4.24-mb34/fs/ext3/Makefile
+Index: linux-2.4.24/fs/ext3/Makefile
===================================================================
---- linux-2.4.24-mb34.orig/fs/ext3/Makefile 2004-05-05 13:47:40.000000000 -0700
-+++ linux-2.4.24-mb34/fs/ext3/Makefile 2004-05-05 13:49:40.000000000 -0700
+--- linux-2.4.24.orig/fs/ext3/Makefile 2004-05-18 12:33:55.000000000 -0700
++++ linux-2.4.24/fs/ext3/Makefile 2004-05-18 12:43:00.000000000 -0700
@@ -13,7 +13,9 @@
obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
obj-m := $(O_TARGET)
export-objs += xattr.o
-Index: linux-2.4.24-mb34/fs/ext3/super.c
+Index: linux-2.4.24/fs/ext3/super.c
===================================================================
---- linux-2.4.24-mb34.orig/fs/ext3/super.c 2004-05-05 13:47:40.000000000 -0700
-+++ linux-2.4.24-mb34/fs/ext3/super.c 2004-05-05 13:49:40.000000000 -0700
+--- linux-2.4.24.orig/fs/ext3/super.c 2004-05-18 12:33:55.000000000 -0700
++++ linux-2.4.24/fs/ext3/super.c 2004-05-18 12:34:48.000000000 -0700
@@ -530,6 +530,7 @@
int i;
return sb;
failed_mount3:
-Index: linux-2.4.24-mb34/fs/ext3/ioctl.c
+Index: linux-2.4.24/fs/ext3/ioctl.c
===================================================================
---- linux-2.4.24-mb34.orig/fs/ext3/ioctl.c 2004-05-05 13:47:38.000000000 -0700
-+++ linux-2.4.24-mb34/fs/ext3/ioctl.c 2004-05-05 13:49:40.000000000 -0700
+--- linux-2.4.24.orig/fs/ext3/ioctl.c 2004-05-18 12:33:53.000000000 -0700
++++ linux-2.4.24/fs/ext3/ioctl.c 2004-05-18 12:34:48.000000000 -0700
@@ -174,6 +174,10 @@
return ret;
}
default:
return -ENOTTY;
}
-Index: linux-2.4.24-mb34/include/linux/ext3_fs.h
+Index: linux-2.4.24/include/linux/ext3_fs.h
===================================================================
---- linux-2.4.24-mb34.orig/include/linux/ext3_fs.h 2004-05-05 13:47:40.000000000 -0700
-+++ linux-2.4.24-mb34/include/linux/ext3_fs.h 2004-05-05 13:49:40.000000000 -0700
+--- linux-2.4.24.orig/include/linux/ext3_fs.h 2004-05-18 12:33:55.000000000 -0700
++++ linux-2.4.24/include/linux/ext3_fs.h 2004-05-18 12:43:00.000000000 -0700
@@ -184,6 +184,7 @@
#define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */
#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
#endif /* __KERNEL__ */
-Index: linux-2.4.24-mb34/include/linux/ext3_extents.h
+Index: linux-2.4.24/include/linux/ext3_extents.h
===================================================================
---- linux-2.4.24-mb34.orig/include/linux/ext3_extents.h 1969-12-31 16:00:00.000000000 -0800
-+++ linux-2.4.24-mb34/include/linux/ext3_extents.h 2004-05-05 14:27:50.000000000 -0700
+--- linux-2.4.24.orig/include/linux/ext3_extents.h 2004-05-18 12:34:48.000000000 -0700
++++ linux-2.4.24/include/linux/ext3_extents.h 2004-05-18 12:34:48.000000000 -0700
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2003 Alex Tomas <alex@clusterfs.com>
+void ext3_ext_invalidate_cache(struct ext3_extents_tree *tree);
+
+#endif /* _LINUX_EXT3_EXTENTS */
-Index: linux-2.4.24-mb34/include/linux/ext3_fs_i.h
+Index: linux-2.4.24/include/linux/ext3_fs_i.h
===================================================================
---- linux-2.4.24-mb34.orig/include/linux/ext3_fs_i.h 2004-05-05 13:47:40.000000000 -0700
-+++ linux-2.4.24-mb34/include/linux/ext3_fs_i.h 2004-05-05 13:53:43.000000000 -0700
+--- linux-2.4.24.orig/include/linux/ext3_fs_i.h 2004-05-18 12:33:55.000000000 -0700
++++ linux-2.4.24/include/linux/ext3_fs_i.h 2004-05-18 12:34:48.000000000 -0700
@@ -76,6 +76,8 @@
* by other means, so we have truncate_sem.
*/