Whamcloud - gitweb
Land b_smallfix onto HEAD (20040512_1806)
[fs/lustre-release.git] / lustre / kernel_patches / patches / iopen-2.4.18.patch
index 202ebc6..7c56b03 100644 (file)
@@ -8,9 +8,11 @@
  include/linux/ext3_fs.h            |    2 
  8 files changed, 318 insertions(+), 1 deletion(-)
 
---- linux-2.4.18-p4smp/Documentation/filesystems/ext2.txt~iopen-2.4.18 2003-07-09 12:17:30.000000000 -0600
-+++ linux-2.4.18-p4smp-braam/Documentation/filesystems/ext2.txt        2003-07-09 17:13:02.000000000 -0600
-@@ -35,6 +35,22 @@ resgid=n                    The group ID which may use th
+Index: linux-aed/Documentation/filesystems/ext2.txt
+===================================================================
+--- linux-aed.orig/Documentation/filesystems/ext2.txt  Tue May  4 13:14:35 2004
++++ linux-aed/Documentation/filesystems/ext2.txt       Tue May  4 19:17:12 2004
+@@ -35,6 +35,22 @@
  
  sb=n                          Use alternate superblock at this location.
  
  grpquota,noquota,quota,usrquota       Quota options are silently ignored by ext2.
  
  
---- linux-2.4.18-p4smp/fs/ext3/Makefile~iopen-2.4.18   2003-07-09 17:12:12.000000000 -0600
-+++ linux-2.4.18-p4smp-braam/fs/ext3/Makefile  2003-07-09 17:13:15.000000000 -0600
-@@ -11,7 +11,7 @@ O_TARGET := ext3.o
+Index: linux-aed/fs/ext3/Makefile
+===================================================================
+--- linux-aed.orig/fs/ext3/Makefile    Tue May  4 19:16:51 2004
++++ linux-aed/fs/ext3/Makefile Tue May  4 19:17:12 2004
+@@ -11,7 +11,7 @@
  
- export-objs :=        super.o inode.o xattr.o ext3-exports.o
+ export-objs :=        ext3-exports.o
  
 -obj-y    := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
-+obj-y    := balloc.o iopen.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
++obj-y    := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
                ioctl.o namei.o super.o symlink.o xattr.o ext3-exports.o
  obj-m    := $(O_TARGET)
  
---- linux-2.4.18-p4smp/fs/ext3/inode.c~iopen-2.4.18    2003-07-09 17:11:19.000000000 -0600
-+++ linux-2.4.18-p4smp-braam/fs/ext3/inode.c   2003-07-09 17:13:02.000000000 -0600
+Index: linux-aed/fs/ext3/inode.c
+===================================================================
+--- linux-aed.orig/fs/ext3/inode.c     Tue May  4 19:17:09 2004
++++ linux-aed/fs/ext3/inode.c  Tue May  4 19:17:12 2004
 @@ -31,6 +31,7 @@
  #include <linux/highuid.h>
  #include <linux/quotaops.h>
@@ -54,7 +60,7 @@
  
  /*
   * SEARCH_FROM_ZERO forces each block allocation to search from the start
-@@ -2165,6 +2166,9 @@ void ext3_read_inode(struct inode * inod
+@@ -2277,6 +2278,9 @@
        struct buffer_head *bh;
        int block;
        
        if(ext3_get_inode_loc(inode, &iloc))
                goto bad_inode;
        bh = iloc.bh;
---- /dev/null  2003-01-30 03:24:37.000000000 -0700
-+++ linux-2.4.18-p4smp-braam/fs/ext3/iopen.c   2003-07-09 17:13:02.000000000 -0600
-@@ -0,0 +1,258 @@
+Index: linux-aed/fs/ext3/iopen.c
+===================================================================
+--- linux-aed.orig/fs/ext3/iopen.c     Tue May  4 13:14:35 2004
++++ linux-aed/fs/ext3/iopen.c  Tue May  4 19:17:12 2004
+@@ -0,0 +1,282 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
 +
 +/* This function is spliced into ext3_lookup and does the move of a
 + * disconnected dentry (if it exists) to a connected dentry.
-+ * Caller must hold dcache_lock.
 + */
