Whamcloud - gitweb
Split out the jbd callback patches from vanilla-2.4.19 so that we can use
authoradilger <adilger>
Mon, 20 Jan 2003 23:52:27 +0000 (23:52 +0000)
committeradilger <adilger>
Mon, 20 Jan 2003 23:52:27 +0000 (23:52 +0000)
them with the hp-pnnl series also.  I would have done the same for the
vanilla-2.4.18 patch, but it was already out of date w.r.t. the recent
Lustre l7 changes.

lustre/kernel_patches/patches/vanilla-2.4.19.patch

index 6f4236e..4ed5bb9 100644 (file)
@@ -1,3 +1,6 @@
+
+
+
  arch/i386/mm/init.c            |    6 
  arch/ia64/mm/init.c            |    6 
  drivers/block/blkpg.c          |   35 ++++
@@ -6,9 +9,6 @@
  fs/dcache.c                    |    1 
  fs/ext3/Makefile               |    2 
  fs/ext3/super.c                |    2 
- fs/jbd/commit.c                |   27 +++
- fs/jbd/journal.c               |    1 
- fs/jbd/transaction.c           |   56 ++++++-
  fs/namei.c                     |  296 ++++++++++++++++++++++++++++++++++-------
  fs/nfsd/vfs.c                  |    2 
  fs/open.c                      |   63 ++++++--
  include/linux/blkdev.h         |    4 
  include/linux/dcache.h         |   31 ++++
  include/linux/fs.h             |   23 +++
- include/linux/jbd.h            |   20 ++
  include/linux/lustre_version.h |    1 
  include/linux/slab.h           |    1 
  kernel/ksyms.c                 |    7 
  mm/slab.c                      |   53 +++++++
23 files changed, 591 insertions(+), 87 deletions(-)
19 files changed, 501 insertions(+), 73 deletions(-)
 
 --- /dev/null  Fri Aug 30 17:31:37 2002
 +++ linux-2.4.19-root/include/linux/lustre_version.h   Sun Jan 19 19:54:00 2003
  
  MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
  MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
