Imported reiserfsprogs-3.6.4
This commit is contained in:
1 parent
b69459eb80
commit
99c89460c3
52 files changed
+2263
-2407
No files matched your search
+26
-1
@@ -113,7 +113,12 @@ int reiserfs_bitmap_compare (reiserfs_bitmap_t * bm1, reiserfs_bitmap_t * bm2)
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Does X | Y for every bit of the bitmap `to`, where
|
||||
X - bit of the `to` bitmap,
|
||||
Y - `from` bitmap.
|
||||
Save result in the `to` bitmap.
|
||||
*/
|
||||
void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * to, reiserfs_bitmap_t * from)
|
||||
{
|
||||
int i;
|
||||
@@ -130,6 +135,26 @@ void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * to, reiserfs_bitmap_t * fr
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Does X & !Y for every bit of the bitmap `base`, where
|
||||
X - bit of the `base` bitmap,
|
||||
Y - `exclude` bitmap.
|
||||
Save result in the `base` bitmap.
|
||||
*/
|
||||
void reiserfs_bitmap_delta (reiserfs_bitmap_t * base, reiserfs_bitmap_t * exclude) {
|
||||
int i;
|
||||
|
||||
assert (base->bm_byte_size == exclude->bm_byte_size &&
|
||||
base->bm_bit_size == exclude->bm_bit_size);
|
||||
|
||||
for (i = 0; i < base->bm_bit_size; i++) {
|
||||
if (test_bit(i, exclude->bm_map) && test_bit(i, base->bm_map)) {
|
||||
clear_bit(i, base->bm_map);
|
||||
base->bm_set_bits --;
|
||||
base->bm_dirty = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void reiserfs_bitmap_set_bit (reiserfs_bitmap_t * bm, unsigned int bit_number)
|
||||
{
|
||||
|
||||
+56
-37
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details
|
||||
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
|
||||
* reiserfs/README for licensing and copyright details
|
||||
*/
|
||||
|
||||
/* Now we have all buffers that must be used in balancing of the tree */
|
||||
@@ -181,7 +182,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
const char * body, /* body of inserted item or bytes to paste */
|
||||
int flag, /* i - insert, d - delete, c - cut, p - paste
|
||||
(see comment to do_balance) */
|
||||
int zeros_number, /* will be commented later */
|
||||
int zeros_number, /* it is always 0 */
|
||||
|
||||
struct item_head * insert_key, /* in our processing of one level we sometimes determine what
|
||||
must be inserted into the next higher level. This insertion
|
||||
@@ -247,7 +248,8 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
|
||||
/* Calculate key component, item length and body to insert into S[0] */
|
||||
//ih->ih_key.k_offset += tb->lbytes;
|
||||
set_offset (key_format (&ih->ih_key), &ih->ih_key, get_offset (&ih->ih_key) + tb->lbytes);
|
||||
set_offset (key_format (&ih->ih_key), &ih->ih_key, get_offset (&ih->ih_key) +
|
||||
tb->lbytes * (is_indirect_ih(ih) ? tb->tb_fs->fs_blocksize / UNFM_P_SIZE : 1) );
|
||||
set_ih_item_len (ih, new_item_len);
|
||||
if ( tb->lbytes > zeros_number ) {
|
||||
body += (tb->lbytes - zeros_number);
|
||||
@@ -318,8 +320,8 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
/* regular object */
|
||||
if ( tb->lbytes >= pos_in_item ) {
|
||||
/* appended item will be in L[0] in whole */
|
||||
int l_n;
|
||||
struct key * key;
|
||||
int l_n, temp_n;
|
||||
struct key * key;
|
||||
|
||||
/* this bytes number must be appended to the last item of L[h] */
|
||||
l_n = tb->lbytes - pos_in_item;
|
||||
@@ -338,14 +340,18 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
get_ih_item_len (B_N_PITEM_HEAD(tb->L[0],n+item_pos-ret_val)),
|
||||
l_n,body, zeros_number > l_n ? l_n : zeros_number);
|
||||
|
||||
|
||||
/* 0-th item in S0 can be only of DIRECT type when l_n != 0*/
|
||||
//B_N_PKEY (tbS0, 0)->k_offset += l_n;z
|
||||
key = B_N_PKEY (tbS0, 0);
|
||||
set_offset (key_format (key), key, get_offset (key) + l_n);
|
||||
temp_n = (is_indirect_ih(B_N_PITEM_HEAD (tb->L[0], n + item_pos - ret_val))) ?
|
||||
(l_n / UNFM_P_SIZE) * tb->tb_fs->fs_blocksize : l_n;
|
||||
|
||||
set_offset (key_format (key), key, get_offset (key) + temp_n);
|
||||
|
||||
//B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0])->k_offset += l_n;
|
||||
key = B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0]);
|
||||
set_offset (key_format (key), key, get_offset (key) + l_n);
|
||||
set_offset (key_format (key), key, get_offset (key) + temp_n);
|
||||
|
||||
/* Calculate new body, position in item and insert_size[0] */
|
||||
if ( l_n > zeros_number ) {
|
||||
@@ -397,8 +403,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
|
||||
/* if appended item is indirect item, put unformatted node into un list */
|
||||
if (I_IS_INDIRECT_ITEM (pasted))
|
||||
set_ih_free_space (pasted, ((struct unfm_nodeinfo*)body)->unfm_freespace);
|
||||
//pasted->u.ih_free_space = ((struct unfm_nodeinfo*)body)->unfm_freespace;
|
||||
set_ih_free_space (pasted, 0);
|
||||
|
||||
tb->insert_size[0] = 0;
|
||||
zeros_number = 0;
|
||||
@@ -427,8 +432,9 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
/* new item or its part falls to R[0] */
|
||||
if ( item_pos == n - tb->rnum[0] + 1 && tb->rbytes != -1 ) {
|
||||
/* part of new item falls into R[0] */
|
||||
int old_key_comp, old_len, r_zeros_number;
|
||||
loff_t old_key_comp, old_len, r_zeros_number;
|
||||
const char * r_body;
|
||||
loff_t multiplyer;
|
||||
|
||||
leaf_shift_right(tb, tb->rnum[0] - 1, -1);
|
||||
|
||||
@@ -436,22 +442,24 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
old_key_comp = get_offset (&ih->ih_key);
|
||||
old_len = get_ih_item_len (ih);
|
||||
|
||||
multiplyer = is_indirect_ih(ih) ? tb->tb_fs->fs_blocksize / UNFM_P_SIZE : 1;
|
||||
/* Calculate key component and item length to insert into R[0] */
|
||||
//ih->ih_key.k_offset += (old_len - tb->rbytes);
|
||||
set_offset (key_format (&ih->ih_key), &ih->ih_key, old_key_comp + old_len - tb->rbytes);
|
||||
set_offset (key_format (&ih->ih_key), &ih->ih_key, old_key_comp +
|
||||
(old_len - tb->rbytes) * multiplyer );
|
||||
|
||||
set_ih_item_len (ih, tb->rbytes);
|
||||
/* Insert part of the item into R[0] */
|
||||
bi.bi_bh = tb->R[0];
|
||||
bi.bi_parent = tb->FR[0];
|
||||
bi.bi_position = get_right_neighbor_position (tb, 0);
|
||||
if ( get_offset (&ih->ih_key) - old_key_comp > zeros_number ) {
|
||||
if (old_len - tb->rbytes > zeros_number ) {
|
||||
r_zeros_number = 0;
|
||||
r_body = body + get_offset (&ih->ih_key) - old_key_comp - zeros_number;
|
||||
r_body = body + old_len - tb->rbytes - zeros_number;
|
||||
}
|
||||
else {
|
||||
else { /* zeros_number is always 0 */
|
||||
r_body = body;
|
||||
r_zeros_number = zeros_number - (get_offset (&ih->ih_key) - old_key_comp);
|
||||
r_zeros_number = zeros_number - old_len - tb->rbytes;
|
||||
zeros_number -= r_zeros_number;
|
||||
}
|
||||
|
||||
@@ -552,13 +560,20 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
if ( (n_rem = tb->insert_size[0] - tb->rbytes) < 0 )
|
||||
n_rem = 0;
|
||||
|
||||
//B_N_PKEY(tb->R[0],0)->k_offset += n_rem;
|
||||
key = B_N_PKEY(tb->R[0],0);
|
||||
set_offset (key_format (key), key, get_offset (key) + n_rem);
|
||||
{
|
||||
unsigned long temp_rem = n_rem;
|
||||
|
||||
if (is_indirect_key(B_N_PKEY(tb->R[0],0)))
|
||||
temp_rem = (n_rem / UNFM_P_SIZE) * tb->tb_fs->fs_blocksize;
|
||||
|
||||
//B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0])->k_offset += n_rem;
|
||||
key = B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0]);
|
||||
set_offset (key_format (key), key, get_offset (key) + n_rem);
|
||||
//B_N_PKEY(tb->R[0],0)->k_offset += n_rem;
|
||||
key = B_N_PKEY(tb->R[0],0);
|
||||
set_offset (key_format (key), key, get_offset (key) + temp_rem);
|
||||
|
||||
//B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0])->k_offset += n_rem;
|
||||
key = B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0]);
|
||||
set_offset (key_format (key), key, get_offset (key) + temp_rem);
|
||||
}
|
||||
|
||||
mark_buffer_dirty (tb->CFR[0]);
|
||||
|
||||
@@ -579,8 +594,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
leaf_paste_in_buffer(tb->tb_fs, &bi, 0, n_shift, tb->insert_size[0] - n_rem, r_body, r_zeros_number);
|
||||
|
||||
if (I_IS_INDIRECT_ITEM(B_N_PITEM_HEAD(tb->R[0],0))) {
|
||||
set_ih_free_space (B_N_PITEM_HEAD(tb->R[0],0), ((struct unfm_nodeinfo*)body)->unfm_freespace);
|
||||
//B_N_PITEM_HEAD(tb->R[0],0)->u.ih_free_space = ((struct unfm_nodeinfo*)body)->unfm_freespace;
|
||||
set_ih_free_space (B_N_PITEM_HEAD(tb->R[0],0), 0);
|
||||
}
|
||||
|
||||
tb->insert_size[0] = n_rem;
|
||||
@@ -616,8 +630,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
}
|
||||
|
||||
if (I_IS_INDIRECT_ITEM (pasted))
|
||||
//pasted->u.ih_free_space = ((struct unfm_nodeinfo*)body)->unfm_freespace;
|
||||
set_ih_free_space (pasted, ((struct unfm_nodeinfo*)body)->unfm_freespace);
|
||||
set_ih_free_space (pasted, 0);
|
||||
zeros_number = tb->insert_size[0] = 0;
|
||||
}
|
||||
}
|
||||
@@ -679,6 +692,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
/* part of new item falls into S_new[i] */
|
||||
int old_key_comp, old_len, r_zeros_number;
|
||||
const char * r_body;
|
||||
loff_t multiplyer;
|
||||
|
||||
/* Move snum[i]-1 items from S[0] to S_new[i] */
|
||||
leaf_move_items (LEAF_FROM_S_TO_SNEW, tb, snum[i] - 1, -1, S_new[i]);
|
||||
@@ -686,10 +700,12 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
/* Remember key component and item length */
|
||||
old_key_comp = get_offset (&ih->ih_key);
|
||||
old_len = get_ih_item_len (ih);
|
||||
multiplyer = is_indirect_ih(ih) ? tb->tb_fs->fs_blocksize / UNFM_P_SIZE : 1;
|
||||
|
||||
/* Calculate key component and item length to insert into S_new[i] */
|
||||
//ih->ih_key.k_offset += (old_len - sbytes[i]);
|
||||
set_offset (key_format (&ih->ih_key), &ih->ih_key, old_key_comp + old_len - sbytes[i]);
|
||||
set_offset (key_format (&ih->ih_key), &ih->ih_key, old_key_comp +
|
||||
(old_len - sbytes[i]) * multiplyer);
|
||||
|
||||
set_ih_item_len (ih, sbytes[i]);
|
||||
|
||||
@@ -698,13 +714,13 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
bi.bi_parent = 0;
|
||||
bi.bi_position = 0;
|
||||
|
||||
if ( get_offset (&ih->ih_key) - old_key_comp > zeros_number ) {
|
||||
if ( old_len - sbytes[i] > zeros_number ) {
|
||||
r_zeros_number = 0;
|
||||
r_body = body + (get_offset (&ih->ih_key) - old_key_comp) - zeros_number;
|
||||
r_body = body + (old_len - sbytes[i]) - zeros_number;
|
||||
}
|
||||
else {
|
||||
r_body = body;
|
||||
r_zeros_number = zeros_number - (get_offset (&ih->ih_key) - old_key_comp);
|
||||
r_zeros_number = zeros_number - (old_len - sbytes[i]);
|
||||
zeros_number -= r_zeros_number;
|
||||
}
|
||||
|
||||
@@ -809,15 +825,20 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
leaf_paste_in_buffer(tb->tb_fs, &bi, 0, n_shift, tb->insert_size[0]-n_rem, r_body,r_zeros_number);
|
||||
tmp = B_N_PITEM_HEAD (S_new[i], 0);
|
||||
if (I_IS_INDIRECT_ITEM(tmp)) {
|
||||
/*
|
||||
if (n_rem)
|
||||
reiserfs_panic ("PAP-12230: balance_leaf: "
|
||||
"invalid action with indirect item");
|
||||
//tmp->u.ih_free_space = ((struct unfm_nodeinfo*)body)->unfm_freespace;
|
||||
set_ih_free_space (tmp, ((struct unfm_nodeinfo*)body)->unfm_freespace);
|
||||
}
|
||||
set_ih_free_space (tmp, 0);
|
||||
*/
|
||||
set_ih_free_space (tmp, 0);
|
||||
set_offset( key_format (&tmp->ih_key), &tmp->ih_key, get_offset(&tmp->ih_key) +
|
||||
(n_rem / UNFM_P_SIZE) * tb->tb_fs->fs_blocksize);
|
||||
} else
|
||||
set_offset (key_format (&tmp->ih_key), &tmp->ih_key, get_offset (&tmp->ih_key) + n_rem);
|
||||
|
||||
//B_N_PKEY(S_new[i],0)->k_offset += n_rem;
|
||||
set_offset (key_format (&tmp->ih_key), &tmp->ih_key, get_offset (&tmp->ih_key) + n_rem);
|
||||
//
|
||||
|
||||
tb->insert_size[0] = n_rem;
|
||||
if ( ! n_rem )
|
||||
@@ -845,8 +866,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
|
||||
/* if we paste to indirect item update ih_free_space */
|
||||
if (I_IS_INDIRECT_ITEM (pasted))
|
||||
//pasted->u.ih_free_space = ((struct unfm_nodeinfo*)body)->unfm_freespace;
|
||||
set_ih_free_space (pasted, ((struct unfm_nodeinfo*)body)->unfm_freespace);
|
||||
set_ih_free_space (pasted, 0);
|
||||
zeros_number = tb->insert_size[0] = 0;
|
||||
}
|
||||
} else {
|
||||
@@ -914,8 +934,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
leaf_paste_in_buffer (tb->tb_fs, &bi, item_pos, pos_in_item, tb->insert_size[0], body, zeros_number);
|
||||
|
||||
if (I_IS_INDIRECT_ITEM (pasted)) {
|
||||
//pasted->u.ih_free_space = ((struct unfm_nodeinfo*)body)->unfm_freespace;
|
||||
set_ih_free_space (pasted, ((struct unfm_nodeinfo*)body)->unfm_freespace);
|
||||
set_ih_free_space (pasted, 0);
|
||||
}
|
||||
tb->insert_size[0] = 0;
|
||||
}
|
||||
|
||||
+12
-11
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details
|
||||
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
|
||||
* reiserfs/README for licensing and copyright details
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -365,7 +366,7 @@ static int check_left (struct tree_balance * tb, int h, int cur_free)
|
||||
}
|
||||
|
||||
|
||||
reiserfs_panic (0, "vs: 8065: check_left: all items fit in the left neighbor");
|
||||
reiserfs_panic (0, "vs-8065: check_left: all items fit in the left neighbor");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1474,12 +1475,12 @@ static int ip_check_balance (/*struct reiserfs_transaction_handle *th,*/ struct
|
||||
|
||||
int lfree, sfree, rfree /* free space in L, S and R */;
|
||||
|
||||
/* nver is short for number of vertixes, and lnver is the number if we
|
||||
/* nver is short for number of vertices, and lnver is the number if we
|
||||
shift to the left, rnver is the number if we shift to the right, and
|
||||
lrnver is the number if we shift in both directions. The goal is to
|
||||
minimize first the number of vertixes, and second, the number of
|
||||
vertixes whose contents are changed by shifting, and third the number
|
||||
of uncached vertixes whose contents are changed by shifting and must be
|
||||
minimize first the number of vertices, and second, the number of
|
||||
vertices whose contents are changed by shifting, and third the number
|
||||
of uncached vertices whose contents are changed by shifting and must be
|
||||
read from disk. */
|
||||
int nver, lnver, rnver, lrnver;
|
||||
|
||||
@@ -1642,7 +1643,7 @@ static int ip_check_balance (/*struct reiserfs_transaction_handle *th,*/ struct
|
||||
/* calculate number of blocks S[h] must be split into when l_shift_num
|
||||
first items and l_shift_bytes of the right most liquid item to be
|
||||
shifted are shifted to the left neighbor, as well as number of
|
||||
items in each part of the splitted node (s012 numbers), and number
|
||||
items in each part of the split node (s012 numbers), and number
|
||||
of bytes (s1bytes) of the shared drop which flow to S1 if any */
|
||||
lset = LEFT_SHIFT_NO_FLOW;
|
||||
lnver = get_num_ver (vn->vn_mode, tb, h,
|
||||
@@ -1754,7 +1755,7 @@ static int ip_check_balance (/*struct reiserfs_transaction_handle *th,*/ struct
|
||||
|
||||
|
||||
/* Check whether current node S[h] is balanced when Decreasing its size by
|
||||
* Deleting or Cutting for INTERNAL node of S+tree.
|
||||
* Deleting or Cutting for INTERNAL node of internal tree.
|
||||
* Calculate parameters for balancing for current level h.
|
||||
* Parameters:
|
||||
* tb tree_balance structure;
|
||||
@@ -1767,7 +1768,7 @@ static int ip_check_balance (/*struct reiserfs_transaction_handle *th,*/ struct
|
||||
* -2 - no disk space.
|
||||
*
|
||||
* Note: Items of internal nodes have fixed size, so the balance condition for
|
||||
* the internal part of S+tree is as for the B-trees.
|
||||
* the internal part of internal tree is as for the B-trees.
|
||||
*/
|
||||
static int dc_check_balance_internal (struct tree_balance * tb, int h)
|
||||
{
|
||||
@@ -1911,7 +1912,7 @@ static int dc_check_balance_internal (struct tree_balance * tb, int h)
|
||||
|
||||
|
||||
/* Check whether current node S[h] is balanced when Decreasing its size by
|
||||
* Deleting or Truncating for LEAF node of S+tree.
|
||||
* Deleting or Truncating for LEAF node of internal tree.
|
||||
* Calculate parameters for balancing for current level h.
|
||||
* Parameters:
|
||||
* tb tree_balance structure;
|
||||
@@ -2279,7 +2280,7 @@ int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb,
|
||||
p_s_tb->insert_size[n_h + 1] = (DC_SIZE + KEY_SIZE) * (p_s_tb->blknum[n_h] - 1);
|
||||
}
|
||||
|
||||
return CARRY_ON; /* go ahead and balsnce */
|
||||
return CARRY_ON; /* go ahead and balance */
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
|
||||
* reiserfs/README for licensing and copyright details
|
||||
*/
|
||||
|
||||
/*
|
||||
* Keyed 32-bit hash function using TEA in a Davis-Meyer function
|
||||
* H0 = Key
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details
|
||||
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
|
||||
* reiserfs/README for licensing and copyright details
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
|
||||
* Copyright 2000, 2001, 2002 by Hans Reiser, licensing governed by
|
||||
* reiserfs/README
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
|
||||
+23
-14
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
/* this provides for everybody who wants to deal with journal */
|
||||
/* this is provided for anybody who wants to deal with journal */
|
||||
int replay_one_transaction (reiserfs_filsys_t *, reiserfs_trans_t *);
|
||||
void for_each_transaction (reiserfs_filsys_t *, action_on_trans_t);
|
||||
void for_each_block (reiserfs_filsys_t *, reiserfs_trans_t *, action_on_block_t);
|
||||
@@ -38,7 +38,7 @@ unsigned long commit_expected (reiserfs_filsys_t * fs, struct buffer_head * d_bh
|
||||
}
|
||||
|
||||
|
||||
/* d_bh contains journal descriptor, return number of block where descriptor
|
||||
/* d_bh contains journal descriptor, returns number of block where descriptor
|
||||
block of next transaction should be */
|
||||
unsigned long next_desc_expected (reiserfs_filsys_t * fs, struct buffer_head * d_bh)
|
||||
{
|
||||
@@ -77,8 +77,8 @@ int is_valid_transaction (reiserfs_filsys_t * fs, struct buffer_head * d_bh)
|
||||
}
|
||||
|
||||
|
||||
/* read the journal and find the oldest and newest transactions, return numbe
|
||||
of transactions fond */
|
||||
/* read the journal and find the oldest and newest transactions, return number
|
||||
of transactions found */
|
||||
int get_boundary_transactions (reiserfs_filsys_t * fs,
|
||||
reiserfs_trans_t * oldest,
|
||||
reiserfs_trans_t * newest)
|
||||
@@ -91,7 +91,6 @@ int get_boundary_transactions (reiserfs_filsys_t * fs,
|
||||
__u32 newest_trans_id, oldest_trans_id, trans_id;
|
||||
int trans_nr;
|
||||
|
||||
|
||||
sb = fs->fs_ondisk_sb;
|
||||
|
||||
j_start = get_jp_journal_1st_block (sb_jp (sb));
|
||||
@@ -119,7 +118,7 @@ int get_boundary_transactions (reiserfs_filsys_t * fs,
|
||||
oldest->desc_blocknr = d_bh->b_blocknr;
|
||||
oldest->trans_len = get_desc_trans_len (d_bh);
|
||||
oldest->commit_blocknr = commit_expected (fs, d_bh);
|
||||
newest->next_trans_offset = next_desc_expected (fs, d_bh) - j_start;
|
||||
oldest->next_trans_offset = next_desc_expected (fs, d_bh) - j_start;
|
||||
}
|
||||
|
||||
if (trans_id > newest_trans_id) {
|
||||
@@ -145,7 +144,7 @@ int get_boundary_transactions (reiserfs_filsys_t * fs,
|
||||
#define TRANS_NOT_FOUND 0
|
||||
|
||||
/* trans is a valid transaction. Look for valid transaction with smallest
|
||||
trans id which is bigger than the id of the current one */
|
||||
trans id which is greater than the id of the current one */
|
||||
int next_transaction (reiserfs_filsys_t * fs, reiserfs_trans_t * trans, reiserfs_trans_t break_trans)
|
||||
{
|
||||
struct buffer_head * d_bh, * next_d_bh;
|
||||
@@ -439,18 +438,28 @@ int reiserfs_open_journal (reiserfs_filsys_t * fs, char * j_filename, int flags)
|
||||
if (is_reiserfs_jr_magic_string (sb)) {
|
||||
if (get_jp_journal_1st_block (&j_head->jh_journal) != get_jp_journal_1st_block (sb_jp (sb)) ||
|
||||
get_jp_journal_dev (&j_head->jh_journal) != get_jp_journal_dev (sb_jp (sb)) ||
|
||||
get_jp_journal_size (&j_head->jh_journal) != get_jp_journal_size (sb_jp (sb))) {
|
||||
reiserfs_warning (stderr, "reiserfs_open_journal: no journal found on %s\n", j_filename);
|
||||
brelse (bh);
|
||||
return 0;
|
||||
get_jp_journal_size (&j_head->jh_journal) != get_jp_journal_size (sb_jp (sb)))
|
||||
{
|
||||
reiserfs_warning (stderr, "reiserfs_open_journal: no journal found on %s\n", j_filename);
|
||||
brelse (bh);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (get_jp_journal_dev (sb_jp(sb)) != 0 ||
|
||||
get_jp_journal_1st_block (sb_jp(sb)) != get_journal_start_must (fs) ||
|
||||
get_jp_journal_size (sb_jp(sb)) != journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize))
|
||||
{
|
||||
reiserfs_warning (stderr, "reiserfs_open_journal: wrong journal parameters found in the super block.\n");
|
||||
brelse (bh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fs->fs_jh_bh = bh;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* initialize super block's journal related fields and journal header fields. If
|
||||
len is 0 - make journal of default size */
|
||||
int reiserfs_create_journal (reiserfs_filsys_t * fs, char * j_filename,
|
||||
@@ -479,7 +488,7 @@ int reiserfs_create_journal (reiserfs_filsys_t * fs, char * j_filename,
|
||||
// if (get_sb_block_count (sb) < min_block_amount (fs->fs_blocksize, len)) {
|
||||
/* host device does not contain enough blocks */
|
||||
reiserfs_warning (stderr, "reiserfs_create_journal: "
|
||||
"can not create filesystem on %d blocks\n",
|
||||
"cannot create filesystem on %d blocks\n",
|
||||
get_sb_block_count (sb));
|
||||
return 0;
|
||||
}
|
||||
@@ -507,7 +516,7 @@ int reiserfs_create_journal (reiserfs_filsys_t * fs, char * j_filename,
|
||||
|
||||
if (len > journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1)
|
||||
reiserfs_warning (stderr,
|
||||
"NOTE: journal new size %lu is bigger than default size %lu:\n"
|
||||
"NOTE: journal new size %lu is greater than default size %lu:\n"
|
||||
"this may slow down journal initializing and mounting. Hope it is ok.\n\n",
|
||||
len, journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details
|
||||
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
|
||||
* reiserfs/README for licensing and copyright details
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
|
||||
* Copyright 2000, 2001, 2002 by Hans Reiser, licensing governed by
|
||||
* reiserfs/README
|
||||
*/
|
||||
|
||||
|
||||
@@ -235,11 +236,14 @@ int is_prejournaled_reiserfs (struct reiserfs_super_block * rs)
|
||||
strlen(REISERFS_3_5_SUPER_MAGIC_STRING)));
|
||||
}
|
||||
|
||||
int does_look_like_super_block (struct reiserfs_super_block * sb, int blocksize) {
|
||||
if (is_any_reiserfs_magic_string (sb) && blocksize == get_sb_block_size (sb))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
int does_look_like_super_block (struct reiserfs_super_block * sb) {
|
||||
if (!is_any_reiserfs_magic_string (sb))
|
||||
return 0;
|
||||
|
||||
if (!is_blocksize_correct(get_sb_block_size (sb)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +252,7 @@ int does_look_like_super_block (struct reiserfs_super_block * sb, int blocksize)
|
||||
int who_is_this (char * buf, int blocksize)
|
||||
{
|
||||
/* super block? */
|
||||
if (does_look_like_super_block ((void *)buf, blocksize))
|
||||
if (does_look_like_super_block ((void *)buf))
|
||||
return THE_SUPER;
|
||||
|
||||
if (does_node_look_like_a_leaf (buf, blocksize))
|
||||
@@ -1350,6 +1354,6 @@ void mark_objectid_used (reiserfs_filsys_t * fs, __u32 objectid)
|
||||
|
||||
int is_blocksize_correct (int blocksize)
|
||||
{
|
||||
return ((blocksize % 1024) ? 0 : 1);
|
||||
return ((blocksize == 0) || (blocksize % 1024) ? 0 : 1);
|
||||
}
|
||||
|
||||
+48
-25
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details
|
||||
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
|
||||
* reiserfs/README for licensing and copyright details
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
@@ -7,25 +8,47 @@
|
||||
#include <limits.h>
|
||||
#include <printf.h>
|
||||
|
||||
#define PA_KEY (PA_LAST)
|
||||
#define PA_BUFFER_HEAD (PA_LAST + 1)
|
||||
#define PA_ITEM_HEAD (PA_LAST + 2)
|
||||
#define PA_DISK_CHILD (PA_LAST + 3)
|
||||
|
||||
static int _arginfo (const struct printf_info *info, size_t n,
|
||||
int *argtypes)
|
||||
{
|
||||
|
||||
static int _arginfo_b (const struct printf_info *info, size_t n, int *argtypes) {
|
||||
if (n > 0)
|
||||
argtypes[0] = PA_POINTER;
|
||||
argtypes[0] = PA_BUFFER_HEAD | PA_FLAG_PTR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int _arginfo2 (const struct printf_info *info, size_t n,
|
||||
int *argtypes)
|
||||
{
|
||||
static int _arginfo_K (const struct printf_info *info, size_t n, int *argtypes) {
|
||||
if (n > 0)
|
||||
argtypes[0] = PA_INT;
|
||||
argtypes[0] = PA_KEY | PA_FLAG_PTR;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int _arginfo_H (const struct printf_info *info, size_t n, int *argtypes) {
|
||||
if (n > 0)
|
||||
argtypes[0] = PA_ITEM_HEAD | PA_FLAG_PTR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _arginfo_y (const struct printf_info *info, size_t n, int *argtypes) {
|
||||
if (n > 0)
|
||||
argtypes[0] = PA_DISK_CHILD | PA_FLAG_PTR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _arginfo_M (const struct printf_info *info, size_t n, int *argtypes) {
|
||||
if (n > 0)
|
||||
argtypes[0] = PA_INT | PA_FLAG_SHORT | PA_FLAG_PTR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _arginfo_U (const struct printf_info *info, size_t n, int *argtypes) {
|
||||
if (n > 0)
|
||||
argtypes[0] = (PA_CHAR|PA_FLAG_PTR);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define FPRINTF \
|
||||
if (len == -1) {\
|
||||
@@ -63,7 +86,7 @@ static int print_short_key (FILE * stream,
|
||||
int len;
|
||||
|
||||
key = *((const struct key **)(args[0]));
|
||||
len = asprintf (&buffer, "%u %u", get_key_dirid (key),
|
||||
len = asprintf (&buffer, "[%u %u]", get_key_dirid (key),
|
||||
get_key_objectid (key));
|
||||
FPRINTF;
|
||||
}
|
||||
@@ -79,7 +102,7 @@ static int print_key (FILE * stream,
|
||||
int len;
|
||||
|
||||
key = *((const struct key **)(args[0]));
|
||||
len = asprintf (&buffer, "%u %u 0x%Lx %s (%d)",
|
||||
len = asprintf (&buffer, "[%u %u 0x%Lx %s (%d)]",
|
||||
get_key_dirid (key), get_key_objectid (key),
|
||||
(unsigned long long)get_offset (key), key_of_what (key), get_type (key));
|
||||
FPRINTF;
|
||||
@@ -186,7 +209,7 @@ static int print_sd_uuid (FILE * stream,
|
||||
return len;
|
||||
}
|
||||
|
||||
void reiserfs_warning (FILE * fp, const char * fmt, ...)
|
||||
void reiserfs_warning (FILE * fp, const char * fmt, ...)
|
||||
{
|
||||
static int registered = 0;
|
||||
va_list args;
|
||||
@@ -194,13 +217,13 @@ void reiserfs_warning (FILE * fp, const char * fmt, ...)
|
||||
if (!registered) {
|
||||
registered = 1;
|
||||
|
||||
register_printf_function ('K', print_short_key, _arginfo);
|
||||
register_printf_function ('k', print_key, _arginfo);
|
||||
register_printf_function ('H', print_item_head, _arginfo);
|
||||
register_printf_function ('b', print_block_head, _arginfo);
|
||||
register_printf_function ('y', print_disk_child, _arginfo);
|
||||
register_printf_function ('M', print_sd_mode, _arginfo);
|
||||
register_printf_function ('U', print_sd_uuid, _arginfo);
|
||||
register_printf_function ('K', print_short_key, _arginfo_K);
|
||||
register_printf_function ('k', print_key, _arginfo_K);
|
||||
register_printf_function ('H', print_item_head, _arginfo_H);
|
||||
register_printf_function ('b', print_block_head, _arginfo_b);
|
||||
register_printf_function ('y', print_disk_child, _arginfo_y);
|
||||
register_printf_function ('M', print_sd_mode, _arginfo_M);
|
||||
register_printf_function ('U', print_sd_uuid, _arginfo_U);
|
||||
}
|
||||
|
||||
va_start (args, fmt);
|
||||
@@ -389,7 +412,7 @@ static int print_stat_data (FILE * fp, struct buffer_head * bh, struct item_head
|
||||
int retval;
|
||||
|
||||
|
||||
/* we can not figure out whether it is new stat data or old by key_format
|
||||
/* we cannot figure out if it is new stat data or old by key_format
|
||||
macro. Stat data's key looks identical in both formats */
|
||||
if (get_ih_key_format (ih) == KEY_FORMAT_1) {
|
||||
struct stat_data_v1 * sd_v1 = (struct stat_data_v1 *)B_I_PITEM (bh, ih);
|
||||
@@ -421,8 +444,8 @@ static int print_stat_data (FILE * fp, struct buffer_head * bh, struct item_head
|
||||
void reiserfs_print_item (FILE * fp, struct buffer_head * bh,
|
||||
struct item_head * ih)
|
||||
{
|
||||
reiserfs_warning (stdout, "block %lu, item %d: %H\n",
|
||||
bh->b_blocknr, ih - B_N_PITEM_HEAD (bh, 0), ih);
|
||||
reiserfs_warning (fp, "block %lu, item %d: %H\n",
|
||||
bh->b_blocknr, (ih - B_N_PITEM_HEAD (bh, 0))/sizeof(struct item_head), ih);
|
||||
if (is_stat_data_ih (ih)) {
|
||||
print_stat_data (fp, bh, ih, 0/*all times*/);
|
||||
return;
|
||||
@@ -585,7 +608,7 @@ int print_super_block (FILE * fp, reiserfs_filsys_t * fs, char * file_name,
|
||||
dev_t rdev;
|
||||
int format = 0;
|
||||
|
||||
if (!does_look_like_super_block (sb, fs->fs_blocksize))
|
||||
if (!does_look_like_super_block (sb))
|
||||
return 1;
|
||||
|
||||
rdev = get_st_rdev (file_name);
|
||||
|
||||
+11
-147
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
|
||||
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include <linux/major.h>
|
||||
#include <linux/kdev_t.h>
|
||||
|
||||
struct key root_dir_key = {0, 0, {{0, 0},}};
|
||||
@@ -81,9 +80,7 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
|
||||
} else {
|
||||
sb = (struct reiserfs_super_block *)bh->b_data;
|
||||
|
||||
if (is_any_reiserfs_magic_string (sb))
|
||||
/* fixme: we could make some check to make sure that super
|
||||
block looks correctly */
|
||||
if (does_look_like_super_block (sb))
|
||||
goto found;
|
||||
|
||||
/* reiserfs signature is not found at the i-th 4k block */
|
||||
@@ -93,6 +90,7 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
|
||||
|
||||
reiserfs_warning (stderr, "reiserfs_open: neither new nor old reiserfs format "
|
||||
"found on %s\n", filename);
|
||||
|
||||
if (error)
|
||||
*error = 0;
|
||||
freemem (fs);
|
||||
@@ -101,9 +99,9 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
|
||||
return fs;
|
||||
|
||||
found:
|
||||
|
||||
|
||||
fs->fs_blocksize = get_sb_block_size (sb);
|
||||
|
||||
|
||||
/* check block size on the filesystem */
|
||||
if (fs->fs_blocksize != 4096) {
|
||||
i = bh->b_blocknr * 4096 / fs->fs_blocksize;
|
||||
@@ -115,13 +113,7 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
|
||||
freemem (fs);
|
||||
return 0;
|
||||
}
|
||||
sb = (struct reiserfs_super_block *)bh->b_data;
|
||||
if (!does_look_like_super_block (sb, fs->fs_blocksize)) {
|
||||
reiserfs_warning (stderr, "reiserfs_open: no reiserfs in %d, size %d\n",
|
||||
i, fs->fs_blocksize);
|
||||
freemem (fs);
|
||||
return 0;
|
||||
}
|
||||
sb = (struct reiserfs_super_block *)bh->b_data;
|
||||
}
|
||||
|
||||
fs->fs_hash_function = code2func (get_sb_hash_code (sb));
|
||||
@@ -1185,34 +1177,8 @@ int can_we_format_it (char * device_name, int force)
|
||||
reiserfs_warning (stderr, "%s is not a block special device", device_name);
|
||||
check_forcing_ask_confirmation (force);
|
||||
} else {
|
||||
/* from e2progs-1.18/misc/mke2fs.c */
|
||||
|
||||
|
||||
/*FIXME: it should be probably rewritten for 2.5 later*/
|
||||
#ifndef MAJOR
|
||||
#define MAJOR(dev) ((dev)>>8)
|
||||
#define MINOR(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
#ifndef SCSI_BLK_MAJOR
|
||||
#define SCSI_BLK_MAJOR(M) ((M) == SCSI_DISK_MAJOR || (M) == SCSI_CDROM_MAJOR)
|
||||
#endif
|
||||
|
||||
#ifndef IDE_DISK_MAJOR
|
||||
#ifdef IDE9_MAJOR
|
||||
#define IDE_DISK_MAJOR(M) (MAJOR(rdev) == IDE0_MAJOR || MAJOR(rdev) == IDE1_MAJOR || \
|
||||
MAJOR(rdev) == IDE2_MAJOR || MAJOR(rdev) == IDE3_MAJOR || \
|
||||
MAJOR(rdev) == IDE4_MAJOR || MAJOR(rdev) == IDE5_MAJOR || \
|
||||
MAJOR(rdev) == IDE6_MAJOR || MAJOR(rdev) == IDE7_MAJOR || \
|
||||
MAJOR(rdev) == IDE8_MAJOR || MAJOR(rdev) == IDE9_MAJOR)
|
||||
#else
|
||||
#define IDE_DISK_MAJOR(M) (MAJOR(rdev) == IDE0_MAJOR || MAJOR(rdev) == IDE1_MAJOR || \
|
||||
MAJOR(rdev) == IDE2_MAJOR || MAJOR(rdev) == IDE3_MAJOR || \
|
||||
MAJOR(rdev) == IDE4_MAJOR || MAJOR(rdev) == IDE5_MAJOR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ((IDE_DISK_MAJOR (MAJOR(rdev)) && MINOR (rdev) % 64 == 0) ||
|
||||
(SCSI_BLK_MAJOR (MAJOR(rdev)) && MINOR (rdev) % 16 == 0)) {
|
||||
if ((IDE_DISK_MAJOR (MAJOR(rdev)) && MINOR(rdev) % 64 == 0) ||
|
||||
(SCSI_BLK_MAJOR (MAJOR(rdev)) && MINOR(rdev) % 16 == 0)) {
|
||||
/* /dev/hda or similar */
|
||||
reiserfs_warning (stderr, "%s is entire device, not just one partition!",
|
||||
device_name);
|
||||
@@ -1223,107 +1189,6 @@ int can_we_format_it (char * device_name, int force)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*tune*/
|
||||
#define check_forcing_ask_confirmation() \
|
||||
if (!Force) {\
|
||||
/* avoid formatting it without being forced */\
|
||||
reiserfs_warning (stderr, "Use -f to force over\n");\
|
||||
return 0;\
|
||||
}\
|
||||
if (Force == 1) {\
|
||||
if (!user_confirmed (stderr, "Continue (y/n):", "y\n"))\
|
||||
return 0;\
|
||||
}\
|
||||
|
||||
|
||||
/* we only can use a file for filesystem or journal if it is either not
|
||||
mounted block device or regular file and we are forced to use it */
|
||||
static int can_we_format_it (char * device_name)
|
||||
{
|
||||
mode_t mode;
|
||||
dev_t rdev;
|
||||
|
||||
|
||||
if (is_mounted (device_name)) {
|
||||
/* device looks mounted */
|
||||
message("'%s' looks mounted.\n", device_name);
|
||||
check_forcing_ask_confirmation ();
|
||||
}
|
||||
|
||||
mode = get_st_mode (device_name);
|
||||
rdev = get_st_rdev (device_name);
|
||||
|
||||
if (!S_ISBLK (mode)) {
|
||||
/* file is not a block device */
|
||||
message("Can not create a journal on not a block device file %s\n", device_name);
|
||||
exit (1);
|
||||
} else {
|
||||
/* from e2progs-1.18/misc/mke2fs.c */
|
||||
if ((MAJOR (rdev) == HD_MAJOR && MINOR (rdev) % 64 == 0) ||
|
||||
(SCSI_BLK_MAJOR (rdev) && MINOR (rdev) % 16 == 0)) {
|
||||
/* /dev/hda or similar */
|
||||
message("%s is entire device, not just one partition!\n",
|
||||
device_name);
|
||||
check_forcing_ask_confirmation ();
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*mkreiserfs*/
|
||||
/* we only can use a file for filesystem or journal if it is either not
|
||||
mounted block device or regular file and we are forced to use it */
|
||||
static int can_we_format_it (char * device_name, int force)
|
||||
{
|
||||
mode_t mode;
|
||||
dev_t rdev;
|
||||
|
||||
if (is_mounted (device_name)) {
|
||||
/* device looks mounted */
|
||||
message("'%s' looks mounted.", device_name);
|
||||
check_forcing_ask_confirmation ();
|
||||
}
|
||||
|
||||
mode = get_st_mode (device_name);
|
||||
rdev = get_st_rdev (device_name);
|
||||
|
||||
if (!S_ISBLK (mode)) {
|
||||
/* file is not a block device */
|
||||
message("%s is not a block special device", device_name);
|
||||
check_forcing_ask_confirmation ();
|
||||
} else {
|
||||
if (((MAJOR (rdev) == IDE0_MAJOR ||
|
||||
MAJOR (rdev) == IDE1_MAJOR ||
|
||||
MAJOR (rdev) == IDE2_MAJOR ||
|
||||
MAJOR (rdev) == IDE3_MAJOR ||
|
||||
MAJOR (rdev) == IDE4_MAJOR ||
|
||||
MAJOR (rdev) == IDE5_MAJOR ||
|
||||
MAJOR (rdev) == IDE6_MAJOR ||
|
||||
MAJOR (rdev) == IDE7_MAJOR ||
|
||||
MAJOR (rdev) == IDE8_MAJOR ||
|
||||
MAJOR (rdev) == IDE9_MAJOR) &&
|
||||
MINOR (rdev) % 64 == 0) ||
|
||||
(SCSI_BLK_MAJOR (MAJOR (rdev)) &&
|
||||
MINOR (rdev) % 16 == 0)) {
|
||||
/* /dev/hda or similar */
|
||||
message("%s is entire device, not just one partition!",
|
||||
device_name);
|
||||
check_forcing_ask_confirmation ();
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
int create_badblock_bitmap (reiserfs_filsys_t * fs, char * badblocks_file) {
|
||||
FILE * fd;
|
||||
char buf[128];
|
||||
@@ -1368,7 +1233,7 @@ void add_badblock_list (reiserfs_filsys_t * fs, int no_badblock_in_tree_yet) {
|
||||
struct item_head * tmp_ih;
|
||||
struct item_head badblock_ih;
|
||||
// char item[UNFM_P_SIZE];
|
||||
struct unfm_nodeinfo ni;
|
||||
__u32 ni;
|
||||
|
||||
__u64 offset;
|
||||
__u32 i, j;
|
||||
@@ -1416,7 +1281,6 @@ void add_badblock_list (reiserfs_filsys_t * fs, int no_badblock_in_tree_yet) {
|
||||
set_type (KEY_FORMAT_2, &badblock_ih.ih_key, TYPE_INDIRECT);
|
||||
|
||||
j = 0;
|
||||
ni.unfm_freespace = 0;
|
||||
|
||||
/* insert all badblock pointers */
|
||||
for (i = 0; i < fs->fs_badblocks_bm->bm_bit_size; i++) {
|
||||
@@ -1427,7 +1291,7 @@ void add_badblock_list (reiserfs_filsys_t * fs, int no_badblock_in_tree_yet) {
|
||||
|
||||
offset = j * fs->fs_blocksize + 1;
|
||||
set_offset (KEY_FORMAT_2, &badblock_ih.ih_key, offset);
|
||||
ni.unfm_nodenum = cpu_to_le32 (i);
|
||||
ni = cpu_to_le32 (i);
|
||||
|
||||
retval = usearch_by_position (fs, &badblock_ih.ih_key, key_format (&badblock_ih.ih_key), &badblock_path);
|
||||
|
||||
@@ -1436,7 +1300,7 @@ void add_badblock_list (reiserfs_filsys_t * fs, int no_badblock_in_tree_yet) {
|
||||
init_tb_struct (&tb, fs, &badblock_path, IH_SIZE + get_ih_item_len(&badblock_ih));
|
||||
if (fix_nodes (/*tb.transaction_handle,*/ M_INSERT, &tb, &badblock_ih/*, body*/) != CARRY_ON)
|
||||
die ("reiserfsck_insert_item: fix_nodes failed");
|
||||
do_balance (/*tb.transaction_handle,*/ &tb, &badblock_ih, (void *)&ni.unfm_nodenum , M_INSERT, 0/*zero num*/);
|
||||
do_balance (/*tb.transaction_handle,*/ &tb, &badblock_ih, (void *)&ni , M_INSERT, 0/*zero num*/);
|
||||
|
||||
// reiserfsck_insert_item (&badblock_path, &badblock_ih, item);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details
|
||||
* Copyright 1996-2002 Hans Reiser, see reiserfs/README for licensing and copyright details
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains functions dealing with S+tree
|
||||
* This file contains functions dealing with internal tree
|
||||
*
|
||||
* comp_keys
|
||||
* comp_short_keys
|
||||
@@ -280,7 +280,7 @@ void pathrelse (struct path * p_s_search_path)
|
||||
|
||||
/**************************************************************************
|
||||
* Algorithm SearchByKey *
|
||||
* look for item in the Disk S+Tree by its key *
|
||||
* look for item in internal tree on the disk by its key *
|
||||
* Input: p_s_sb - super block *
|
||||
* p_s_key - pointer to the key to search *
|
||||
* Output: true value - 1 - found, 0 - not found *
|
||||
|
||||
Reference in new issue
Block a user