Whamcloud - gitweb
Updates to the extN patch that should resolve the corrpution problem with
authoradilger <adilger>
Thu, 25 Jul 2002 21:35:21 +0000 (21:35 +0000)
committeradilger <adilger>
Thu, 25 Jul 2002 21:35:21 +0000 (21:35 +0000)
indexed directories.  We do not enable indexed directories in new_fs yet.

lustre/extN/Makefile.am
lustre/extN/ext3-2.4.18-ino_sb_macro.diff
lustre/extN/htree-ext3-2.4.18.diff

index c2592b4..a7fb07c 100644 (file)
@@ -13,7 +13,7 @@ EXTNP+= ext3-2.4.18-ino_sb_macro.diff extN-misc-fixup.diff
 EXTNC = balloc.c bitmap.c dir.c file.c fsync.c ialloc.c inode.c ioctl.c
 EXTNC+= namei.c super.c symlink.c
 EXTNI = extN_fs.h extN_fs_i.h extN_fs_sb.h extN_jbd.h
-EXTN_EXTRA = include/linux/xattr.h include/linux/extN_xattr.h fs/extN/xattr.c
+EXTN_EXTRA = include/linux/xattr.h include/linux/extN_xattr.h fs/extN/xattr.c fs/extN/hash.c
 extN_SOURCES = $(EXTNC) $(EXTNI) xattr.c # punch.c
 extN_DEPENDENCIES = patch-stamp
 EXTRA_DIST = $(EXTNP) extN-2.4.18-ino_sb_fixup.diff extN-2.4.18-exports.diff
@@ -62,7 +62,7 @@ patch-stamp: $(EXTNP)
        fi
        echo timestamp > $@
 
-$(EXTNC) $(EXTNI) $(EXTN_EXTRA) xattr.c: patch-stamp
+$(extN_SOURCES) $(EXTN_EXTRA): patch-stamp
 
 # Don't distribute any patched files.
 dist-hook:
index 8fbbcd1..385da3f 100644 (file)
        struct buffer_head *bh = 0;
        unsigned long block;
        unsigned long block_group;
-@@ -1995,25 +2000,21 @@ int ext3_get_inode_loc (struct inode *in
-               inode->i_ino != EXT3_ACL_IDX_INO &&
-               inode->i_ino != EXT3_ACL_DATA_INO &&
+@@ -1997,23 +2010,19 @@ int ext3_get_inode_loc (struct inode *in
                inode->i_ino != EXT3_JOURNAL_INO &&
 -              inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) ||
 -              inode->i_ino > le32_to_cpu(
 +++ ./fs/ext3/namei.c  Tue May  7 16:05:51 2002
 @@ -636,7 +636,7 @@ static struct buffer_head * ext3_find_en
        }
-        
+       
        nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb);
 -      start = dir->u.ext3_i.i_dir_start_lookup;
 +      start = EXT3_I(dir)->i_dir_start_lookup;
                        ret = bh;
                        goto cleanup_and_exit;
                } else {
-@@ -1320,7 +1320,7 @@ static int ext3_mkdir(struct inode * dir
-       if (err)
-               goto out_no_entry;
-       dir->i_nlink++;
--      dir->u.ext3_i.i_flags &= ~EXT3_INDEX_FL;
-+      EXT3_I(dir)->i_flags &= ~EXT3_INDEX_FL;
-       ext3_mark_inode_dirty(handle, dir);
-       d_instantiate(dentry, inode);
- out_stop:
 @@ -1419,7 +1419,7 @@ int ext3_orphan_add(handle_t *handle, st
        int err = 0, rc;
        
  }
  
 @@ -377,8 +377,6 @@ static int ext3_blkdev_remove(struct ext3
-        return ret;
+       return ret;
  }
  
 -#define orphan_list_entry(l) list_entry((l), struct inode, u.ext3_i.i_orphan)
index efba400..359384f 100644 (file)
@@ -1,23 +1,3 @@
---- ./fs/ext3/dir.c    2002/03/05 06:18:59     2.1
-+++ ./fs/ext3/dir.c    2002/03/05 06:26:56
-@@ -26,7 +26,7 @@
-       DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK
- };
--static int ext3_readdir(struct file *, void *, filldir_t);
-+int ext3_readdir(struct file *, void *, filldir_t);
- struct file_operations ext3_dir_operations = {
-       read:           generic_read_dir,
-@@ -65,7 +65,7 @@
-       return error_msg == NULL ? 1 : 0;
- }
--static int ext3_readdir(struct file * filp,
-+int ext3_readdir(struct file * filp,
-                        void * dirent, filldir_t filldir)
- {
-       int error = 0;
 --- ./fs/ext3/super.c  2002/03/05 06:18:59     2.1
 +++ ./fs/ext3/super.c  2002/03/05 06:26:56
 @@ -529,6 +529,12 @@
                else if (!strcmp (this_char, "debug"))
                        set_opt (*mount_options, DEBUG);
                else if (!strcmp (this_char, "errors")) {
-@@ -712,6 +718,10 @@
-                       EXT3_BLOCKS_PER_GROUP(sb),
-                       EXT3_INODES_PER_GROUP(sb),
-                       sbi->s_mount_opt);
-+
-+      if (EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX))
+@@ -702,6 +708,12 @@ static int ext3_setup_super(struct super
+       es->s_mtime = cpu_to_le32(CURRENT_TIME);
+       ext3_update_dynamic_rev(sb);
+       EXT3_SET_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
++
++      if (test_opt(sb, INDEX))
++              EXT3_SET_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX);
++      else if (EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX))
 +              set_opt (EXT3_SB(sb)->s_mount_opt, INDEX);
 +
-       printk(KERN_INFO "EXT3 FS " EXT3FS_VERSION ", " EXT3FS_DATE " on %s, ",
-                               bdevname(sb->s_dev));
-       if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
+       ext3_commit_super (sb, es, 1);
+       if (test_opt (sb, DEBUG))
+               printk (KERN_INFO
 --- ./fs/ext3/namei.c  2002/03/05 06:18:59     2.1
 +++ ./fs/ext3/namei.c  2002/03/06 00:13:18
 @@ -16,6 +16,10 @@
   */
  
  #include <linux/fs.h>
-@@ -38,6 +42,456 @@
+@@ -38,6 +42,432 @@
  #define NAMEI_RA_SIZE        (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
  #define NAMEI_RA_INDEX(c,b)  (((c) * NAMEI_RA_BLOCKS) + (b))
  
-+void ext3_add_compat_feature (struct super_block *sb, unsigned feature)
-+{
-+      if (!EXT3_HAS_COMPAT_FEATURE(sb, feature))
-+      {
-+              lock_super(sb);
-+              ext3_update_dynamic_rev(sb);
-+              EXT3_SET_COMPAT_FEATURE(sb, feature);
-+              ext3_write_super(sb);
-+              unlock_super(sb);
-+      }
-+}
-+
 +static struct buffer_head *ext3_append(handle_t *handle,
 +                                      struct inode *inode,
 +                                      u32 *block, int *err)
 +      return (struct stats) { names, space, bcount};
 +}
 +
-+static void dx_show_buckets (struct inode *dir)
-+{
-+      struct buffer_head *bh;
-+      struct dx_root *root;
-+      int err;
-+      if (!(bh = ext3_bread (NULL,dir, 0, 0,&err))) return;
-+      root = (struct dx_root *) bh->b_data;
-+      dx_show_entries (dir, root->entries, root->info.indirect_levels);
-+      brelse (bh);
-+}
-+
-+ssize_t hack_show_dir (struct file * filp, void * dirent, filldir_t filldir)
-+{
-+      if (is_dx (filp->f_dentry->d_inode) && !filp->f_pos)
-+              dx_show_buckets (filp->f_dentry->d_inode);
-+      return ext3_readdir(filp,dirent,filldir);
-+}
-+
 +/*
 + * Probe for a directory leaf block to search
 + */
 +}
 +#endif
 +
