--- linux-2.1.105/kernel/ksyms.c Fri May 8 09:23:41 1998 +++ linux/kernel/ksyms.c Wed May 27 02:00:46 1998 @@ -86,6 +86,18 @@ }; #endif +/* Test Heinz Mauelshagen */ +/* Next lines should go away from here */ +#define CONFIG_BLK_DEV_LVM +#ifdef CONFIG_BLK_DEV_LVM + extern int (*lvm_map_ptr) ( int, kdev_t *, unsigned long *, + unsigned long, int); +#endif +/* Ende Test Heinz Mauelshagen */ + +#ifdef CONFIG_BLK_DEV_LVM +EXPORT_SYMBOL(lvm_map_ptr); +#endif #ifdef CONFIG_KMOD EXPORT_SYMBOL(request_module); --- linux-2.1.105/drivers/block/ll_rw_blk.c Sat May 9 03:12:30 1998 +++ linux/drivers/block/ll_rw_blk.c Wed May 27 02:00:46 1998 @@ -24,6 +24,17 @@ #include + +/* Logical Volume Manager (LVM) */ +/* Next 2 lines should go to /usr/src/linux/include/linux/lvm.h */ +#define CONFIG_BLK_DEV_LVM +#define LVM_MAJOR 42 +#ifdef CONFIG_BLK_DEV_LVM + int ( *lvm_map_ptr) ( int, kdev_t *, unsigned long *, + unsigned long, int) = NULL; +#endif +/* End LVM */ + /* * The request-struct contains all necessary data * to load a nr of sectors into memory @@ -452,7 +463,8 @@ if (!req) { /* MD and loop can't handle plugging without deadlocking */ if (major != MD_MAJOR && major != LOOP_MAJOR && - major != DDV_MAJOR && major != NBD_MAJOR) + major != DDV_MAJOR && major != NBD_MAJOR && + major != LVM_MAJOR) plug_device(blk_dev + major); /* is atomic */ } else switch (major) { case IDE0_MAJOR: /* same as HD_MAJOR */ @@ -594,9 +606,33 @@ /* Md remaps blocks now */ bh[i]->b_rdev = bh[i]->b_dev; bh[i]->b_rsector=bh[i]->b_blocknr*(bh[i]->b_size >> 9); +#ifdef CONFIG_BLK_DEV_LVM + major = MAJOR(bh[i]->b_dev); + if ( major == LVM_MAJOR) { + int ret; + + if ( lvm_map_ptr == NULL) { + printk ( KERN_ERR + "Bad lvm_map_ptr in ll_rw_block\n"); + goto sorry; + } + if ( ( ret = ( lvm_map_ptr) ( MINOR ( bh[i]->b_dev), + &bh[i]->b_rdev, + &bh[i]->b_rsector, + bh[i]->b_size >> 9, + rw)) != 0) { + printk ( KERN_ERR + "Bad lvm_map in ll_rw_block\n"); + goto sorry; + } + /* remap major too ... */ + major = MAJOR(bh[i]->b_rdev); + } +#endif #ifdef CONFIG_BLK_DEV_MD if (major==MD_MAJOR && - md_map (MINOR(bh[i]->b_dev), &bh[i]->b_rdev, + /* changed v to allow LVM to remap */ + md_map (MINOR(bh[i]->b_rdev), &bh[i]->b_rdev, &bh[i]->b_rsector, bh[i]->b_size >> 9)) { printk (KERN_ERR "Bad md_map in ll_rw_block\n"); @@ -615,8 +651,10 @@ if (bh[i]) { set_bit(BH_Req, &bh[i]->b_state); #ifdef CONFIG_BLK_DEV_MD - if (MAJOR(bh[i]->b_dev) == MD_MAJOR) { - md_make_request(MINOR (bh[i]->b_dev), rw, bh[i]); + /* changed v to allow LVM to remap */ + if (MAJOR(bh[i]->b_rdev) == MD_MAJOR) { + /* changed for LVM to remap v */ + md_make_request(MINOR (bh[i]->b_rdev), rw, bh[i]); continue; } #endif @@ -677,9 +715,32 @@ { rdev = dev; rsector = b[i] * (buffersize >> 9); +#ifdef CONFIG_BLK_DEV_LVM + major = MAJOR ( dev); + if ( major == LVM_MAJOR) { + int ret; + + if ( lvm_map_ptr == NULL) { + printk ( KERN_ERR + "Bad lvm_map_ptr in ll_rw_swap_file\n"); + return; + } + if ( ( ret = ( lvm_map_ptr) ( MINOR ( dev), &rdev, + &rsector, + buffersize >> 9, + rw)) != 0) { + printk ( KERN_ERR + "Bad lvm_map in ll_rw_swap_file\n"); + return; + } + /* remap major too ... */ + major = MAJOR ( rdev); + } +#endif #ifdef CONFIG_BLK_DEV_MD if (major==MD_MAJOR && - md_map (MINOR(dev), &rdev, + /* changed v to allow LVM to remap */ + md_map (MINOR(rdev), &rdev, &rsector, buffersize >> 9)) { printk (KERN_ERR "Bad md_map in ll_rw_swap_file\n");