[linux-lvm] PATCH: volume drivers in ll_rw_block

Klaus Strebel stb at ep-ag.com
Tue Aug 10 10:09:09 UTC 1999


David Teigland wrote:
> This eliminates repetitious driver-specific code and provides a clean way
> to make MD, LVM and Pool modular.  MD devices can currently be used within
> LVM, but this patch, in a general sense, imposes no limit on the number or
> order in which volumes are built on one another.
> 
> Unaddressed by this method is more than one stacked volume driver using
> makerq_fn.  If stacking volume drivers, only the bottom one can use a
> make_request function.
> 
> The patch below to 2.2.10+raid0145 implements the generic mapping. Two
> other patches can be found at ftp://globalfilesystem.org/pub/GFS/patches/
> 
>  - modular_md-2.2.10 adds module support for MD using this method.
>  - lvm_map-0.7 allows LVM to be used with generic_map.

Hi all,

the lvm_map-0.7 lacks one thing in ll_rw_blk.c, i show below in
generic_map-2.2.10-raid what and where.

> --------------------Cut Here---------------- generic_map-2.2.10-raid
> 
> diff -urN linux-raid-1/drivers/block/ll_rw_blk.c linux-raid-2/drivers/block/ll_rw_blk.c
> --- linux-raid-1/drivers/block/ll_rw_blk.c      Mon Aug 16 14:42:42 1999
> +++ linux-raid-2/drivers/block/ll_rw_blk.c      Mon Aug 16 14:46:08 1999
...
> @@ -619,15 +622,17 @@
>                 /* 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);
-#if defined CONFIG_BLK_DEV_LVM || defined CONFIG_BLK_DEV_LVM_MODULE
-                major = MAJOR(bh[i]->b_dev);
-                if ( major == LVM_BLK_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 (bh[i]->b_dev, &bh[i]->b_rdev,
> -                           &bh[i]->b_rsector, bh[i]->b_size >> 9)) {
> -                       printk (KERN_ERR
> -                               "Bad md_map in ll_rw_block\n");
> -                       goto sorry;
> -               }
> -#endif
> +
> +               tdev = dev;
> +               while (tdev->map_fn) {
> +                       if (tdev->map_fn (bh[i]->b_rdev, &bh[i]->b_rdev,
> +                                         &bh[i]->b_rsector,
> +                                         bh[i]->b_size >> 9)) {
> +                              printk (KERN_ERR "Bad map in ll_rw_block\n");
> +                              goto sorry;
> +                       }
> +                       tdev = blk_dev + MAJOR(bh[i]->b_rdev);
> +               }
>         }
> 
>         if ((rw == WRITE || rw == WRITEA) && is_read_only(bh[0]->b_dev)) {

or : in my 1st effort i just did this :

-#if defined CONFIG_BLK_DEV_LVM || defined CONFIG_BLK_DEV_LVM_MODULE
+#if defined CONFIG_BLK_DEV_LVM_NEVER || defined
CONFIG_BLK_DEV_LVM_MODULE_NEVER

at that place in ll_rw_block. Whithout it, you´ll get the "Bad lvm_map
in ll_rw_block" when fsck tries to read the superblock!

Ciao
Klaus

BTW: I use lvm since release 0.5alpha and had (almost ;-)) never any
problems with it!
-- 
Klaus Strebel
stb at ep-ag.com
EIGNER + PARTNER AG   - The Engineering Warehouse Company -
<http://www.ep-ag.com>
-----------------------------------------------------------------------



More information about the linux-lvm mailing list