---- linux-2.4.19/fs/jbd/commit.c~vanilla-2.4.19        Sun Jan 19 19:46:42 2003
-+++ linux-2.4.19-root/fs/jbd/commit.c  Sun Jan 19 19:46:42 2003
-@@ -475,7 +475,7 @@ start_journal_io:
-            transaction's t_log_list queue, and metadata buffers are on
-            the t_iobuf_list queue.
--         Wait for the transactions in reverse order.  That way we are
-+         Wait for the buffers in reverse order.  That way we are
-          less likely to be woken up until all IOs have completed, and
-          so we incur less scheduling load.
-       */
-@@ -566,8 +566,10 @@ start_journal_io:
-       jbd_debug(3, "JBD: commit phase 6\n");
--      if (is_journal_aborted(journal))
-+      if (is_journal_aborted(journal)) {
-+              unlock_journal(journal);
-               goto skip_commit;
-+      }
-       /* Done it all: now write the commit record.  We should have
-        * cleaned up our previous buffers by now, so if we are in abort
-@@ -577,6 +579,7 @@ start_journal_io:
-       descriptor = journal_get_descriptor_buffer(journal);
-       if (!descriptor) {
-               __journal_abort_hard(journal);
-+              unlock_journal(journal);
-               goto skip_commit;
-       }
-       
-@@ -600,7 +603,6 @@ start_journal_io:
-               put_bh(bh);             /* One for getblk() */
-               journal_unlock_journal_head(descriptor);
-       }
--      lock_journal(journal);
-       /* End of a transaction!  Finally, we can do checkpoint
-            processing: any buffers committed as a result of this
-@@ -609,6 +611,25 @@ start_journal_io:
- skip_commit:
-+      /* Call any callbacks that had been registered for handles in this
-+       * transaction.  It is up to the callback to free any allocated
-+       * memory.
-+       */
-+      if (!list_empty(&commit_transaction->t_jcb)) {
-+              struct list_head *p, *n;
-+              int error = is_journal_aborted(journal);
-+
-+              list_for_each_safe(p, n, &commit_transaction->t_jcb) {
-+                      struct journal_callback *jcb;
-+
-+                      jcb = list_entry(p, struct journal_callback, jcb_list);
-+                      list_del(p);
-+                      jcb->jcb_func(jcb, error);
-+              }
-+      }
-+
-+      lock_journal(journal);
-+
-       jbd_debug(3, "JBD: commit phase 7\n");
-       J_ASSERT(commit_transaction->t_sync_datalist == NULL);
---- linux-2.4.19/fs/jbd/journal.c~vanilla-2.4.19       Sun Jan 19 19:46:42 2003
-+++ linux-2.4.19-root/fs/jbd/journal.c Sun Jan 19 19:46:42 2003
-@@ -58,6 +58,7 @@ EXPORT_SYMBOL(journal_sync_buffer);
- #endif
- EXPORT_SYMBOL(journal_flush);
- EXPORT_SYMBOL(journal_revoke);
-+EXPORT_SYMBOL(journal_callback_set);
- EXPORT_SYMBOL(journal_init_dev);
- EXPORT_SYMBOL(journal_init_inode);
---- linux-2.4.19/fs/jbd/transaction.c~vanilla-2.4.19   Sun Jan 19 19:46:42 2003
-+++ linux-2.4.19-root/fs/jbd/transaction.c     Sun Jan 19 19:46:42 2003
-@@ -57,6 +57,7 @@ static transaction_t * get_transaction (
-       transaction->t_state = T_RUNNING;
-       transaction->t_tid = journal->j_transaction_sequence++;
-       transaction->t_expires = jiffies + journal->j_commit_interval;
-+      INIT_LIST_HEAD(&transaction->t_jcb);
-       /* Set up the commit timer for the new transaction. */
-       J_ASSERT (!journal->j_commit_timer_active);
-@@ -201,6 +202,20 @@ repeat_locked:
-       return 0;
- }
-+/* Allocate a new handle.  This should probably be in a slab... */
-+static handle_t *new_handle(int nblocks)
-+{
-+      handle_t *handle = jbd_kmalloc(sizeof (handle_t), GFP_NOFS);
-+      if (!handle)
-+              return NULL;
-+      memset(handle, 0, sizeof (handle_t));
-+      handle->h_buffer_credits = nblocks;
-+      handle->h_ref = 1;
-+      INIT_LIST_HEAD(&handle->h_jcb);
-+
-+      return handle;
-+}
-+
- /*
-  * Obtain a new handle.  
-  *
-@@ -227,14 +242,11 @@ handle_t *journal_start(journal_t *journ
-               handle->h_ref++;
-               return handle;
-       }
--      
--      handle = jbd_kmalloc(sizeof (handle_t), GFP_NOFS);
-+
-+      handle = new_handle(nblocks);
-       if (!handle)
-               return ERR_PTR(-ENOMEM);
--      memset (handle, 0, sizeof (handle_t));
--      handle->h_buffer_credits = nblocks;
--      handle->h_ref = 1;
-       current->journal_info = handle;
-       err = start_this_handle(journal, handle);
-@@ -333,14 +345,11 @@ handle_t *journal_try_start(journal_t *j
-       
-       if (is_journal_aborted(journal))
-               return ERR_PTR(-EIO);
--      
--      handle = jbd_kmalloc(sizeof (handle_t), GFP_NOFS);
-+
-+      handle = new_handle(nblocks);
-       if (!handle)
-               return ERR_PTR(-ENOMEM);
--      memset (handle, 0, sizeof (handle_t));
--      handle->h_buffer_credits = nblocks;
--      handle->h_ref = 1;
-       current->journal_info = handle;
-       err = try_start_this_handle(journal, handle);
-@@ -1328,6 +1337,28 @@ out:
- #endif
- /*
-+ * Register a callback function for this handle.  The function will be
-+ * called when the transaction that this handle is part of has been
-+ * committed to disk with the original callback data struct and the
-+ * error status of the journal as parameters.  There is no guarantee of
-+ * ordering between handles within a single transaction, nor between
-+ * callbacks registered on the same handle.
-+ *
-+ * The caller is responsible for allocating the journal_callback struct.
-+ * This is to allow the caller to add as much extra data to the callback
-+ * as needed, but reduce the overhead of multiple allocations.  The caller
-+ * allocated struct must start with a struct journal_callback at offset 0,
-+ * and has the caller-specific data afterwards.
-+ */
-+void journal_callback_set(handle_t *handle,
-+                        void (*func)(struct journal_callback *jcb, int error),
-+                        struct journal_callback *jcb)
-+{
-+      list_add(&jcb->jcb_list, &handle->h_jcb);
-+      jcb->jcb_func = func;
-+}
-+
-+/*
-  * All done for a particular handle.
-  *
-  * There is not much action needed here.  We just return any remaining
-@@ -1393,7 +1424,10 @@ int journal_stop(handle_t *handle)
-                       wake_up(&journal->j_wait_transaction_locked);
-       }
--      /* 
-+      /* Move callbacks from the handle to the transaction. */
-+      list_splice(&handle->h_jcb, &transaction->t_jcb);
-+
-+      /*
-        * If the handle is marked SYNC, we need to set another commit
-        * going!  We also want to force a commit if the current
-        * transaction is occupying too much of the log, or if the
 --- linux-2.4.19/include/linux/blkdev.h~vanilla-2.4.19 Sun Jan 19 19:46:42 2003
 +++ linux-2.4.19-root/include/linux/blkdev.h   Sun Jan 19 21:05:55 2003
 @@ -240,4 +240,8 @@ static inline unsigned int block_size(kd
  
  extern void *kmalloc(size_t, int);
  extern void kfree(const void *);
---- linux-2.4.19/include/linux/jbd.h~vanilla-2.4.19    Sun Jan 19 19:46:42 2003
-+++ linux-2.4.19-root/include/linux/jbd.h      Sun Jan 19 19:46:42 2003
-@@ -249,6 +249,13 @@ static inline struct journal_head *bh2jh
-       return bh->b_private;
- }
-+#define HAVE_JOURNAL_CALLBACK_STATUS
-+struct journal_callback {
-+      struct list_head jcb_list;
-+      void (*jcb_func)(struct journal_callback *jcb, int error);
-+      /* user data goes here */
-+};
-+
- struct jbd_revoke_table_s;
- /* The handle_t type represents a single atomic update being performed
-@@ -279,6 +286,12 @@ struct handle_s 
-          operations */
-       int                     h_err;
-+      /* List of application registered callbacks for this handle.
-+       * The function(s) will be called after the transaction that
-+       * this handle is part of has been committed to disk.
-+       */
-+      struct list_head        h_jcb;
-+
-       /* Flags */
-       unsigned int    h_sync:         1;      /* sync-on-close */
-       unsigned int    h_jdata:        1;      /* force data journaling */
-@@ -398,6 +411,10 @@ struct transaction_s 
-       /* How many handles used this transaction? */
-       int t_handle_count;
-+
-+      /* List of registered callback functions for this transaction.
-+       * Called when the transaction is committed. */
-+      struct list_head        t_jcb;
- };
-@@ -646,6 +663,9 @@ extern int  journal_flushpage(journal_t 
- extern int     journal_try_to_free_buffers(journal_t *, struct page *, int);
- extern int     journal_stop(handle_t *);
- extern int     journal_flush (journal_t *);
-+extern void    journal_callback_set(handle_t *handle,
-+                                    void (*fn)(struct journal_callback *,int),
-+                                    struct journal_callback *jcb);
- extern void    journal_lock_updates (journal_t *);
- extern void    journal_unlock_updates (journal_t *);
 --- linux-2.4.19/kernel/ksyms.c~vanilla-2.4.19 Sun Jan 19 19:46:42 2003
 +++ linux-2.4.19-root/kernel/ksyms.c   Sun Jan 19 19:46:42 2003
 @@ -264,6 +264,7 @@ EXPORT_SYMBOL(read_cache_page);
                        struct inode *, struct dentry *);
 +      int (*rename2) (struct inode *, struct inode *, 
 +                      char *oldname, int oldlen, 
-+                        char *newname, int newlen);
++                      char *newname, int newlen);
        int (*readlink) (struct dentry *, char *,int);
        int (*follow_link) (struct dentry *, struct nameidata *);
 +      int (*follow_link2) (struct dentry *, struct nameidata *,
                dput(dentry);
                break;
        }
