Skip to contentSkip to conversation

reiserfstune: block allocator is not defined

DISCUSSION Konstantin Münning 3 participants 3 messages Oct 21, 2005

lore
Share & tools
lore
#0 lore raw

Hi!

Just tried to add some badblocks like this:

reiserfstune -b /tmp/badblocklist /dev/hda5

and I get the error:

block allocator is not defined

Aborted

The same when I try it with -B. As this message means nothing to me, has somebody any idea what the problem might be? The man pages and interestingly a web search gave me nothing about it. Or is reiserfstune not to be used for adding bad blocks to the fs?

Kernel 2.6.12, reiserfstools 3.6.19.

Thanks!

Signature · 1 line
Konstantin Münning
#1 lore raw

Hello

Quoted 11 lines · Konstantin Münning

Hi!

Just tried to add some badblocks like this:

reiserfstune -b /tmp/badblocklist /dev/hda5

and I get the error:

block allocator is not defined

Quoted 7 lines

Aborted

The same when I try it with -B. As this message means nothing to me, has somebody any idea what the problem might be? The man pages and interestingly a web search gave me nothing about it. Or is reiserfstune not to be used for adding bad blocks to the fs?

reiserfstune is supposed to be use for that. You encountered reiserfstune bug. We are working on a fix.

#2 lore raw

Hi,

try the attached patch please.

Quoted 27 lines · Vladimir V. Saveliev

Hello

Quoted 11 lines · Konstantin Mьnning

Hi!

Just tried to add some badblocks like this:

reiserfstune -b /tmp/badblocklist /dev/hda5

and I get the error:

block allocator is not defined

Quoted 7 lines

Aborted

The same when I try it with -B. As this message means nothing to me, has somebody any idea what the problem might be? The man pages and interestingly a web search gave me nothing about it. Or is reiserfstune not to be used for adding bad blocks to the fs?

reiserfstune is supposed to be use for that. You encountered reiserfstune bug. We are working on a fix.

Signature · 1 line
Vitaly
reiserfsprogs-3.6.19-2/reiserfscore/reiserfslib.c renamed from reiserfsprogs-3.6.19/reiserfscore/reiserfslib.c +20 -1
diff -rup ./reiserfsprogs-3.6.19/reiserfscore/reiserfslib.c ./reiserfsprogs-3.6.19-2/reiserfscore/reiserfslib.c
@@ -1346,6 +1346,24 @@ void mark_badblock(reiserfs_filsys_t *fs
 	pathrelse (badblock_path);
 }
 
+static int reiserfs_alloc_blocks (reiserfs_filsys_t * fs,
+				  unsigned long *blknr,
+				  unsigned long start, 
+				  int count)
+{
+    int i;
+    
+    for (i = 0; i < count; i ++) {
+	blknr[i] = 0;
+	if (reiserfs_bitmap_find_zero_bit(fs->fs_bitmap2, blknr + i))
+	    die ("%s: failed to allocate a block.", __FUNCTION__);
+	
+	reiserfs_bitmap_set_bit(fs->fs_bitmap2, blknr[i]);
+    }
+    
+    return CARRY_ON;
+}
+
 void add_badblock_list (reiserfs_filsys_t * fs, int replace) {
     struct tree_balance tb;
     struct path badblock_path;
@@ -1372,7 +1390,8 @@ void add_badblock_list (reiserfs_filsys_
     set_type (KEY_FORMAT_2, &badblock_ih.ih_key, TYPE_INDIRECT);
 
     j = 0;
-
+    fs->block_allocator = reiserfs_alloc_blocks;
+    
     /* insert all badblock pointers */
     for (i = 0; i < fs->fs_badblocks_bm->bm_bit_size; i++) {
         int retval;