2002-06-06 17:02:33

by Svetoslav Slavtchev

[permalink] [raw]
Subject: [2.5.20]newbee call for help getting lvm working

Hi ,
i was trying to get the patch from Anders Gustafsson working in 2.5.20,
but i'm getting by compilation:
....
lvm.c: In function `__update_hardsectsize':
lvm.c:2021: warning: implicit declaration of function `get_hardsect_size'
...
and by make modules_install:
...........
depmod: *** Unresolved symbols in
/lib/modules/2.5.20-dj3-lvm-xfs2/kernel/drivers/md/lvm-mod.o
depmod: get_hardsect_size
make: *** [_modinst_post] Error 1
............

it seems that this function is disapeared between 2.5.18 and 2.5.20
(the patch from Anders Gustafsson is against 2.5.18)

can smbd please help me to solve this issue

regards

svetljo

the patch :
http://www.linuxhq.com/kernel/v2.5/unofficial/v2.5.18/patches/lvm-cleanups-2.5.18.patch

and the correspondig text from drivers/md/lvm.c :
..............
static void __update_hardsectsize(kern_lv_t *lv) {
int le, e;
int max_hardsectsize = 0, hardsectsize;

for (le = 0; le < lv->lv_allocated_le; le++) {
hardsectsize = bdev_hardsect_size(lv->lv_current_pe[le].bdev);
if (hardsectsize == 0)
hardsectsize = 512;
if (hardsectsize > max_hardsectsize)
max_hardsectsize = hardsectsize;
}

/* only perform this operation on active snapshots */
if ((lv->lv_access & LV_SNAPSHOT) &&
(lv->lv_status & LV_ACTIVE)) {
for (e = 0; e < lv->lv_remap_end; e++) {
hardsectsize = get_hardsect_size(
lv->lv_block_exception[e].rdev_new);
if (hardsectsize == 0)
hardsectsize = 512;
if (hardsectsize > max_hardsectsize)
max_hardsectsize = hardsectsize;
}
}
}
............................


2002-06-08 22:29:54

by Anders Gustafsson

[permalink] [raw]
Subject: Re: [2.5.20]newbee call for help getting lvm working

On Thu, Jun 06, 2002 at 07:02:08PM +0200, Svetoslav Slavtchev wrote:
> Hi ,
> i was trying to get the patch from Anders Gustafsson working in 2.5.20,
> but i'm getting by compilation:
> ....
> lvm.c: In function `__update_hardsectsize':
> lvm.c:2021: warning: implicit declaration of function `get_hardsect_size'


[.. snip ..]

> /* only perform this operation on active snapshots */
> if ((lv->lv_access & LV_SNAPSHOT) &&
> (lv->lv_status & LV_ACTIVE)) {
> for (e = 0; e < lv->lv_remap_end; e++) {
> hardsectsize = get_hardsect_size(
> lv->lv_block_exception[e].rdev_new);

snapshotting doesn't work anyhow, so this block could be removed 'til
its unbroked.

below is a patch that does this. it is rater untested though as i
havn't be able to run it for more than a few minutes because my
cardbus networkcard doesn't work in 2.5.20

--

//anders/g

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[email protected], 2002-06-03 00:44:52+02:00, [email protected]
forwardport of my lvm sanitation work to 2.5.19


drivers/md/lvm.c | 36 +++++++++++++++++++++++++++++-------
include/linux/lvm.h | 2 +-
2 files changed, 30 insertions(+), 8 deletions(-)


diff -Nru a/drivers/md/lvm.c b/drivers/md/lvm.c
--- a/drivers/md/lvm.c Sun Jun 9 00:17:40 2002
+++ b/drivers/md/lvm.c Sun Jun 9 00:17:40 2002
@@ -214,7 +214,8 @@

#include <linux/hdreg.h>
#include <linux/stat.h>
-#include <linux/fs.h>
+
+#include <linux/buffer_head.h>
#include <linux/proc_fs.h>
#include <linux/blkdev.h>
#include <linux/genhd.h>
@@ -904,7 +905,7 @@
P_IOCTL("BLKFLSBUF\n");

fsync_bdev(inode->i_bdev);
- invalidate_buffers(inode->i_rdev);
+ invalidate_bdev(inode->i_bdev,0);
break;

case HDIO_GETGEO:
@@ -2003,7 +2004,7 @@


static void __update_hardsectsize(kern_lv_t *lv) {
- int le, e;
+ int le; /*, e;*/
int max_hardsectsize = 0, hardsectsize;

for (le = 0; le < lv->lv_allocated_le; le++) {
@@ -2014,6 +2015,7 @@
max_hardsectsize = hardsectsize;
}

+#ifdef BROKEN /* snapshotting broken */
/* only perform this operation on active snapshots */
if ((lv->lv_access & LV_SNAPSHOT) &&
(lv->lv_status & LV_ACTIVE)) {
@@ -2025,6 +2027,7 @@
max_hardsectsize = hardsectsize;
}
}
+#endif
}

/*
@@ -2371,8 +2374,14 @@

lv_ptr->lv_status &= ~LV_ACTIVE;

- /* invalidate the buffers */
- invalidate_buffers(lv_ptr->lv_kdev);
+ /* invalidate the buffers - FIXME! we might want the bdev in the lv */
+ {
+ struct block_device *bdev = bdget(kdev_t_to_nr(lv_ptr->lv_kdev));
+ if (bdev) {
+ invalidate_bdev(bdev,0);
+ bdput(bdev);
+ }
+ }

/* reset generic hd */
lvm_gendisk.part[minor(lv_ptr->lv_kdev)].start_sect = -1;
@@ -2946,9 +2955,22 @@
if (copy_from_user(&pv_flush_req, arg,
sizeof(pv_flush_req)) != 0)
return -EFAULT;
- /* FIXME! find kern__pv and use that? */
+
+ /* FIXME! should we really be allowed to flush any device here? */
+
fsync_dev(to_kdev_t(pv_flush_req.pv_dev));
- invalidate_buffers(to_kdev_t(pv_flush_req.pv_dev));
+
+ /* invalidate the buffers */
+ {
+ struct block_device *bdev = bdget(pv_flush_req.pv_dev);
+ if (bdev) {
+ invalidate_bdev(bdev,0);
+ bdput(bdev);
+ }
+ }
+
+// fsync_dev(to_kdev_t(pv_flush_req.pv_dev));
+// invalidate_buffers(to_kdev_t(pv_flush_req.pv_dev));

return 0;
}
diff -Nru a/include/linux/lvm.h b/include/linux/lvm.h
--- a/include/linux/lvm.h Sun Jun 9 00:17:40 2002
+++ b/include/linux/lvm.h Sun Jun 9 00:17:40 2002
@@ -405,7 +405,7 @@
uint pe_allocated;
uint pe_stale; /* for future use */
pe_disk_t *pe; /* HM */
- struct block_device *bd;
+ void *bd; /* a struct block_device has nothing to do in userspace */
char pv_uuid[UUID_LEN+1];
uint32_t pe_start; /* in sectors */
} user_pv_t;