-+struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode)
++struct dentry *iopen_connect_dentry(struct dentry *dentry, struct inode *inode,
++                                  int rehash)
 +{
 +      struct dentry *tmp, *goal = NULL;
 +      struct list_head *lp;
 +
++      /* verify this dentry is really new */
++      assert(dentry->d_inode == NULL);
++      assert(list_empty(&dentry->d_alias));           /* d_instantiate */
++      if (rehash)
++              assert(list_empty(&dentry->d_hash));    /* d_rehash */
++      assert(list_empty(&dentry->d_subdirs));
++
++      spin_lock(&dcache_lock);
++      if (!inode)
++              goto do_rehash;
++
 +      /* preferrably return a connected dentry */
 +      list_for_each(lp, &inode->i_dentry) {
 +              tmp = list_entry(lp, struct dentry, d_alias);
 +      }
 +
 +      if (!goal)
-+              return NULL;
++              goto do_instantiate;
 +
 +      /* Move the goal to the de hash queue - like d_move() */
 +      goal->d_flags &= ~DCACHE_NFSD_DISCONNECTED;
 +      list_del_init(&goal->d_hash);
 +
 +      list_del(&goal->d_child);
-+      list_del(&de->d_child);
++      list_del(&dentry->d_child);
 +
 +      /* Switch the parents and the names.. */
-+      switch_names(goal, de);
-+      do_switch(goal->d_parent, de->d_parent);
-+      do_switch(goal->d_name.len, de->d_name.len);
-+      do_switch(goal->d_name.hash, de->d_name.hash);
++      switch_names(goal, dentry);
++      do_switch(goal->d_parent, dentry->d_parent);
++      do_switch(goal->d_name.len, dentry->d_name.len);
++      do_switch(goal->d_name.hash, dentry->d_name.hash);
 +
 +      /* And add them back to the (new) parent lists */
 +      list_add(&goal->d_child, &goal->d_parent->d_subdirs);
-+      list_add(&de->d_child, &de->d_parent->d_subdirs);
++      list_add(&dentry->d_child, &dentry->d_parent->d_subdirs);
 +      __d_rehash(goal, 0);
++      spin_unlock(&dcache_lock);
++      iput(inode);
 +
 +      return goal;
++
++      /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++do_instantiate:
++      list_add(&dentry->d_alias, &inode->i_dentry);   /* d_instantiate */
++      dentry->d_inode = inode;
++do_rehash:
++      if (rehash)
++              __d_rehash(dentry, 0);                  /* d_rehash */
++      spin_unlock(&dcache_lock);
++
++      return NULL;
 +}
 +
 +/*
 +
 +      return 1;
 +}
---- /dev/null  2003-01-30 03:24:37.000000000 -0700
-+++ linux-2.4.18-p4smp-braam/fs/ext3/iopen.h   2003-07-09 17:13:02.000000000 -0600
+Index: linux-aed/fs/ext3/iopen.h
+===================================================================
+--- linux-aed.orig/fs/ext3/iopen.h     Tue May  4 13:14:35 2004
++++ linux-aed/fs/ext3/iopen.h  Tue May  4 19:17:12 2004
 @@ -0,0 +1,15 @@
 +/*
 + * iopen.h
 +
 +extern int ext3_check_for_iopen(struct inode *dir, struct dentry *dentry);
 +extern int ext3_iopen_get_inode(struct inode *inode);
-+extern struct dentry *iopen_connect_dentry(struct dentry *de,
-+                                         struct inode *inode);
---- linux-2.4.18-p4smp/fs/ext3/namei.c~iopen-2.4.18    2003-07-09 13:32:38.000000000 -0600
-+++ linux-2.4.18-p4smp-braam/fs/ext3/namei.c   2003-07-09 17:13:02.000000000 -0600
++extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
++                                         struct inode *inode, int rehash);
+Index: linux-aed/fs/ext3/namei.c
+===================================================================
+--- linux-aed.orig/fs/ext3/namei.c     Tue May  4 19:17:05 2004
++++ linux-aed/fs/ext3/namei.c  Tue May  4 19:17:12 2004
 @@ -34,6 +34,7 @@
  #include <linux/locks.h>
  #include <linux/quotaops.h>
  
  /*
   * define how far ahead to read directories while searching them.
-@@ -703,10 +704,14 @@ cleanup_and_exit:
-       struct inode * inode;
-       struct ext3_dir_entry_2 * de;
-       struct buffer_head * bh;
-+      struct dentry *alternate = NULL;
+@@ -713,6 +714,9 @@
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
-@@ -723,7 +729,28 @@ static struct dentry *ext3_lookup(struct
+@@ -723,8 +727,8 @@
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
 -      d_add(dentry, inode);
+-      return NULL;
 +
-+      /* verify this dentry is really new */
-+      assert(!dentry->d_inode);
-+      assert(list_empty(&dentry->d_alias));           /* d_instantiate */
-+      assert(list_empty(&dentry->d_hash));            /* d_rehash */
-+      assert(list_empty(&dentry->d_subdirs));
-+
-+      spin_lock(&dcache_lock);
-+      if (inode && (alternate = iopen_connect_dentry(dentry, inode))) {
-+              spin_unlock(&dcache_lock);
-+              iput(inode);
-+              return alternate;
++      return iopen_connect_dentry(dentry, inode, 1);
+ }
+ #define S_SHIFT 12
+@@ -1588,10 +1592,6 @@
+                             inode->i_nlink);
+       inode->i_version = ++event;
+       inode->i_nlink = 0;
+-      /* There's no need to set i_disksize: the fact that i_nlink is
+-       * zero will ensure that the right thing happens during any
+-       * recovery. */
+-      inode->i_size = 0;
+       ext3_orphan_add(handle, inode);
+       ext3_mark_inode_dirty(handle, inode);
+       dir->i_nlink--;
+@@ -1711,6 +1711,23 @@
+       goto out_stop;
+ }
++/* Like ext3_add_nondir() except for call to iopen_connect_dentry */
++static int ext3_add_link(handle_t *handle, struct dentry *dentry,
++                       struct inode *inode)
++{
++      int err = ext3_add_entry(handle, dentry, inode);
++      if (!err) {
++              err = ext3_mark_inode_dirty(handle, inode);
++              if (err == 0) {
++                      (void)iopen_connect_dentry(dentry, inode, 0);
++                      return 0;
++              }
 +      }
++      ext3_dec_count(handle, inode);
++      iput(inode);
++      return err;
++}
 +
-+      /* d_add(), but don't drop dcache_lock before adding dentry to inode */
-+      if (inode)                                      /* d_instantiate */
-+              list_add(&dentry->d_alias, &inode->i_dentry);
-+      dentry->d_inode = inode;
-+
-+      __d_rehash(dentry, 0);                          /* d_rehash */
-+      spin_unlock(&dcache_lock);
-+
-       return NULL;
- }
+ static int ext3_link (struct dentry * old_dentry,
+               struct inode * dir, struct dentry *dentry)
+ {
+@@ -1736,7 +1753,8 @@
+       ext3_inc_count(handle, inode);
+       atomic_inc(&inode->i_count);
  
---- linux-2.4.18-p4smp/fs/ext3/super.c~iopen-2.4.18    2003-07-09 13:32:38.000000000 -0600
-+++ linux-2.4.18-p4smp-braam/fs/ext3/super.c   2003-07-09 17:13:02.000000000 -0600
-@@ -831,6 +831,18 @@ static int parse_options (char * options
+-      err = ext3_add_nondir(handle, dentry, inode);
++      err = ext3_add_link(handle, dentry, inode);
++      ext3_orphan_del(handle, inode);
+       ext3_mark_inode_dirty(handle, inode);
+       ext3_journal_stop(handle, dir);
+       return err;
+Index: linux-aed/fs/ext3/super.c
+===================================================================
+--- linux-aed.orig/fs/ext3/super.c     Tue May  4 19:17:01 2004
++++ linux-aed/fs/ext3/super.c  Tue May  4 19:17:12 2004
+@@ -834,6 +834,18 @@
                         || !strcmp (this_char, "quota")
                         || !strcmp (this_char, "usrquota"))
                        /* Don't do anything ;-) */ ;
                else if (!strcmp (this_char, "journal")) {
                        /* @@@ FIXME */
                        /* Eventually we will want to be able to create
---- linux-2.4.18-p4smp/include/linux/ext3_fs.h~iopen-2.4.18    2003-07-09 13:32:38.000000000 -0600
-+++ linux-2.4.18-p4smp-braam/include/linux/ext3_fs.h   2003-07-09 17:13:02.000000000 -0600
-@@ -321,6 +321,8 @@ struct ext3_inode {
+Index: linux-aed/include/linux/ext3_fs.h
+===================================================================
+--- linux-aed.orig/include/linux/ext3_fs.h     Tue May  4 19:17:08 2004
++++ linux-aed/include/linux/ext3_fs.h  Tue May  4 19:17:12 2004
+@@ -321,6 +321,8 @@
  #define EXT3_MOUNT_UPDATE_JOURNAL     0x1000  /* Update the journal format */
  #define EXT3_MOUNT_NO_UID32           0x2000  /* Disable 32-bit UIDs */
  #define EXT3_MOUNT_INDEX              0x4000  /* Enable directory index */
  #define EXT3_MOUNT_ASYNCDEL           0x20000 /* Delayed deletion */
  
  /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
-
-_