-+        if (err)
-+                intent_release(nd->dentry, it);
++      if (err)
++              intent_release(nd->dentry, it);
        path_release(nd);
  return_err:
        return err;
                goto out;
 -      dentry = lookup_create(&nd, 0);
 +
-+        if (nd.dentry->d_inode->i_op->mknod2) {
-+                struct inode_operations *op = nd.dentry->d_inode->i_op;
-+                error = op->mknod2(nd.dentry->d_inode, 
-+                                   nd.last.name, 
-+                                   nd.last.len,
-+                                   mode, dev);
-+                /* the file system want to use normal vfs path now */
-+                if (error != -EOPNOTSUPP)
-+                        goto out2;
-+        }
-+        
++      if (nd.dentry->d_inode->i_op->mknod2) {
++              struct inode_operations *op = nd.dentry->d_inode->i_op;
++              error = op->mknod2(nd.dentry->d_inode, 
++                                 nd.last.name, 
++                                 nd.last.len,
++                                 mode, dev);
++              /* the file system want to use normal vfs path now */
++              if (error != -EOPNOTSUPP)
++                      goto out2;
++      }
++      
 +      dentry = lookup_create(&nd, 0, &it);
        error = PTR_ERR(dentry);
  
                if (error)
                        goto out;
 -              dentry = lookup_create(&nd, 1);
