Commit 866aa8f7 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://thebsh.namesys.com/bk/reiser3-linux-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 964f2d4d 0b2f5974
......@@ -6,7 +6,7 @@ obj-$(CONFIG_REISERFS_FS) += reiserfs.o
reiserfs-objs := bitmap.o do_balan.o namei.o inode.o file.o dir.o fix_node.o \
super.o prints.o objectid.o lbalance.o ibalance.o stree.o \
hashes.o buffer2.o tail_conversion.o journal.o resize.o \
hashes.o tail_conversion.o journal.o resize.o \
item_ops.o ioctl.o procfs.o
# gcc -O2 (the kernel default) is overaggressive on ppc32 when many inline
......
/*
* Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
*/
#include <linux/config.h>
#include <linux/time.h>
#include <linux/reiserfs_fs.h>
#include <linux/smp_lock.h>
#include <linux/kernel_stat.h>
#include <linux/buffer_head.h>
/*
* wait_buffer_until_released
* reiserfs_bread
*/
/* when we allocate a new block (get_new_buffer, get_empty_nodes) and
get buffer for it, it is possible that it is held by someone else
or even by this process. In this function we wait until all other
holders release buffer. To make sure, that current process does not
hold we did free all buffers in tree balance structure
(get_empty_nodes and get_nodes_for_preserving) or in path structure
only (get_new_buffer) just before calling this */
void wait_buffer_until_released (const struct buffer_head * bh)
{
int repeat_counter = 0;
/*
* FIXME! Temporary cludge until ReiserFS people tell what they
* actually are trying to protect against!
*/
if (1)
return;
while (atomic_read (&(bh->b_count)) > 1) {
if ( !(++repeat_counter % 30000000) ) {
reiserfs_warning ("vs-3050: wait_buffer_until_released: nobody releases buffer (%b). Still waiting (%d) %cJDIRTY %cJWAIT\n",
bh, repeat_counter, buffer_journaled(bh) ? ' ' : '!',
buffer_journal_dirty(bh) ? ' ' : '!');
}
blk_run_queues();
yield();
}
if (repeat_counter > 30000000) {
reiserfs_warning("vs-3051: done waiting, ignore vs-3050 messages for (%b)\n", bh) ;
}
}
/*
* reiserfs_bread() reads a specified block and returns the buffer that contains
* it. It returns NULL if the block was unreadable.
*/
/* It first tries to find the block in cache, and if it cannot do so
then it creates a new buffer and schedules I/O to read the
block. */
/* The function is NOT SCHEDULE-SAFE! */
struct buffer_head * reiserfs_bread (struct super_block *super, int n_block)
{
struct buffer_head *result;
PROC_EXP( unsigned int ctx_switches = nr_context_switches() );
result = sb_bread(super, n_block);
PROC_INFO_INC( super, breads );
PROC_EXP( if( nr_context_switches() != ctx_switches )
PROC_INFO_INC( super, bread_miss ) );
return result;
}
......@@ -1078,13 +1078,9 @@ static int balance_leaf (struct tree_balance * tb,
memcpy (insert_key + i,B_N_PKEY(S_new[i],0),KEY_SIZE);
insert_ptr[i] = S_new[i];
RFALSE( (atomic_read (&(S_new[i]->b_count)) != 1) &&
(atomic_read(&(S_new[i]->b_count)) != 2 ||
!(buffer_journaled(S_new[i]) ||
buffer_journal_dirty(S_new[i]))),
RFALSE (!buffer_journaled (S_new [i]) || buffer_journal_dirty (S_new [i]) ||
buffer_dirty (S_new [i]),
"PAP-12247: S_new[%d] : (%b)\n", i, S_new[i]);
}
/* if the affected item was not wholly shifted then we perform all necessary operations on that part or whole of the
......
......@@ -807,32 +807,15 @@ static int get_empty_nodes(
"PAP-8135: reiserfs_new_blocknrs failed when got new blocks");
p_s_new_bh = sb_getblk(p_s_sb, *p_n_blocknr);
if (atomic_read (&(p_s_new_bh->b_count)) > 1) {
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*
reiserfs_warning ("waiting for buffer %b, iput inode pid = %d, this pid %d, mode %c, %h\n",
p_s_new_bh, put_inode_pid, current->pid, p_s_tb->tb_vn->vn_mode, p_s_tb->tb_vn->vn_ins_ih);
print_tb (0, 0, 0, p_s_tb, "tb");
*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
if (atomic_read(&(p_s_new_bh->b_count)) > 2 ||
!(buffer_journaled(p_s_new_bh) || buffer_journal_dirty(p_s_new_bh))) {
n_retval = REPEAT_SEARCH ;
free_buffers_in_tb (p_s_tb);
wait_buffer_until_released (p_s_new_bh);
}
}
RFALSE( (atomic_read (&(p_s_new_bh->b_count)) != 1 ||
buffer_dirty (p_s_new_bh)) &&
(atomic_read(&(p_s_new_bh->b_count)) > 2 ||
!(buffer_journaled(p_s_new_bh) ||
buffer_journal_dirty(p_s_new_bh))),
"PAP-8140: not free or dirty buffer %b for the new block",
RFALSE (buffer_dirty (p_s_new_bh) ||
buffer_journaled (p_s_new_bh) ||
buffer_journal_dirty (p_s_new_bh),
"PAP-8140: journlaled or dirty buffer %b for the new block",
p_s_new_bh);
/* Put empty buffers into the array. */
if (p_s_tb->FEB[p_s_tb->cur_blknum])
BUG();
RFALSE (p_s_tb->FEB[p_s_tb->cur_blknum],
"PAP-8141: busy slot for new buffer");
mark_buffer_journal_new(p_s_new_bh) ;
p_s_tb->FEB[p_s_tb->cur_blknum++] = p_s_new_bh;
......@@ -1926,7 +1909,7 @@ static int get_neighbors(
n_child_position = ( p_s_bh == p_s_tb->FL[n_h] ) ? p_s_tb->lkey[n_h] : B_NR_ITEMS (p_s_tb->FL[n_h]);
n_son_number = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position);
p_s_bh = reiserfs_bread(p_s_sb, n_son_number);
p_s_bh = sb_bread(p_s_sb, n_son_number);
if (!p_s_bh)
return IO_ERROR;
if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) {
......@@ -1959,7 +1942,7 @@ static int get_neighbors(
n_child_position = ( p_s_bh == p_s_tb->FR[n_h] ) ? p_s_tb->rkey[n_h] + 1 : 0;
n_son_number = B_N_CHILD_NUM(p_s_tb->FR[n_h], n_child_position);
p_s_bh = reiserfs_bread(p_s_sb, n_son_number);
p_s_bh = sb_bread(p_s_sb, n_son_number);
if (!p_s_bh)
return IO_ERROR;
if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) {
......
......@@ -1028,10 +1028,9 @@ int balance_internal (struct tree_balance * tb, /* tree_balance structure */
/* new_insert_ptr = node_pointer to S_new */
new_insert_ptr = S_new;
RFALSE(( buffer_locked(S_new) || atomic_read (&(S_new->b_count)) != 1) &&
(buffer_locked(S_new) || atomic_read(&(S_new->b_count)) > 2 ||
!(buffer_journaled(S_new) || buffer_journal_dirty(S_new))),
"cm-00001: bad S_new (%b)", S_new);
RFALSE (!buffer_journaled(S_new) || buffer_journal_dirty(S_new) ||
buffer_dirty (S_new),
"cm-00001: bad S_new (%b)", S_new);
// S_new is released in unfix_nodes
}
......
......@@ -700,7 +700,7 @@ int search_by_key (struct super_block * p_s_sb,
/* Read the next tree node, and set the last element in the path to
have a pointer to it. */
if ( ! (p_s_bh = p_s_last_element->pe_buffer =
reiserfs_bread(p_s_sb, n_block_number)) ) {
sb_bread(p_s_sb, n_block_number)) ) {
p_s_search_path->path_length --;
pathrelse(p_s_search_path);
return IO_ERROR;
......
......@@ -775,7 +775,7 @@ static int read_old_bitmaps (struct super_block * s)
memset (SB_AP_BITMAP (s), 0, sizeof (struct buffer_head *) * sb_bmap_nr(rs));
for (i = 0; i < sb_bmap_nr(rs); i ++) {
SB_AP_BITMAP (s)[i] = reiserfs_bread (s, bmp1 + i);
SB_AP_BITMAP (s)[i] = sb_bread (s, bmp1 + i);
if (!SB_AP_BITMAP (s)[i])
return 1;
}
......@@ -827,7 +827,7 @@ static int read_super_block (struct super_block * s, int offset)
sb_set_blocksize (s, sb_blocksize(rs));
brelse (bh);
bh = reiserfs_bread (s, offset / s->s_blocksize);
bh = sb_bread (s, offset / s->s_blocksize);
if (!bh) {
printk("sh-2007: read_super_block: "
"bread failed (dev %s, block %lu, size %lu)\n",
......
......@@ -1937,14 +1937,6 @@ void reiserfs_unmap_buffer(struct buffer_head *) ;
extern struct inode_operations reiserfs_file_inode_operations;
extern struct file_operations reiserfs_file_operations;
extern struct address_space_operations reiserfs_address_space_operations ;
int get_new_buffer (struct reiserfs_transaction_handle *th, struct buffer_head *,
struct buffer_head **, struct path *);
/* buffer2.c */
struct buffer_head * reiserfs_getblk (struct super_block *super, int n_block);
void wait_buffer_until_released (const struct buffer_head * bh);
struct buffer_head * reiserfs_bread (struct super_block *super, int n_block);
/* fix_nodes.c */
#ifdef CONFIG_REISERFS_CHECK
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment