if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND)  
result = search_for_position_by_key (inode->i_sb, &key, &path); if (result != POSITION_FOUND)  
static int _get_block_create_0 (struct inode * inode, long block,				 struct buffer_head * bh_result,				 int args){    INITIALIZE_PATH (path);    struct cpu_key key;    struct buffer_head * bh;    struct item_head * ih, tmp_ih;    int fs_gen ;    int blocknr;    char * p = NULL;    int chars;    int ret ;    int done = 0 ;    unsigned long offset ;    // prepare the key to look for the 'block'-th block of file    make_cpu_key (&key, inode,		  (loff_t)block * inode->i_sb->s_blocksize + 1, TYPE_ANY, 3);research:    if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND) {	pathrelse (&path);        if (p)            kunmap(bh_result->b_page) ;	// We do not return -ENOENT if there is a hole but page is uptodate, because it means	// That there is some MMAPED data associated with it that is yet to be written to disk.	if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) {	    return -ENOENT ;	}        return 0 ;    }        //    bh = get_last_bh (&path);    ih = get_ih (&path);    if (is_indirect_le_ih (ih)) {	__le32 * ind_item = (__le32 *)B_I_PITEM (bh, ih);		/* FIXME: here we could cache indirect item or part of it in	   the inode to avoid search_by_key in case of subsequent	   access to file */	blocknr = get_block_num(ind_item, path.pos_in_item) ;	ret = 0 ;	if (blocknr) {	    map_bh(bh_result, inode->i_sb, blocknr);	    if (path.pos_in_item == ((ih_item_len(ih) / UNFM_P_SIZE) - 1)) {		set_buffer_boundary(bh_result);	    }	} else 	    // We do not return -ENOENT if there is a hole but page is uptodate, because it means	    // That there is some MMAPED data associated with it that is yet to  be written to disk.	    if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) {	    ret = -ENOENT ;	    }	pathrelse (&path);        if (p)            kunmap(bh_result->b_page) ;	return ret ;    }    // requested data are in direct item(s)    if (!(args & GET_BLOCK_READ_DIRECT)) {	// we are called by bmap. FIXME: we can not map block of file	// when it is stored in direct item(s)	pathrelse (&path);	        if (p)            kunmap(bh_result->b_page) ;	return -ENOENT;    }    /* if we've got a direct item, and the buffer or page was uptodate,    ** we don't want to pull data off disk again.  skip to the    ** end, where we map the buffer and return    */    if (buffer_uptodate(bh_result)) {        goto finished ;    } else 	/*	** grab_tail_page can trigger calls to reiserfs_get_block on up to date	** pages without any buffers.  If the page is up to date, we don't want	** read old data off disk.  Set the up to date bit on the buffer instead	** and jump to the end	*/	    if (!bh_result->b_page || PageUptodate(bh_result->b_page)) {		set_buffer_uptodate(bh_result);		goto finished ;    }    // read file tail into part of page    offset = (cpu_key_k_offset(&key) - 1) & (PAGE_CACHE_SIZE - 1) ;    fs_gen = get_generation(inode->i_sb) ;    copy_item_head (&tmp_ih, ih);    /* we only want to kmap if we are reading the tail into the page.    ** this is not the common case, so we don't kmap until we are    ** sure we need to.  But, this means the item might move if    ** kmap schedules    */    if (!p) {	p = (char *)kmap(bh_result->b_page) ;	if (fs_changed (fs_gen, inode->i_sb) && item_moved (&tmp_ih, &path)) {	    goto research;	}    }    p += offset ;    memset (p, 0, inode->i_sb->s_blocksize);    do {	if (!is_direct_le_ih (ih)) {	    BUG ();        }	/* make sure we don't read more bytes than actually exist in	** the file.  This can happen in odd cases where i_size isn't	** correct, and when direct item padding results in a few 	** extra bytes at the end of the direct item	*/        if ((le_ih_k_offset(ih) + path.pos_in_item) > inode->i_size)	    break ;	if ((le_ih_k_offset(ih) - 1 + ih_item_len(ih)) > inode->i_size) {	    chars = inode->i_size - (le_ih_k_offset(ih) - 1) - path.pos_in_item;	    done = 1 ;	} else {	    chars = ih_item_len(ih) - path.pos_in_item;	}	memcpy (p, B_I_PITEM (bh, ih) + path.pos_in_item, chars);	if (done) 	    break ;	p += chars;	if (PATH_LAST_POSITION (&path) != (B_NR_ITEMS (bh) - 1))	    // we done, if read direct item is not the last item of	    // node FIXME: we could try to check right delimiting key	    // to see whether direct item continues in the right	    // neighbor or rely on i_size	    break;	// update key to look for the next piece	set_cpu_key_k_offset (&key, cpu_key_k_offset (&key) + chars);	if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND)	    // we read something from tail, even if now we got IO_ERROR	    break;	bh = get_last_bh (&path);	ih = get_ih (&path);    } while (1);    flush_dcache_page(bh_result->b_page) ;    kunmap(bh_result->b_page) ;finished:    pathrelse (&path);    /* this buffer has valid data, but isn't valid for io.  mapping it to     * block #0 tells the rest of reiserfs it just has a tail in it     */    map_bh(bh_result, inode->i_sb, 0);    set_buffer_uptodate (bh_result);    return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6283d58e7464f82b1c1c33943f0bd51c1e83899a/inode.c/clean/fs/reiserfs/inode.c