-+                if (nd.dentry->d_inode->i_op->mkdir2) {
-+                        struct inode_operations *op = nd.dentry->d_inode->i_op;
-+                        error = op->mkdir2(nd.dentry->d_inode, 
-+                                           nd.last.name, 
-+                                           nd.last.len,
-+                                           mode);
-+                        /* the file system want to use normal vfs path now */
-+                        if (error != -EOPNOTSUPP)
-+                                goto out2;
-+                }
++              if (nd.dentry->d_inode->i_op->mkdir2) {
++                      struct inode_operations *op = nd.dentry->d_inode->i_op;
++                      error = op->mkdir2(nd.dentry->d_inode, 
++                                         nd.last.name, 
++                                         nd.last.len,
++                                         mode);
++                      /* the file system want to use normal vfs path now */
++                      if (error != -EOPNOTSUPP)
++                              goto out2;
++              }
 +              dentry = lookup_create(&nd, 1, &it);
                error = PTR_ERR(dentry);
                if (!IS_ERR(dentry)) {
                        error = -EBUSY;
                        goto exit1;
        }
-+        if (nd.dentry->d_inode->i_op->rmdir2) {
-+                struct inode_operations *op = nd.dentry->d_inode->i_op;
-+                error = op->rmdir2(nd.dentry->d_inode, 
-+                                   nd.last.name, 
-+                                   nd.last.len);
-+                /* the file system want to use normal vfs path now */
-+                if (error != -EOPNOTSUPP)
-+                        goto exit1;
-+        }
++      if (nd.dentry->d_inode->i_op->rmdir2) {
++              struct inode_operations *op = nd.dentry->d_inode->i_op;
++              error = op->rmdir2(nd.dentry->d_inode, 
++                                 nd.last.name, 
++                                 nd.last.len);
++              /* the file system want to use normal vfs path now */
++              if (error != -EOPNOTSUPP)
++                      goto exit1;
++      }
        down(&nd.dentry->d_inode->i_sem);
 -      dentry = lookup_hash(&nd.last, nd.dentry);
 +      dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
        error = -EISDIR;
        if (nd.last_type != LAST_NORM)
                goto exit1;
