From d8a5c5362cb37896c8ba0ccc84f2bfe15febb9dd Mon Sep 17 00:00:00 2001 From: mmex Date: Mon, 19 May 2003 17:07:44 +0000 Subject: [PATCH] - Update kernel patchs to work on hp4_pnnl6. Note that a new branch of dev_read_only was made. dev_read_only_hp can not longer be used because multiple other series (not the hp ones) now use it and regularly update it in conflicting ways. --- .../patches/dev_read_only_hp_2.4.20.patch | 77 ++++++++++++++++++++++ .../kernel_patches/pc/dev_read_only_hp_2.4.20.pc | 3 + 2 files changed, 80 insertions(+) create mode 100644 lustre/kernel_patches/patches/dev_read_only_hp_2.4.20.patch create mode 100644 lustre/kernel_patches/pc/dev_read_only_hp_2.4.20.pc diff --git a/lustre/kernel_patches/patches/dev_read_only_hp_2.4.20.patch b/lustre/kernel_patches/patches/dev_read_only_hp_2.4.20.patch new file mode 100644 index 0000000..60081db --- /dev/null +++ b/lustre/kernel_patches/patches/dev_read_only_hp_2.4.20.patch @@ -0,0 +1,77 @@ + drivers/block/blkpg.c | 36 ++++++++++++++++++++++++++++++++++++ + drivers/block/loop.c | 3 +++ + drivers/ide/ide-disk.c | 4 ++++ + 3 files changed, 43 insertions(+) + +--- linux/drivers/block/blkpg.c~dev_read_only_hp_2.4.20 Mon May 19 07:07:52 2003 ++++ linux-mmonroe/drivers/block/blkpg.c Mon May 19 07:37:22 2003 +@@ -310,6 +310,42 @@ 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); ++ ++ + /** + * get_last_sector() + * +--- linux/drivers/block/loop.c~dev_read_only_hp_2.4.20 Thu Nov 28 15:53:12 2002 ++++ linux-mmonroe/drivers/block/loop.c Mon May 19 07:28:29 2003 +@@ -474,6 +474,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) { +--- linux/drivers/ide/ide-disk.c~dev_read_only_hp_2.4.20 Thu Nov 28 15:53:13 2002 ++++ linux-mmonroe/drivers/ide/ide-disk.c Mon May 19 07:28:29 2003 +@@ -558,6 +558,10 @@ static ide_startstop_t lba_48_rw_disk (i + */ + static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block) + { ++ if (rq->cmd == WRITE && dev_check_rdonly(rq->rq_dev)) { ++ ide_end_request(1, HWGROUP(drive)); ++ return ide_stopped; ++ } + if (IDE_CONTROL_REG) + OUT_BYTE(drive->ctl,IDE_CONTROL_REG); + + +_ diff --git a/lustre/kernel_patches/pc/dev_read_only_hp_2.4.20.pc b/lustre/kernel_patches/pc/dev_read_only_hp_2.4.20.pc new file mode 100644 index 0000000..4760ad1 --- /dev/null +++ b/lustre/kernel_patches/pc/dev_read_only_hp_2.4.20.pc @@ -0,0 +1,3 @@ +drivers/block/blkpg.c +drivers/block/loop.c +drivers/ide/ide-disk.c -- 1.8.3.1