flashcache在SLES 11 SP3上的编译错误

最近在SuSE Linux Enterprise Server 11 SP3上编译flashcache模块时遇到如下的错误:

linux-qzdm:~/facebook-flashcache-9b26cb1 # make KERNEL_TREE=/usr/src/linux-3.0.76-0.11/
fatal: Not a git repository (or any of the parent directories): .git
make -C src KERNEL_TREE=/usr/src/linux-3.0.76-0.11/ PWD=/root/facebook-flashcache-9b26cb1/src all
make[1]: Entering directory `/root/facebook-flashcache-9b26cb1/src'
make -C /usr/src/linux-3.0.76-0.11/ M=/root/facebook-flashcache-9b26cb1/src modules V=0
make[2]: Entering directory `/usr/src/linux-3.0.76-0.11'
  CC [M]  /root/facebook-flashcache-9b26cb1/src/flashcache_conf.o
/root/facebook-flashcache-9b26cb1/src/flashcache_conf.c: In function ‘flashcache_ctr’:
/root/facebook-flashcache-9b26cb1/src/flashcache_conf.c:1181: error: ‘struct dm_target’ has no member named ‘split_io’
/root/facebook-flashcache-9b26cb1/src/flashcache_conf.c: At top level:
/root/facebook-flashcache-9b26cb1/src/flashcache_conf.c:1692: warning: initialization from incompatible pointer type
make[3]: *** [/root/facebook-flashcache-9b26cb1/src/flashcache_conf.o] Error 1
make[2]: *** [_module_/root/facebook-flashcache-9b26cb1/src] Error 2
make[2]: Leaving directory `/usr/src/linux-3.0.76-0.11'
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/root/facebook-flashcache-9b26cb1/src'
make: *** [all] Error 2


flashcache_conf.c中的相关代码如下:

1180 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
1181         ti->split_io = dmc->block_size;
1182 #else
1183         ti->max_io_len = dmc->block_size;
1184 #endif
1185         ti->private = dmc;


初步判断是因为SuSE内核中对此处使用的结构体做了修改。



目前有两种解决办法:


(1)重新编译安装标准linux内核

下载地址 ftp://ftp.kernel.org/pub/linux/kernel/v3.x/linux-3.0.76.tar.xz

编译安装内核:

linux-qzdm:~ # tar -xvf linux-3.0.76.tar.xz
linux-qzdm:~ # cd linux-3.0.76/
linux-qzdm:~/linux-3.0.76 # make config
linux-qzdm:~/linux-3.0.76 # make dep     生成内核功能间的依赖关系。一般会提示unecessary.
linux-qzdm:~/linux-3.0.76 # make
linux-qzdm:~/linux-3.0.76 # make modules_install
linux-qzdm:~/linux-3.0.76 # make install

linux-qzdm:~/linux-3.0.76 # reboot

重新编译安装flashcache:

linux-qzdm:~ # tar -zxvf flashcache.tar.gz
linux-qzdm:~ # cd facebook-flashcache-9b26cb1/
linux-qzdm:~/facebook-flashcache-9b26cb1 # make
linux-qzdm:~/facebook-flashcache-9b26cb1 # make install

加载flashcache模块:

linux-qzdm:~ # insmod /lib/modules/3.0.76-0.11-default/extra/flashcache/flashcache.ko
linux-qzdm:~ # lsmod | grep flash
flashcache            102320  1 
dm_mod                 77825  3 flashcache




(2)修改flashcache_conf.c文件

1180 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
1181         ti->split_io = dmc->block_size;
1182 #else
1183         ti->max_io_len = dmc->block_size;
1184 #endif
1185         ti->private = dmc;

修改为

1180 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
1181         ti->max_io_len = dmc->block_size;
1182 #else
1183         ti->max_io_len = dmc->block_size;
1184 #endif
1185         ti->private = dmc;


然后编译安装flashcache,方法同上






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值