public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@turbolinux.com>
To: Rik van Riel <riel@conectiva.com.br>
Cc: mauelshagen@sistina.com, linux-kernel@vger.kernel.org
Subject: Re: LVM snapshotting broken?
Date: Thu, 26 Oct 2000 18:55:45 -0600 (MDT)	[thread overview]
Message-ID: <200010270055.e9R0tkH27477@webber.adilger.net> (raw)
In-Reply-To: <Pine.LNX.4.21.0010261632440.15696-100000@duckman.distro.conectiva> "from Rik van Riel at Oct 26, 2000 04:36:37 pm"

Rik writes:
> it looks like the LVM snapshotting in 2.4 doesn't allow you
> to create snapshots from anything else than the _first_ LV
> in the VG...
> 
> It looks like somewhere in either the utilities or the
> kernel, the argument of which LV to snapshot gets mangled...
> Oh, I'm using version 0.8final of the LVM utities.

One thing to notice is that the 0.8final tools have several bugs in them.
Most of these bugs are fixed in my user tools SRPM at:
ftp://ftp.stelias.com/pub/adilger/

If you are compiling on a 2.4 system, you need to patch the lvm.h file
with the following patch, so that you can use the same header in kernel
and user space.  One of the problems with snapshots is that there is a

char __unused

field added in the 2.4 kernel sources that is not in the header for the
user tools, and this is only affecting snapshots, so it is best to use
the same header for both.  This patch should probably be added to the
stock 2.4 kernel...

Give my user tools a try (if you aren't doing so already), to ensure
you aren't hitting a known bug, and the lvm.h patch so you aren't
having trouble with struct parsing between kernel and user space.

Cheers, Andreas
------------ patch to make 2.4 lvm.h usable from LVM user tools ---------
--- linux-2.4.0-test10-pre5/include/linux/lvm.h	Thu Oct 26 18:43:42 2000
+++ linux/include/linux/lvm.h	Thu Oct 26 18:39:13 2000
@@ -49,6 +50,8 @@
  *    08/12/1999 - changed LVM_LV_SIZE_MAX macro to reflect current 1TB limit
  *    01/01/2000 - extended lv_v2 core structure by wait_queue member
  *    12/02/2000 - integrated Andrea Arcagnelli's snapshot work
+ *    18/02/2000 - seperated user and kernel space parts by 
+ *                 #ifdef them with __KERNEL__
  *
  */
 
@@ -56,7 +59,9 @@
 #ifndef _LVM_H_INCLUDE
 #define _LVM_H_INCLUDE
 
-#define	_LVM_H_VERSION	"LVM 0.8final (15/2/2000)"
+#define	_LVM_H_VERSION	"LVM 0.8final (22/02/2000)"
+
+#include <linux/version.h>
 
 /*
  * preprocessor definitions
@@ -64,8 +69,9 @@
 /* if you like emergency reset code in the driver */
 #define	LVM_TOTAL_RESET
 
+#ifdef __KERNEL__
 #define LVM_GET_INODE
-#undef	LVM_HD_NAME
+#define	LVM_HD_NAME
 
 /* lots of debugging output (see driver source)
    #define DEBUG_LVM_GET_INFO
@@ -80,20 +86,19 @@
    #define DEBUG_KFREE
  */
 
-#include <linux/version.h>
-
-#ifndef __KERNEL__
-#define ____NOT_KERNEL____
+#include <linux/kdev_t.h>
+#include <linux/list.h>
+#else
 #define __KERNEL__
-#endif
 #include <linux/kdev_t.h>
-#ifdef ____NOT_KERNEL____
-#undef ____NOT_KERNEL____
+#include <linux/list.h>
 #undef __KERNEL__
-#endif
+#endif /* #ifndef __KERNEL__ */
 
+#include <asm/types.h>
 #include <linux/major.h>
 
+#ifdef __KERNEL__
 #if LINUX_VERSION_CODE >= KERNEL_VERSION ( 2, 3 ,0)
 #include <linux/spinlock.h>
 #else
@@ -101,6 +106,8 @@
 #endif
 
 #include <asm/semaphore.h>
+#endif /* #ifdef __KERNEL__ */
+
 #include <asm/page.h>
 
 #if !defined ( LVM_BLK_MAJOR) || !defined ( LVM_CHAR_MAJOR)
@@ -125,7 +132,7 @@
 #define pv_disk_t pv_disk_v1_t
 #define lv_disk_t lv_disk_v1_t
 #define vg_disk_t vg_disk_v1_t
-#define lv_exception_t lv_v2_exception_t
+#define lv_block_exception_t lv_block_exception_v1_t
 #endif
 
 
@@ -220,7 +227,7 @@
                                     LVM_TIMESTAMP_DISK_SIZE)
 
 /* now for the dynamically calculated parts of the VGDA */
-#define	LVM_LV_DISK_OFFSET(a, b) ( (a)->lv_on_disk.base + sizeof ( lv_t) * b)
+#define	LVM_LV_DISK_OFFSET(a, b) ( (a)->lv_on_disk.base + sizeof ( lv_disk_t) * b)
 #define	LVM_DISK_SIZE(pv) 	 ( (pv)->pe_on_disk.base + \
                                    (pv)->pe_on_disk.size)
 #define	LVM_PE_DISK_OFFSET(pe, pv)	( pe * pv->pe_size + \
@@ -386,8 +392,7 @@
     kdev_t rdev_org;
     ulong rsector_new;
     kdev_t rdev_new;
-} lv_block_exception_t;
-
+} lv_block_exception_v1_t;
 
 /* disk stored pe information */
 typedef struct
@@ -597,10 +558,14 @@
     __u32 lv_remap_end;
     __u32 lv_chunk_size;
     __u32 lv_snapshot_minor;
+#ifdef __KERNEL__
     struct kiobuf * lv_iobuf;
     struct semaphore lv_snapshot_sem;
     struct list_head * lv_snapshot_hash_table;
-    unsigned long lv_snapshot_hash_mask;
+    ulong  lv_snapshot_hash_mask;
+#else
+    char  dummy[200];
+#endif
 } lv_v2_t;
 
 /* disk */
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

      parent reply	other threads:[~2000-10-27  0:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-26 18:36 LVM snapshotting broken? Rik van Riel
2000-10-26 20:34 ` Rik van Riel
2000-10-26 22:44   ` Andrea Arcangeli
2000-10-26 23:10     ` Marcelo Tosatti
2000-10-27  0:22       ` Andrea Arcangeli
2000-10-27 13:32     ` Rik van Riel
2000-10-27 13:44       ` Andrea Arcangeli
2000-10-27 13:55         ` Rik van Riel
2000-10-27 14:19           ` Andrea Arcangeli
2000-10-28 20:02           ` Heinz J. Mauelshagen
2000-10-28 22:07             ` Rik van Riel
2000-10-26 23:37 ` Heinz J. Mauelshagen
2000-10-26 23:53   ` [linux-lvm] " Christoph Hellwig
2000-10-27  1:28     ` Christoph Hellwig
2000-10-27  0:55 ` Andreas Dilger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200010270055.e9R0tkH27477@webber.adilger.net \
    --to=adilger@turbolinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mauelshagen@sistina.com \
    --cc=riel@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox