我正在尝试在LVM的不同范围内放置和读取文件的块。我正在研究linux 4.7.2:
GIT中://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
我修改了以下文件:
但我收到以下错误:
include/linux/export.h:63:39: error: section attribute cannot be specified for local variables
__visible const struct kernel_symbol __ksymtab_##sym \
include/linux/export.h:63:39: error: declaration of ‘__ksymtab___dax_fault’ with no linkage follows extern declaration
__visible const struct kernel_symbol __ksymtab_##sym \
fs/dax.c:1090:19: error: non-static declaration of ‘dax_fault’ follows static declaration
EXPORT_SYMBOL_GPL(dax_fault);
fs/dax.c:1099:13: error: invalid storage class for function ‘__dax_dbg’
static void __dax_dbg(struct buffer_head *bh, unsigned long address,
fs/dax.c:1298:19: error: non-static declaration of ‘__dax_pmd_fault’ follows static declaration
EXPORT_SYMBOL_GPL(__dax_pmd_fault);
修改了dax.c:
static int dax_insert_mapping():
if(mapping->host->i_ino==15){
if(block==0){
for(my_i=0;my_i<my_dax_size;my_i++){
fill_array[my_i]=0;
}
}
for(my_i=0;my_i<my_dax_size;my_i++){
printk(KERN_INFO "check %d fill %d\t",check_array[my_i],fill_array[my_i]);
}
my_block = (int) block;
if(check_array[my_block]==0){
if(fill_array[my_block]==0){
fill_array[my_block]=1;
goto my_atomic;
}
else if(fill_array[my_block]==1){
for(my_i=my_block;my_i<=(my_dax_size-my_block);my_i++){
if(fill_array[my_i]==0 && check_array[my_i]==0){
dax.sector = dax.sector+(8*(my_i - my_block));
for(my_j=my_block;my_j<=my_i;my_j++){
fill_array[my_j] = 1;
}
goto my_atomic;
}
}
//if(my_i==8){
printk(KERN_INFO "I'm at error!!!\n");
dax_flag =1;
goto my_return;
//}
}
}
else if(check_array[my_block]==1){
if(fill_array[my_block]==0){
for(my_i=my_block;my_i<=(my_dax_size-my_block);my_i++){
if(check_array[my_i]==0){
dax.sector = dax.sector+(8*(my_i - my_block));
for(my_j=my_block;my_j<=my_i;my_j++){
fill_array[my_j] = 1;
}
goto my_atomic;
}
}
}
else if(fill_array[my_block]==1){
for(my_i=my_block;my_i<=(my_dax_size-my_block);my_i++){
if(fill_array[my_i]==0 && check_array[my_i]==0){
dax.sector = dax.sector+(8*(my_i - my_block));
for(my_j=my_block;my_j<=my_i;my_j++){
fill_array[my_j] = 1;
}
goto my_atomic;
}
}
//if(my_i==8){
printk(KERN_INFO "I'm at error!!!\n");
dax_flag =1;
goto my_return;
//}
}
}
}
my_atomic:
printk(KERN_INFO "insert_mapping sector %lu\n",dax.sector);
if (dax_map_atomic(bdev, &dax) < 0){
printk(KERN_INFO "error at map_atomic\n");
return PTR_ERR(dax.addr);
}
dax_unmap_atomic(bdev, &dax);
my_addr = (unsigned long) dax.addr;
ret = dax_insert_mapping_entry(mapping, vmf, entry, dax.sector);
if (IS_ERR(ret)){
printk(KERN_INFO "error at insert_mapping %lu\n",my_addr);
return PTR_ERR(ret);
}
*entryp = ret;
if(mapping->host->i_ino>11 && mapping->host->i_ino<=15){
printk(KERN_INFO "inode #%lu: block %lu pgoff %lu sector %lu addr %lu pfn %llu size %ld dax_flag %d\n",mapping->host->i_ino,vmf->pgoff,block,dax.sector,my_addr,dax.pfn.val, dax.size,dax_flag);
}
my_return:
if(dax_flag==0)
return vm_insert_mixed(vma, vaddr, dax.pfn);
else
return retval