===================================================================


This BitKeeper patch contains the following changesets:
1.405
## Wrapped with gzip_uu ##


begin 664 bkpatch860
M'XL(`(2"`CT``[5676_;-A1]-G_%'?*2I+5$4A^6G#GKVF1;T&TM,A380P&#
M%JE(L"RZ$FTGF/K?=RFIB>O:,!:LLH$KB??CW,.C*YW`AUI5XX$HI:KJ.W("
MO^G:C`>9RDLU5Z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
M@WN1G5UL!6WCZ#@X&MW.QCV#]/AX?/9`/SPA#Z9LAR3';X*&^9X7M$.2\6<,
M209#]EUFI-10:@/JOOT@V*<RG"H:5OAA5R]%HNS$[%Y..Q-S#P?/&9H^C>PS
MTYG!6N?2RMS.-!![X66BMAUD=I(A4&G'_!-<^RP]?C(FF4KF]6HQ2640TR@,
*R+\DG'SPL@H`````
`
end

2002-06-09 10:24:50

by Svetoslav Slavtchev

[permalink] [raw]
Subject: Re: [2.5.20]newbee call for help getting lvm working

Anders Gustafsson wrote:

>On Thu, Jun 06, 2002 at 07:02:08PM +0200, Svetoslav Slavtchev wrote:
>
>
>>Hi ,
>>i was trying to get the patch from Anders Gustafsson working in 2.5.20,
>>but i'm getting by compilation:
>>....
>>lvm.c: In function `__update_hardsectsize':
>>lvm.c:2021: warning: implicit declaration of function `get_hardsect_size'
>>
>>
>
>
>[.. snip ..]
>
>
>
>> /* only perform this operation on active snapshots */
>> if ((lv->lv_access & LV_SNAPSHOT) &&
>> (lv->lv_status & LV_ACTIVE)) {
>> for (e = 0; e < lv->lv_remap_end; e++) {
>> hardsectsize = get_hardsect_size(
>>lv->lv_block_exception[e].rdev_new);
>>
>>
>
>snapshotting doesn't work anyhow, so this block could be removed 'til
>its unbroked.
>
thanks, i had a similar solution , but i wasn't shure
i'll try it with a 2.5.20-dj3 or dj4

--- linux-2.5.18/drivers/md/lvm.c 2002-06-04 17:25:40.000000000 +0200
+++ linux-2.5.20-dj3-lvm-xfs-w3/drivers/md/lvm.c 2002-06-08
19:08:41.000000000 +0200
@@ -216,6 +216,7 @@
#include <linux/stat.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
+#include <linux/buffer_head.h> /* for invalidate_buffers */
#include <linux/blkdev.h>
#include <linux/genhd.h>
#include <linux/devfs_fs_kernel.h>

@@ -2014,17 +2015,23 @@
max_hardsectsize = hardsectsize;
}

+
+ /* FROM ME SVETLJO, otherweise it doesnt compile
+ * get_hardsect_size had disapeared in 2.5.18
+ */
/* only perform this operation on active snapshots */
- if ((lv->lv_access & LV_SNAPSHOT) &&
+/* if ((lv->lv_access & LV_SNAPSHOT) &&
(lv->lv_status & LV_ACTIVE)) {
for (e = 0; e < lv->lv_remap_end; e++) {
- hardsectsize = get_hardsect_size(
lv->lv_block_exception[e].rdev_new);
+ hardsectsize = get_hardsect_size(
lv->lv_block_exception[e].rdev_new);
if (hardsectsize == 0)
hardsectsize = 512;
if (hardsectsize > max_hardsectsize)
max_hardsectsize = hardsectsize;
}
}
+*/
+
}

/*