Re: Re: problems compiling enbd-2.4.32pre and fr1-2.16 under kernel 2.6.8.1

edward mzj <[email protected]>
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
hi peter
> Oh, that's an old one. It was supposed to be *rdevp. It's been fixed in
> FR1 patches for a while.

it seems the source packages i downloaded are outdated.
so i checked you ftp and re-downloaded them.

> The latest FR1 patch should have both things in.

yes. i've checked to make sure.

> This comes from your compiler not doing division adequately.

i don't think so.

> Fix compiler! It probably can't divide by a variable value. But anyway,
> why isn't it foxed by the line before?
> 
>         currspeed = (j-mddev->resync_mark_cnt)/2/((jiffies-mddev->resync_mark)/HZ +1)+1

Oh, the code in my md.c is a little bit different. the code i saw is:

currspeed = ((unsigned long)(j-mddev->resync_mark_cnt))/2/((jiffies-mddev->resync_mark)/HZ +1) +1;

i did no modify that line, so it's directly from your patch(line 2009, 
linux-2.6.8.1.patch).

there is a cast which convert "j-mddev->resync_mark_cnt" from 64-bit 
unsigned integer to a 32-bit unsigned integer. so the division is a 
nomal 32-bit division and no 64-bit division code, __udivdi3, is needed.

i'm also wondering whether the cast should be there.

and the later one. there is no type cast. that's 64-bit division so
the __udvidi3 comes in.

> 
> So split the calculation up a bit and see if you can help the compiler

yes, i've tried to split the code to troubleshooting it and the 
error went to line 3706.

... Omitted ...
#define _EJ_UDIVDI3_DEBUG_ 

#ifdef _EJ_UDIVDI3_DEBUG_
	unsigned ___tmp1, ___tmp2;
	sector_t ___tmp3;
#endif /*_EJ_UDIVDI3_DEBUG_*/

... Omitted ...

#ifdef _EJ_UDIVDI3_DEBUG_
	___tmp1 = ( jiffies - mddev->resync_mark ) / HZ;
	___tmp2 = 2 * ( ___tmp1 + 1 );
	___tmp3 = j - mddev->resync_mark_cnt - atomic_read(&md_throttle[mddev->md_minor]);
	realspeed = ___tmp3 / ___tmp2 + 1; /* line 3706 */
	/* realspeed = sector_div( ___tmp3, ___tmp2 ) + 1; */
#else
	realspeed = (j - mddev->resync_mark_cnt -
atomic_read(&md_throttle[mddev->md_minor]))/2/((jiffies-mddev->resync_mark)/HZ +1) +1;
#endif /*_EJ_UDIVDI3_DEBUG_ */ 
... Omitted ...

> out. What compiler is it?

actually, i tried to compile the code under CentOS 4 and Debian
woody (3.0r4) and both produced the undefined symbol __udivdi3
error. the gcc version is:

[root@CentOS4-2:/usr/src]gcc -v
... Omitted ...
gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
[root@CentOS4-2:/usr/src]

[root@DeB14:/usr/src]# gcc -v
... Omitted ...
gcc version 2.95.4 20011002 (Debian prerelease)

i searched google and found a work around to the __udivdi3 using sector_div.
i've tried and it seems ok.


and the enbd. i still can't build it outside the kernel src tree.
here is part of the error msg.

make[1]: Entering directory `/usr/src/linux-2.6.8.1'
make -f /usr/src/nbd-2.4.32/kernel/linux-2.6.x/scripts/Makefile.build
obj=/usr/src/nbd-2.4.32/kernel/linux-2.6.x/scripts
make[2]: *** No rule to make target `/usr/src/nbd-2.4.32/kernel/linux-2.6.x/scripts/fixdep.c',
needed by `/usr/src/nbd-2.4.32/kernel/linux-2.6.x/scripts/fixdep'.  Stop.
make[1]: *** [/usr/src/nbd-2.4.32/kernel/linux-2.6.x/scripts] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.8.1'
*************************************
* please apply kernel patch instead *
*************************************

any suggestions?

thank you.

edward

_________________________________________________________
Do You Yahoo!?
150万曲MP3疯狂搜,带您闯入音乐殿堂
http://cn.rd.yahoo.com/mail_cn/tag/yisou/music/*http://music.yisou.com/
美女明星应有尽有,搜遍美图、艳图和酷图
http://cn.rd.yahoo.com/mail_cn/tag/yisou/image/*http://image.yisou.com
1G就是1000兆,雅虎电邮自助扩容!
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.