Index: iam/fs/ext3/Makefile
===================================================================
---- iam.orig/fs/ext3/Makefile 2006-09-28 22:11:14.000000000 +0400
-+++ iam/fs/ext3/Makefile 2006-10-03 22:00:23.000000000 +0400
+--- iam.orig/fs/ext3/Makefile 2006-10-04 15:05:21.000000000 +0400
++++ iam/fs/ext3/Makefile 2006-10-04 15:07:04.000000000 +0400
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
Index: iam/fs/ext3/iam.c
===================================================================
--- iam.orig/fs/ext3/iam.c 2004-04-06 17:27:52.000000000 +0400
-+++ iam/fs/ext3/iam.c 2006-10-03 21:15:25.000000000 +0400
++++ iam/fs/ext3/iam.c 2006-10-04 15:05:22.000000000 +0400
@@ -0,0 +1,1337 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
Index: iam/fs/ext3/iam_htree.c
===================================================================
--- iam.orig/fs/ext3/iam_htree.c 2004-04-06 17:27:52.000000000 +0400
-+++ iam/fs/ext3/iam_htree.c 2006-10-03 21:14:41.000000000 +0400
++++ iam/fs/ext3/iam_htree.c 2006-10-04 15:05:22.000000000 +0400
@@ -0,0 +1,668 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
Index: iam/fs/ext3/iam_lfix.c
===================================================================
--- iam.orig/fs/ext3/iam_lfix.c 2004-04-06 17:27:52.000000000 +0400
-+++ iam/fs/ext3/iam_lfix.c 2006-10-03 21:14:08.000000000 +0400
++++ iam/fs/ext3/iam_lfix.c 2006-10-04 15:05:22.000000000 +0400
@@ -0,0 +1,675 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
Index: iam/fs/ext3/iam_lvar.c
===================================================================
--- iam.orig/fs/ext3/iam_lvar.c 2004-04-06 17:27:52.000000000 +0400
-+++ iam/fs/ext3/iam_lvar.c 2006-10-03 21:14:26.000000000 +0400
++++ iam/fs/ext3/iam_lvar.c 2006-10-04 15:05:22.000000000 +0400
@@ -0,0 +1,902 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+
Index: iam/fs/ext3/namei.c
===================================================================
---- iam.orig/fs/ext3/namei.c 2006-09-28 22:11:15.000000000 +0400
-+++ iam/fs/ext3/namei.c 2006-10-03 22:00:07.000000000 +0400
+--- iam.orig/fs/ext3/namei.c 2006-10-04 15:05:22.000000000 +0400
++++ iam/fs/ext3/namei.c 2006-10-04 15:06:20.000000000 +0400
@@ -24,81 +24,6 @@
* Theodore Ts'o, 2002
*/
}
-static inline unsigned dx_root_limit(struct iam_path *p)
--{
++int dx_index_is_compat(struct iam_path *path)
+ {
- struct iam_descr *param = path_descr(p);
- unsigned entry_space = path_obj(p)->i_sb->s_blocksize -
- param->id_root_gap;
- return entry_space / (param->id_key_size + param->id_ptr_size);
--}
--
++ return iam_path_descr(path) == &iam_htree_compat_param;
+ }
+
-static inline unsigned dx_node_limit(struct iam_path *p)
-{
- struct iam_descr *param = path_descr(p);
-}
-
-static inline int dx_index_is_compat(struct iam_path *path)
-+int dx_index_is_compat(struct iam_path *path)
- {
+-{
- return path_descr(path) == &htree_compat_param;
-+ return iam_path_descr(path) == &iam_htree_compat_param;
- }
-
+-}
+-
-static struct iam_entry *dx_get_entries(struct iam_path *path, void *data,
- int root)
-{
}
/*
-@@ -800,598 +232,116 @@ struct stats dx_show_entries(struct dx_h
- }
- #endif /* DX_DEBUG */
-
+@@ -797,601 +229,119 @@ struct stats dx_show_entries(struct dx_h
+ printk("%snames %u, fullness %u (%u%%)\n", levels?"":" ",
+ names, space/bcount,(space/bcount)*100/blocksize);
+ return (struct stats) { names, space, bcount};
+-}
+-#endif /* DX_DEBUG */
+-
-static int dx_lookup(struct iam_path *path)
-{
- u32 ptr;
-}
-
-static int split_leaf_node(handle_t *handle, struct iam_path *path)
-+int dx_lookup(struct iam_path *path)
- {
+-{
- struct inode *dir = path_obj(path);
- unsigned continued = 0;
- struct buffer_head *bh2;
- */
-int iam_insert(handle_t *handle, struct iam_container *c, struct iam_key *k,
- struct iam_rec *r)
--{
++}
++#endif /* DX_DEBUG */
++
++int dx_lookup(struct iam_path *path)
+ {
- struct dx_hash_info hinfo;
- struct iam_path_compat cpath;
- struct iam_path *path = &cpath.ipc_path;
err = ext3_journal_dirty_metadata (handle, bh2);
if (err)
goto journal_error;
-@@ -2175,6 +1172,67 @@ errout:
+@@ -2175,6 +1172,63 @@ errout:
}
#endif
+ offset = 0;
+ while ((char *) de <= top) {
+ if (!ext3_check_dir_entry("ext3_add_entry",
-+ dir, de, bh, offset)) {
-+ brelse(bh);
++ dir, de, bh, offset))
+ return ERR_PTR(-EIO);
-+ }
-+ if (ext3_match(namelen, name, de)) {
-+ brelse(bh);
++ if (ext3_match(namelen, name, de))
+ return ERR_PTR(-EEXIST);
-+ }
+ nlen = EXT3_DIR_REC_LEN(de->name_len);
+ rlen = le16_to_cpu(de->rec_len);
+ if ((de->inode? rlen - nlen: rlen) >= reclen)
/*
* Add a new entry into a directory (leaf) block. If de is non-NULL,
-@@ -2194,34 +1252,16 @@ static int add_dirent_to_buf(handle_t *h
+@@ -2194,34 +1248,16 @@ static int add_dirent_to_buf(handle_t *h
struct inode *dir = dentry->d_parent->d_inode;
const char *name = dentry->d_name.name;
int namelen = dentry->d_name.len;
}
BUFFER_TRACE(bh, "get_write_access");
err = ext3_journal_get_write_access(handle, bh);
-@@ -2232,22 +1272,9 @@ static int add_dirent_to_buf(handle_t *h
+@@ -2232,22 +1268,9 @@ static int add_dirent_to_buf(handle_t *h
}
/* By now the buffer is marked for journaling */
/*
* XXX shouldn't update any times until successful
* completion of syscall, but too many callers depend
-@@ -2423,19 +1450,58 @@ static int ext3_add_entry (handle_t *han
+@@ -2423,19 +1446,58 @@ static int ext3_add_entry (handle_t *han
return add_dirent_to_buf(handle, dentry, inode, de, bh);
}
frame = path->ip_frame;
entries = frame->entries;
-@@ -2474,7 +1540,8 @@ static int split_index_node(handle_t *ha
+@@ -2474,7 +1536,8 @@ static int split_index_node(handle_t *ha
for (frame = safe + 1, i = 0; i < nr_splet; ++i, ++frame) {
bh_new[i] = ext3_append (handle, dir, &newblock[i], &err);
if (!bh_new[i] ||
goto cleanup;
BUFFER_TRACE(frame->bh, "get_write_access");
err = ext3_journal_get_write_access(handle, frame->bh);
-@@ -2493,6 +1560,7 @@ static int split_index_node(handle_t *ha
+@@ -2493,6 +1556,7 @@ static int split_index_node(handle_t *ha
unsigned count;
int idx;
struct buffer_head *bh2;
entries = frame->entries;
count = dx_get_count(entries);
-@@ -2501,6 +1569,7 @@ static int split_index_node(handle_t *ha
+@@ -2501,6 +1565,7 @@ static int split_index_node(handle_t *ha
bh2 = bh_new[i];
entries2 = dx_get_entries(path, bh2->b_data, 0);
if (frame == path->ip_frames) {
/* splitting root node. Tricky point:
*
-@@ -2512,22 +1581,20 @@ static int split_index_node(handle_t *ha
+@@ -2512,22 +1577,20 @@ static int split_index_node(handle_t *ha
* capacity of the root node is smaller than that of
* non-root one.
*/
/* Shift frames in the path */
memmove(frames + 2, frames + 1,
-@@ -2536,49 +1603,61 @@ static int split_index_node(handle_t *ha
+@@ -2536,49 +1599,61 @@ static int split_index_node(handle_t *ha
frames[1].at = iam_entry_shift(path, entries2, idx);
frames[1].entries = entries = entries2;
frames[1].bh = bh2;
}
goto cleanup;
journal_error:
-@@ -2610,7 +1689,7 @@ static int ext3_dx_add_entry(handle_t *h
+@@ -2610,7 +1685,7 @@ static int ext3_dx_add_entry(handle_t *h
size_t isize;
iam_path_compat_init(&cpath, dir);
err = dx_probe(dentry, NULL, &hinfo, path);
if (err != 0)
-@@ -2620,8 +1699,9 @@ static int ext3_dx_add_entry(handle_t *h
+@@ -2620,8 +1695,9 @@ static int ext3_dx_add_entry(handle_t *h
/* XXX nikita: global serialization! */
isize = dir->i_size;
if (err != 0)
goto cleanup;
-@@ -2641,11 +1721,11 @@ static int ext3_dx_add_entry(handle_t *h
+@@ -2641,11 +1717,11 @@ static int ext3_dx_add_entry(handle_t *h
goto cleanup;
/*copy split inode too*/
err = add_dirent_to_buf(handle, dentry, inode, de, bh);
goto cleanup2;
-@@ -2758,12 +1838,12 @@ static struct inode * ext3_new_inode_wan
+@@ -2758,12 +1834,12 @@ static struct inode * ext3_new_inode_wan
* is so far negative - it has no inode.
*
* If the create succeeds, we fill in the inode information
Index: iam/include/linux/lustre_iam.h
===================================================================
---- iam.orig/include/linux/lustre_iam.h 2006-09-28 22:11:15.000000000 +0400
-+++ iam/include/linux/lustre_iam.h 2006-10-03 22:00:23.000000000 +0400
+--- iam.orig/include/linux/lustre_iam.h 2006-10-04 15:05:22.000000000 +0400
++++ iam/include/linux/lustre_iam.h 2006-10-04 15:07:04.000000000 +0400
@@ -1,9 +1,68 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
Index: iam/fs/ext3/Makefile
===================================================================
---- iam.orig/fs/ext3/Makefile 2006-10-03 22:00:23.000000000 +0400
-+++ iam/fs/ext3/Makefile 2006-10-03 22:00:24.000000000 +0400
+--- iam.orig/fs/ext3/Makefile 2006-10-04 15:07:04.000000000 +0400
++++ iam/fs/ext3/Makefile 2006-10-04 15:07:05.000000000 +0400
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
Index: iam/fs/ext3/dir.c
===================================================================
---- iam.orig/fs/ext3/dir.c 2006-10-03 22:00:23.000000000 +0400
-+++ iam/fs/ext3/dir.c 2006-10-03 22:00:24.000000000 +0400
+--- iam.orig/fs/ext3/dir.c 2006-10-04 15:07:04.000000000 +0400
++++ iam/fs/ext3/dir.c 2006-10-04 15:07:05.000000000 +0400
@@ -28,6 +28,7 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
(filp->f_version != inode->i_version)) {
Index: iam/fs/ext3/file.c
===================================================================
---- iam.orig/fs/ext3/file.c 2006-10-03 22:00:23.000000000 +0400
-+++ iam/fs/ext3/file.c 2006-10-03 22:00:24.000000000 +0400
+--- iam.orig/fs/ext3/file.c 2006-10-04 15:07:04.000000000 +0400
++++ iam/fs/ext3/file.c 2006-10-04 15:07:05.000000000 +0400
@@ -23,6 +23,7 @@
#include <linux/jbd.h>
#include <linux/ext3_fs.h>
Index: iam/fs/ext3/iam-uapi.c
===================================================================
--- iam.orig/fs/ext3/iam-uapi.c 2004-04-06 17:27:52.000000000 +0400
-+++ iam/fs/ext3/iam-uapi.c 2006-10-03 22:00:24.000000000 +0400
++++ iam/fs/ext3/iam-uapi.c 2006-10-04 15:07:05.000000000 +0400
@@ -0,0 +1,368 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+}
Index: iam/fs/ext3/ioctl.c
===================================================================
---- iam.orig/fs/ext3/ioctl.c 2006-10-03 22:00:23.000000000 +0400
-+++ iam/fs/ext3/ioctl.c 2006-10-03 22:00:24.000000000 +0400
+--- iam.orig/fs/ext3/ioctl.c 2006-10-04 15:07:04.000000000 +0400
++++ iam/fs/ext3/ioctl.c 2006-10-04 15:07:05.000000000 +0400
@@ -250,6 +250,6 @@ flags_err:
}
Index: iam/include/linux/lustre_iam.h
===================================================================
---- iam.orig/include/linux/lustre_iam.h 2006-10-03 22:00:23.000000000 +0400
-+++ iam/include/linux/lustre_iam.h 2006-10-03 22:00:24.000000000 +0400
+--- iam.orig/include/linux/lustre_iam.h 2006-10-04 15:07:04.000000000 +0400
++++ iam/include/linux/lustre_iam.h 2006-10-04 15:07:05.000000000 +0400
@@ -30,9 +30,6 @@
#ifndef __LINUX_LUSTRE_IAM_H__
#define __LINUX_LUSTRE_IAM_H__
Index: iam/fs/ext3/super.c
===================================================================
---- iam.orig/fs/ext3/super.c 2006-10-03 22:00:23.000000000 +0400
-+++ iam/fs/ext3/super.c 2006-10-03 22:00:24.000000000 +0400
-@@ -1168,8 +1168,8 @@ static int ext3_check_descriptors (struc
+--- iam.orig/fs/ext3/super.c 2006-10-04 15:07:04.000000000 +0400
++++ iam/fs/ext3/super.c 2006-10-04 15:07:05.000000000 +0400
+@@ -51,13 +51,13 @@ static void ext3_clear_journal_err(struc
+ struct ext3_super_block * es);
+ static int ext3_sync_fs(struct super_block *sb, int wait);
+
+-/*
++/*
+ * Wrappers for journal_start/end.
+ *
+ * The only special thing we need to do here is to make sure that all
+ * journal_end calls result in the superblock being marked dirty, so
+ * that sync() will call the filesystem's write_super callback if
+- * appropriate.
++ * appropriate.
+ */
+ handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks)
+ {
+@@ -79,11 +79,11 @@ handle_t *ext3_journal_start_sb(struct s
+ return journal_start(journal, nblocks);
+ }
+
+-/*
++/*
+ * The only special thing we need to do here is to make sure that all
+ * journal_stop calls result in the superblock being marked dirty, so
+ * that sync() will call the filesystem's write_super callback if
+- * appropriate.
++ * appropriate.
+ */
+ int __ext3_journal_stop(const char *where, handle_t *handle)
+ {
+@@ -117,7 +117,7 @@ void ext3_journal_abort_handle(const cha
+ if (is_handle_aborted(handle))
+ return;
+
+- printk(KERN_ERR "%s: aborting transaction: %s in %s\n",
++ printk(KERN_ERR "%s: aborting transaction: %s in %s\n",
+ caller, errstr, err_fn);
+
+ journal_abort_handle(handle);
+@@ -147,6 +147,8 @@ static void ext3_handle_error(struct sup
+ EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
+ es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
+
++ dump_stack();
++
+ if (sb->s_flags & MS_RDONLY)
+ return;
+
+@@ -374,7 +376,7 @@ static void dump_orphan_list(struct supe
+ {
+ struct list_head *l;
+
+- printk(KERN_ERR "sb orphan head is %d\n",
++ printk(KERN_ERR "sb orphan head is %d\n",
+ le32_to_cpu(sbi->s_es->s_last_orphan));
+
+ printk(KERN_ERR "sb_info orphan list:\n");
+@@ -383,7 +385,7 @@ static void dump_orphan_list(struct supe
+ printk(KERN_ERR " "
+ "inode %s:%ld at %p: mode %o, nlink %d, next %d\n",
+ inode->i_sb->s_id, inode->i_ino, inode,
+- inode->i_mode, inode->i_nlink,
++ inode->i_mode, inode->i_nlink,
+ NEXT_ORPHAN(inode));
+ }
+ }
+@@ -486,7 +488,7 @@ static void init_once(void * foo, kmem_c
+ inode_init_once(&ei->vfs_inode);
+ }
+ }
+-
++
+ static int init_inodecache(void)
+ {
+ ext3_inode_cachep = kmem_cache_create("ext3_inode_cache",
+@@ -1168,8 +1170,8 @@ static int ext3_check_descriptors (struc
* e2fsck was run on this filesystem, and it must have already done the orphan
* inode cleanup for us, so we can safely abort without any further action.
*/
{
unsigned int s_flags = sb->s_flags;
int nr_orphans = 0, nr_truncates = 0;
-@@ -1256,7 +1256,9 @@ static void ext3_orphan_cleanup (struct
+@@ -1256,7 +1258,9 @@ static void ext3_orphan_cleanup (struct
}
#endif
sb->s_flags = s_flags; /* Restore MS_RDONLY status */
#define log2(n) ffz(~(n))
-@@ -1682,9 +1684,8 @@ static int ext3_fill_super (struct super
+@@ -1362,7 +1366,7 @@ static int ext3_fill_super (struct super
+ sb->s_magic = le16_to_cpu(es->s_magic);
+ if (sb->s_magic != EXT3_SUPER_MAGIC) {
+ if (!silent)
+- printk(KERN_ERR
++ printk(KERN_ERR
+ "VFS: Can't find ext3 filesystem on dev %s.\n",
+ sb->s_id);
+ goto failed_mount;
+@@ -1408,7 +1412,7 @@ static int ext3_fill_super (struct super
+ (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) ||
+ EXT3_HAS_RO_COMPAT_FEATURE(sb, ~0U) ||
+ EXT3_HAS_INCOMPAT_FEATURE(sb, ~0U)))
+- printk(KERN_WARNING
++ printk(KERN_WARNING
+ "EXT3-fs warning: feature flags set on rev 0 fs, "
+ "running e2fsck is recommended\n");
+ /*
+@@ -1434,7 +1438,7 @@ static int ext3_fill_super (struct super
+
+ if (blocksize < EXT3_MIN_BLOCK_SIZE ||
+ blocksize > EXT3_MAX_BLOCK_SIZE) {
+- printk(KERN_ERR
++ printk(KERN_ERR
+ "EXT3-fs: Unsupported filesystem blocksize %d on %s.\n",
+ blocksize, sb->s_id);
+ goto failed_mount;
+@@ -1458,14 +1462,14 @@ static int ext3_fill_super (struct super
+ offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize;
+ bh = sb_bread(sb, logic_sb_block);
+ if (!bh) {
+- printk(KERN_ERR
++ printk(KERN_ERR
+ "EXT3-fs: Can't read superblock on 2nd try.\n");
+ goto failed_mount;
+ }
+ es = (struct ext3_super_block *)(((char *)bh->b_data) + offset);
+ sbi->s_es = es;
+ if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) {
+- printk (KERN_ERR
++ printk (KERN_ERR
+ "EXT3-fs: Magic mismatch, very weird !\n");
+ goto failed_mount;
+ }
+@@ -1682,9 +1686,8 @@ static int ext3_fill_super (struct super
* superblock lock.
*/
EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS;
printk (KERN_INFO "EXT3-fs: recovery complete.\n");
ext3_mark_recovery_complete(sb, es);
printk (KERN_INFO "EXT3-fs: mounted filesystem with %s data mode.\n",
+@@ -1728,7 +1731,7 @@ out_fail:
+ /*
+ * Setup any per-fs journal parameters now. We'll do this both on
+ * initial mount, once the journal has been initialised but before we've
+- * done any recovery; and again on any subsequent remount.
++ * done any recovery; and again on any subsequent remount.
+ */
+ static void ext3_init_journal_params(struct super_block *sb, journal_t *journal)
+ {