-+        if (nd.dentry->d_inode->i_op->unlink2) {
-+                struct inode_operations *op = nd.dentry->d_inode->i_op;
-+                error = op->unlink2(nd.dentry->d_inode, 
-+                                   nd.last.name, 
-+                                   nd.last.len);
-+                /* the file system want to use normal vfs path now */
-+                if (error != -EOPNOTSUPP)
-+                        goto exit1;
-+        }
++      if (nd.dentry->d_inode->i_op->unlink2) {
++              struct inode_operations *op = nd.dentry->d_inode->i_op;
++              error = op->unlink2(nd.dentry->d_inode, 
++                                  nd.last.name, 
++                                  nd.last.len);
++              /* the file system want to use normal vfs path now */
++              if (error != -EOPNOTSUPP)
++                      goto exit1;
++      }
        down(&nd.dentry->d_inode->i_sem);
 -      dentry = lookup_hash(&nd.last, nd.dentry);
 +      dentry = lookup_hash_it(&nd.last, nd.dentry, &it);
                if (error)
                        goto out;
 -              dentry = lookup_create(&nd, 0);
-+                if (nd.dentry->d_inode->i_op->symlink2) {
-+                        struct inode_operations *op = nd.dentry->d_inode->i_op;
-+                        error = op->symlink2(nd.dentry->d_inode, 
-+                                             nd.last.name, 
-+                                             nd.last.len,
-+                                             from);
-+                        /* the file system want to use normal vfs path now */
-+                        if (error != -EOPNOTSUPP)
-+                                goto out2;
-+                }
++              if (nd.dentry->d_inode->i_op->symlink2) {
++                      struct inode_operations *op = nd.dentry->d_inode->i_op;
++                      error = op->symlink2(nd.dentry->d_inode, 
++                                           nd.last.name, 
++                                           nd.last.len,
++                                           from);
++                      /* the file system want to use normal vfs path now */
++                      if (error != -EOPNOTSUPP)
++                              goto out2;
++              }
 +              it.it_data = from;
 +              dentry = lookup_create(&nd, 0, &it);
                error = PTR_ERR(dentry);
                        dput(dentry);
                }
                up(&nd.dentry->d_inode->i_sem);
-+        out2:
++      out2:
                path_release(&nd);
 -out:
-+        out:
++      out:
                putname(to);
        }
        putname(from);
                if (old_nd.mnt != nd.mnt)
                        goto out_release;
 -              new_dentry = lookup_create(&nd, 0);
-+                if (nd.dentry->d_inode->i_op->link2) {
-+                        struct inode_operations *op = nd.dentry->d_inode->i_op;
-+                        error = op->link2(old_nd.dentry->d_inode, 
-+                                          nd.dentry->d_inode, 
-+                                          nd.last.name, 
-+                                          nd.last.len);
-+                        /* the file system want to use normal vfs path now */
-+                        if (error != -EOPNOTSUPP)
-+                                goto out_release;
-+                }
++              if (nd.dentry->d_inode->i_op->link2) {
++                      struct inode_operations *op = nd.dentry->d_inode->i_op;
++                      error = op->link2(old_nd.dentry->d_inode, 
++                                        nd.dentry->d_inode, 
++                                        nd.last.name, 
++                                        nd.last.len);
++                      /* the file system want to use normal vfs path now */
++                      if (error != -EOPNOTSUPP)
++                              goto out_release;
++              }
 +              it.it_op = IT_LINK2;
 +              new_dentry = lookup_create(&nd, 0, &it);
                error = PTR_ERR(new_dentry);
        if (newnd.last_type != LAST_NORM)
                goto exit2;
  
-+        if (old_dir->d_inode->i_op->rename2) {
-+                lock_kernel();
-+                error = old_dir->d_inode->i_op->rename2(old_dir->d_inode, 
-+                                                new_dir->d_inode,
-+                                                oldnd.last.name, 
-+                                                oldnd.last.len,
-+                                                newnd.last.name,
-+                                                newnd.last.len);
-+                unlock_kernel();
-+                /* the file system want to use normal vfs path now */
-+                if (error != -EOPNOTSUPP)
-+                        goto exit2;
-+        }
++      if (old_dir->d_inode->i_op->rename2) {
++              lock_kernel();
++              error = old_dir->d_inode->i_op->rename2(old_dir->d_inode, 
++                                              new_dir->d_inode,
++                                              oldnd.last.name, 
++                                              oldnd.last.len,
++                                              newnd.last.name,
++                                              newnd.last.len);
++              unlock_kernel();
++              /* the file system want to use normal vfs path now */
++              if (error != -EOPNOTSUPP)
++                      goto exit2;
++      }
 +
        double_lock(new_dir, old_dir);