++static void ext3_update_dx_flag(struct inode *inode)
++{
++      if (!test_opt(inode->i_sb, INDEX))
++              EXT3_I(inode)->i_flags &= ~EXT3_INDEX_FL;
++}
++
  /*
   * NOTE! unlike strncmp, ext3_match returns 1 for success, 0 for failure.
   *
  static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
        struct inode *inode)
  {
-@@ -258,117 +852,282 @@
+@@ -258,117 +852,281 @@
        const char *name = dentry->d_name.name;
        int namelen = dentry->d_name.len;
        unsigned long offset;
 +       * and/or different from the directory change time.
 +       */
 +      dir->i_mtime = dir->i_ctime = CURRENT_TIME;
-+      /* EXT3_I(dir)->i_flags &= ~EXT3_INDEX_FL; */
-+      ext3_mark_inode_dirty(handle, dir);
++      ext3_update_dx_flag(dir);
 +      dir->i_version = ++event;
++      ext3_mark_inode_dirty(handle, dir);
 +      BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
 +      ext3_journal_dirty_metadata(handle, bh);
 +      brelse(bh);
 +              ext3_journal_get_write_access(handle, bh);
 +              root = (struct dx_root *) bh->b_data;
 +              
-+              ext3_add_compat_feature (sb, EXT3_FEATURE_COMPAT_DIR_INDEX);
 +              EXT3_I(dir)->i_flags |= EXT3_INDEX_FL;
 +              bh2 = ext3_append (handle, dir, &block, &retval);
 +              if (!(bh2))
        if (IS_ERR(handle))
                return PTR_ERR(handle);
  
+@@ -550,7 +1320,7 @@
+       if (err)
+               goto out_no_entry;
+       dir->i_nlink++;
+-      dir->u.ext3_i.i_flags &= ~EXT3_INDEX_FL;
++      ext3_update_dx_flag(dir);
+       ext3_mark_inode_dirty(handle, dir);
+       d_instantiate(dentry, inode);
+ out_stop:
 @@ -832,7 +1596,7 @@
        ext3_mark_inode_dirty(handle, inode);
        dir->i_nlink--;
        inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
 -      dir->u.ext3_i.i_flags &= ~EXT3_INDEX_FL;
-+      //      EXT3_I(dir)->i_flags &= ~EXT3_INDEX_FL;
++      ext3_update_dx_flag(dir);
        ext3_mark_inode_dirty(handle, dir);
  
  end_rmdir:
                goto end_unlink;
        dir->i_ctime = dir->i_mtime = CURRENT_TIME;
 -      dir->u.ext3_i.i_flags &= ~EXT3_INDEX_FL;
-+      //      EXT3_I(dir)->i_flags &= ~EXT3_INDEX_FL;
++      ext3_update_dx_flag(dir);
        ext3_mark_inode_dirty(handle, dir);
        inode->i_nlink--;
        if (!inode->i_nlink)
        }
        old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
 -      old_dir->u.ext3_i.i_flags &= ~EXT3_INDEX_FL;
-+      // EXT3_I(old_dir)->i_flags &= ~EXT3_INDEX_FL;
++      ext3_update_dx_flag(old_dir);
        if (dir_bh) {
                BUFFER_TRACE(dir_bh, "get_write_access");
                ext3_journal_get_write_access(handle, dir_bh);
                } else {
                        new_dir->i_nlink++;
 -                      new_dir->u.ext3_i.i_flags &= ~EXT3_INDEX_FL;
-+      //              EXT3_I(new_dir)->i_flags &= ~EXT3_INDEX_FL;
++                      ext3_update_dx_flag(new_dir);
                        ext3_mark_inode_dirty(handle, new_dir);
                }
        }