Whamcloud - gitweb
merge b_ad (cleaned up a bit) into b_devel; entirely 2.5 compat fixes
authorpschwan <pschwan>
Mon, 19 May 2003 06:29:23 +0000 (06:29 +0000)
committerpschwan <pschwan>
Mon, 19 May 2003 06:29:23 +0000 (06:29 +0000)
lustre/include/linux/lustre_compat25.h [new file with mode: 0644]
lustre/kernel_patches/patches/export-truncate-2.5.63.patch [new file with mode: 0644]
lustre/kernel_patches/patches/ext3-2.5.63.patch [new file with mode: 0644]
lustre/kernel_patches/pc/export-truncate-2.5.63.pc [new file with mode: 0644]
lustre/kernel_patches/pc/ext3-2.5.63.pc [new file with mode: 0644]

diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h
new file mode 100644 (file)
index 0000000..fe08646
--- /dev/null
@@ -0,0 +1,95 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 2002 Cluster File Systems, Inc.
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _COMPAT25_H
+#define _COMPAT25_H
+
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#define KDEVT_VAL(dev, val)         dev.value = 0               
+#else
+#define KDEVT_VAL(dev, val)         dev = 0               
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define SIGNAL_MASK_LOCK(task, flags)         spin_lock_irqsave(                     \
+               &task->sighand->siglock, flags)
+# define SIGNAL_MASK_UNLOCK(task, flags)       spin_unlock_irqrestore(                \
+               &task->sighand->siglock, flags)
+#else
+# define SIGNAL_MASK_LOCK(task, flags)         spin_lock_irqsave(                     \
+               &task->sigmask_lock, flags)
+# define SIGNAL_MASK_UNLOCK(task, flags)       spin_unlock_irqrestore(                \
+               &task->sigmask_lock, flags)
+#endif
+
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define PGCACHE_WRLOCK(mapping)          write_lock(&mapping->page_lock)
+# define PGCACHE_WRUNLOCK(mapping)        write_unlock(&mapping->page_lock)
+#else
+# define PGCACHE_WRLOCK(mapping)          spin_lock(&pagecache_lock)
+# define PGCACHE_WRUNLOCK(mapping)        spin_unlock(&pagecache_lock)
+#endif
+
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define filemap_fdatasync(mapping)       filemap_fdatawrite(mapping)
+#endif
+
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define TryLockPage(page)                TestSetPageLocked(page)
+#endif
+
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define Page_Uptodate(page)              PageUptodate(page)
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define USERMODEHELPER(path, argv, envp) call_usermodehelper(path, argv, envp, 0)
+#else
+# define USERMODEHELPER(path, argv, envp) call_usermodehelper(path, argv, envp)
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define LL_CHECK_DIRTY(sb)              do { }while(0)
+#else
+# define LL_CHECK_DIRTY(sb)              ll_check_dirty(sb)
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define RECALC_SIGPENDING         recalc_sigpending()
+#else
+# define RECALC_SIGPENDING         recalc_sigpending(current)
+#endif
+
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+#define  rb_node_s rb_node
+#define  rb_root_s rb_root
+typedef struct rb_root_s rb_root_t;
+typedef struct rb_node_s rb_node_t;
+#endif
+
+#endif /* _COMPAT25_H */
diff --git a/lustre/kernel_patches/patches/export-truncate-2.5.63.patch b/lustre/kernel_patches/patches/export-truncate-2.5.63.patch
new file mode 100644 (file)
index 0000000..3d82572
--- /dev/null
@@ -0,0 +1,37 @@
+ include/linux/mm.h |    2 ++
+ mm/truncate.c      |    4 ++--
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+--- linux-2.5.63/include/linux/mm.h~export-truncate-2.5.63     Mon May  5 18:08:15 2003
++++ linux-2.5.63-root/include/linux/mm.h       Mon May  5 18:08:58 2003
+@@ -540,6 +540,8 @@ can_vma_merge(struct vm_area_struct *vma
+       else
+               return 0;
+ }
++/* truncate.c */
++extern void truncate_complete_page(struct page *);
+ /* filemap.c */
+ extern unsigned long page_unuse(struct page *);
+--- linux-2.5.63/mm/truncate.c~export-truncate-2.5.63  Mon May  5 18:09:50 2003
++++ linux-2.5.63-root/mm/truncate.c    Mon May  5 18:11:29 2003
+@@ -41,7 +41,7 @@ static inline void truncate_partial_page
+  * its lock, b) when a concurrent invalidate_inode_pages got there first and
+  * c) when tmpfs swizzles a page between a tmpfs inode and swapper_space.
+  */
+-static void
++void
+ truncate_complete_page(struct address_space *mapping, struct page *page)
+ {
+       if (page->mapping != mapping)
+@@ -56,7 +56,7 @@ truncate_complete_page(struct address_sp
+       remove_from_page_cache(page);
+       page_cache_release(page);       /* pagecache ref */
+ }
+-
++EXPORT_SYMBOL_GPL(truncate_complete_page);
+ /*
+  * This is for invalidate_inode_pages().  That function can be called at
+  * any time, and is not supposed to throw away dirty pages.  But pages can
+
+_
diff --git a/lustre/kernel_patches/patches/ext3-2.5.63.patch b/lustre/kernel_patches/patches/ext3-2.5.63.patch
new file mode 100644 (file)
index 0000000..fd28cd8
--- /dev/null
@@ -0,0 +1,150 @@
+ fs/ext3/inode.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ fs/ext3/super.c |    5 ++-
+ fs/ext3/xattr.c |    5 +++
+ fs/ext3/xattr.h |    2 -
+ 4 files changed, 92 insertions(+), 4 deletions(-)
+
+--- linux-2.5.63-nointent/fs/ext3/xattr.c~ext3-2.5.63  Fri Mar 21 18:47:19 2003
++++ linux-2.5.63-nointent-root/fs/ext3/xattr.c Fri Mar 21 18:47:19 2003
+@@ -1181,3 +1181,8 @@ exit_ext3_xattr(void)
+       ext3_xattr_unregister(EXT3_XATTR_INDEX_USER,
+                             &ext3_xattr_user_handler);
+ }
++
++EXPORT_SYMBOL(ext3_xattr_get);
++EXPORT_SYMBOL(ext3_xattr_set);
++EXPORT_SYMBOL(ext3_xattr_set_handle);
++
+--- linux-2.5.63-nointent/fs/ext3/inode.c~ext3-2.5.63  Fri Mar 21 18:47:19 2003
++++ linux-2.5.63-nointent-root/fs/ext3/inode.c Fri Mar 21 18:47:19 2003
+@@ -1019,7 +1019,7 @@ struct buffer_head *ext3_bread(handle_t 
+       *err = -EIO;
+       return NULL;
+ }
+-
++EXPORT_SYMBOL(ext3_bread);
+ static int walk_page_buffers( handle_t *handle,
+                               struct buffer_head *head,
+                               unsigned from,
+@@ -2870,3 +2870,85 @@ int ext3_change_inode_journal_flag(struc
+  * here, in ext3_aops_journal_start() to ensure that the forthcoming "see if we
+  * need to extend" test in ext3_prepare_write() succeeds.  
+  */
++
++/* for each block: 1 ind + 1 dind + 1 tind
++ * for each block: 3 bitmap blocks
++ * for each block: 3 group descriptor blocks
++ * i inode block
++ * 1 superblock
++ * 2 * EXT3_SINGLEDATA_TRANS_BLOCKS for the quote files
++ * ((1+1+1) * 3 * nblocks) + 1 + 1 + 2 * EXT3_SINGLEDATA_TRANS_BLOCKS
++ *
++ * XXX assuming:
++ * (1) fs logic block size == page size
++ * (2) ext3 in writeback mode
++ */
++static inline int ext3_san_write_trans_blocks(int nblocks)
++{
++      int ret;
++      
++      ret = (1 + 1 + 1) * 3 * nblocks + 1 + 1;
++
++#ifdef CONFIG_QUOTA
++      ret += 2 * EXT3_SINGLEDATA_TRANS_BLOCKS;
++#endif
++
++      return ret;
++}
++
++/* Alloc blocks for an inode, while don't create any buffer/page
++ * for data I/O; set the inode size if file is extended.
++ *
++ * @inode:    target inode
++ * @blocks:   array of logic block number
++ * @nblocks:  how many blocks need be alloced
++ * @newsize:  new filesize we should set
++ *
++ * return:    0 success, otherwise failed
++ *            (*blocks) contains physical block number alloced
++ *
++ * XXX this assume the fs block size == page size
++ */
++int ext3_prep_san_write(struct inode *inode, long *blocks,
++                      int nblocks, loff_t newsize)
++{
++      handle_t *handle;
++      struct buffer_head bh_tmp;
++      int needed_blocks;
++      int i, ret = 0, ret2;
++
++      needed_blocks = ext3_san_write_trans_blocks(nblocks);
++
++      lock_kernel();
++      handle = ext3_journal_start(inode, needed_blocks);
++      if (IS_ERR(handle)) {
++              unlock_kernel();
++              return PTR_ERR(handle);
++      }
++      unlock_kernel();
++
++      /* alloc blocks one by one */
++      for (i = 0; i < nblocks; i++) {
++              ret = ext3_get_block_handle(handle, inode, blocks[i],
++                                              &bh_tmp, 1, 1);
++              if (ret)
++                      break;
++
++              blocks[i] = bh_tmp.b_blocknr;
++      }
++
++      /* set inode size if needed */
++      if (!ret && (newsize > inode->i_size)) {
++              inode->i_size = newsize;
++              ext3_mark_inode_dirty(handle, inode);
++      }
++
++      lock_kernel();
++      ret2 = ext3_journal_stop(handle, inode);
++      unlock_kernel();
++
++      if (!ret)
++              ret = ret2;
++      return ret;
++}
++EXPORT_SYMBOL(ext3_prep_san_write);
+--- linux-2.5.63-nointent/fs/ext3/super.c~ext3-2.5.63  Fri Mar 21 18:47:19 2003
++++ linux-2.5.63-nointent-root/fs/ext3/super.c Fri Mar 21 18:47:19 2003
+@@ -1492,10 +1492,10 @@ static journal_t *ext3_get_dev_journal(s
+               printk(KERN_ERR "EXT3-fs: I/O error on journal device\n");
+               goto out_journal;
+       }
+-      if (ntohl(journal->j_superblock->s_nr_users) != 1) {
++      if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
+               printk(KERN_ERR "EXT3-fs: External journal has more than one "
+                                       "user (unsupported) - %d\n",
+-                      ntohl(journal->j_superblock->s_nr_users));
++                      be32_to_cpu(journal->j_superblock->s_nr_users));
+               goto out_journal;
+       }
+       EXT3_SB(sb)->journal_bdev = bdev;
+@@ -1703,6 +1703,7 @@ int ext3_force_commit(struct super_block
+       unlock_kernel();
+       return ret;
+ }
++EXPORT_SYMBOL(ext3_force_commit);
+ /*
+  * Ext3 always journals updates to the superblock itself, so we don't
+--- linux-2.5.63-nointent/fs/ext3/xattr.h~ext3-2.5.63  Fri Mar 21 18:47:19 2003
++++ linux-2.5.63-nointent-root/fs/ext3/xattr.h Fri Mar 21 18:47:19 2003
+@@ -5,7 +5,7 @@
+   (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
+ */
+-
++#include <linux/module.h>
+ #include <linux/config.h>
+ #include <linux/xattr.h>
+
+_
diff --git a/lustre/kernel_patches/pc/export-truncate-2.5.63.pc b/lustre/kernel_patches/pc/export-truncate-2.5.63.pc
new file mode 100644 (file)
index 0000000..3f61c00
--- /dev/null
@@ -0,0 +1,2 @@
+include/linux/mm.h
+mm/truncate.c
diff --git a/lustre/kernel_patches/pc/ext3-2.5.63.pc b/lustre/kernel_patches/pc/ext3-2.5.63.pc
new file mode 100644 (file)
index 0000000..b1e5de5
--- /dev/null
@@ -0,0 +1,4 @@
+fs/ext3/xattr.c
+fs/ext3/inode.c
+fs/ext3/super.c
+fs/ext3/xattr.h