Whamcloud - gitweb
More from b_devel->b_orphan merge.
authoradilger <adilger>
Wed, 28 May 2003 17:32:11 +0000 (17:32 +0000)
committeradilger <adilger>
Wed, 28 May 2003 17:32:11 +0000 (17:32 +0000)
  DEVEL_ORPHAN_UPDATE_PARENT_20030522->DEVEL_ORPHAN_UPDATE_PARENT_20030528

lustre/kernel_patches/patches/dev_read_only_2.4.20-rh.patch [new file with mode: 0644]
lustre/kernel_patches/patches/exports_2.4.20-rh-hp.patch [new file with mode: 0644]
lustre/kernel_patches/patches/ext3-san-2.4.20.patch [new file with mode: 0644]

diff --git a/lustre/kernel_patches/patches/dev_read_only_2.4.20-rh.patch b/lustre/kernel_patches/patches/dev_read_only_2.4.20-rh.patch
new file mode 100644 (file)
index 0000000..55057d9
--- /dev/null
@@ -0,0 +1,77 @@
+
+
+
+ drivers/block/blkpg.c  |   35 +++++++++++++++++++++++++++++++++++
+ drivers/block/loop.c   |    3 +++
+ drivers/ide/ide-disk.c |    5 ++++-
+ 3 files changed, 42 insertions(+), 1 deletion(-)
+
+--- rh-2.4.20/drivers/block/blkpg.c~dev_read_only_2.4.20       2003-04-11 14:05:03.000000000 +0800
++++ rh-2.4.20-root/drivers/block/blkpg.c       2003-04-12 13:11:31.000000000 +0800
+@@ -297,3 +297,38 @@ int blk_ioctl(kdev_t dev, unsigned int c
+ }
+ EXPORT_SYMBOL(blk_ioctl);
++
++#define NUM_DEV_NO_WRITE 16
++static int dev_no_write[NUM_DEV_NO_WRITE];
++
++/*
++ * Debug code for turning block devices "read-only" (will discard writes
++ * silently).  This is for filesystem crash/recovery testing.
++ */
++void dev_set_rdonly(kdev_t dev, int no_write)
++{
++      if (dev) {
++              printk(KERN_WARNING "Turning device %s read-only\n",
++                     bdevname(dev));
++              dev_no_write[no_write] = 0xdead0000 + dev;
++      }
++}
++
++int dev_check_rdonly(kdev_t dev) {
++      int i;
++
++      for (i = 0; i < NUM_DEV_NO_WRITE; i++) {
++              if ((dev_no_write[i] & 0xffff0000) == 0xdead0000 &&
++                  dev == (dev_no_write[i] & 0xffff))
++                      return 1;
++      }
++      return 0;
++}
++
++void dev_clear_rdonly(int no_write) {
++      dev_no_write[no_write] = 0;
++}
++
++EXPORT_SYMBOL(dev_set_rdonly);
++EXPORT_SYMBOL(dev_check_rdonly);
++EXPORT_SYMBOL(dev_clear_rdonly);
+--- rh-2.4.20/drivers/block/loop.c~dev_read_only_2.4.20        2003-04-11 14:05:08.000000000 +0800
++++ rh-2.4.20-root/drivers/block/loop.c        2003-04-12 13:11:31.000000000 +0800
+@@ -491,6 +491,9 @@ static int loop_make_request(request_que
+       spin_unlock_irq(&lo->lo_lock);
+       if (rw == WRITE) {
++              if (dev_check_rdonly(rbh->b_rdev))
++                      goto err;
++
+               if (lo->lo_flags & LO_FLAGS_READ_ONLY)
+                       goto err;
+       } else if (rw == READA) {
+--- rh-2.4.20/drivers/ide/ide-disk.c~dev_read_only_2.4.20      2003-04-11 14:04:53.000000000 +0800
++++ rh-2.4.20-root/drivers/ide/ide-disk.c      2003-04-12 13:14:48.000000000 +0800
+@@ -381,7 +381,10 @@ static ide_startstop_t do_rw_disk (ide_d
+       if (IS_PDC4030_DRIVE)
+               return promise_rw_disk(drive, rq, block);
+ #endif /* CONFIG_BLK_DEV_PDC4030 */
+-
++      if (rq->cmd == WRITE && dev_check_rdonly(rq->rq_dev)) {
++              ide_end_request(1, HWGROUP(drive));
++              return ide_stopped;
++      }
+       if (IDE_CONTROL_REG)
+               hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
+
+_
diff --git a/lustre/kernel_patches/patches/exports_2.4.20-rh-hp.patch b/lustre/kernel_patches/patches/exports_2.4.20-rh-hp.patch
new file mode 100644 (file)
index 0000000..feaeec6
--- /dev/null
@@ -0,0 +1,53 @@
+ fs/ext3/Makefile   |    2 ++
+ fs/ext3/super.c    |    2 +-
+ include/linux/fs.h |    1 +
+ kernel/ksyms.c     |    4 ++++
+ 4 files changed, 8 insertions(+), 1 deletion(-)
+
+--- linux/fs/ext3/Makefile~exports_2.4.20      Wed Apr  9 10:07:14 2003
++++ linux-mmonroe/fs/ext3/Makefile     Wed Apr  9 10:19:53 2003
+@@ -9,6 +9,8 @@
+ O_TARGET := ext3.o
++export-objs :=        super.o inode.o
++
+ obj-y    := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
+               ioctl.o namei.o super.o symlink.o
+ obj-m    := $(O_TARGET)
+--- linux/fs/ext3/super.c~exports_2.4.20       Wed Apr  9 10:07:14 2003
++++ linux-mmonroe/fs/ext3/super.c      Wed Apr  9 10:19:53 2003
+@@ -1769,7 +1769,7 @@ static void __exit exit_ext3_fs(void)
+       unregister_filesystem(&ext3_fs_type);
+ }
+-EXPORT_NO_SYMBOLS;
++EXPORT_SYMBOL(ext3_bread);
+ MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
+ MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
+--- linux/include/linux/fs.h~exports_2.4.20    Wed Apr  9 10:07:14 2003
++++ linux-mmonroe/include/linux/fs.h   Wed Apr  9 10:19:53 2003
+@@ -1020,6 +1020,7 @@ extern int unregister_filesystem(struct 
+ extern struct vfsmount *kern_mount(struct file_system_type *);
+ extern int may_umount(struct vfsmount *);
+ extern long do_mount(char *, char *, char *, unsigned long, void *);
++struct vfsmount *do_kern_mount(const char *type, int flags, char *name, void *data);
+ #define kern_umount mntput
+--- linux/kernel/ksyms.c~exports_2.4.20        Wed Apr  9 10:07:14 2003
++++ linux-mmonroe/kernel/ksyms.c       Wed Apr  9 10:19:53 2003
+@@ -308,6 +308,10 @@ EXPORT_SYMBOL(dcache_dir_fsync);
+ EXPORT_SYMBOL(dcache_readdir);
+ EXPORT_SYMBOL(dcache_dir_ops);
++/* lustre */
++EXPORT_SYMBOL(pagecache_lock_cacheline);
++EXPORT_SYMBOL(do_kern_mount);
++
+ /* for stackable file systems (lofs, wrapfs, cryptfs, etc.) */
+ EXPORT_SYMBOL(default_llseek);
+ EXPORT_SYMBOL(dentry_open);
+
+_
diff --git a/lustre/kernel_patches/patches/ext3-san-2.4.20.patch b/lustre/kernel_patches/patches/ext3-san-2.4.20.patch
new file mode 100644 (file)
index 0000000..148f4e3
--- /dev/null
@@ -0,0 +1,117 @@
+ fs/ext3/ext3-exports.c |    9 ++++-
+ fs/ext3/inode.c        |   81 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 89 insertions(+), 1 deletion(-)
+
+--- linux/fs/ext3/inode.c~ext3-san-2.4.20-hp   Tue Apr 29 11:01:52 2003
++++ linux-mmonroe/fs/ext3/inode.c      Tue Apr 29 11:01:53 2003
+@@ -2734,3 +2734,84 @@ 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);
++              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;
++}
+--- linux/fs/ext3/ext3-exports.c~ext3-san-2.4.20-hp    Tue Apr 29 11:01:51 2003
++++ linux-mmonroe/fs/ext3/ext3-exports.c       Tue Apr 29 11:07:19 2003
+@@ -1,9 +1,15 @@
+ #include <linux/config.h>
+ #include <linux/module.h>
+-#include <linux/ext3_fs.h>
++#include <linux/fs.h>
++#include <linux/locks.h>
++#include <linux/slab.h>
+ #include <linux/ext3_jbd.h>
++#include <linux/ext3_fs.h>
+ #include <linux/ext3_xattr.h>
++int ext3_prep_san_write(struct inode *inode, long *blocks,
++                      int nblocks, loff_t newsize);
++
+ EXPORT_SYMBOL(ext3_force_commit);
+ EXPORT_SYMBOL(ext3_bread);
+ EXPORT_SYMBOL(ext3_xattr_register);
+@@ -11,3 +17,4 @@ EXPORT_SYMBOL(ext3_xattr_unregister);
+ EXPORT_SYMBOL(ext3_xattr_get);
+ EXPORT_SYMBOL(ext3_xattr_list);
+ EXPORT_SYMBOL(ext3_xattr_set);
++EXPORT_SYMBOL(ext3_prep_san_write);
+
+_