Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114416
b: refs/heads/master
c: 07446dc
h: refs/heads/master
v: v3
  • Loading branch information
Joel Becker authored and Mark Fasheh committed Oct 14, 2008
1 parent c7ca4c2 commit 83a2548
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 53 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0fcaa56a2a020dd6f90c202b7084e6f4cbedb6c2
refs/heads/master: 07446dc72cffcc6e2672d0e54061dcd1858725ba
43 changes: 43 additions & 0 deletions trunk/fs/ocfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,49 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
struct ocfs2_alloc_context *meta_ac,
struct buffer_head **new_bh);

static struct buffer_head *ocfs2_bread(struct inode *inode,
int block, int *err, int reada)
{
struct buffer_head *bh = NULL;
int tmperr;
u64 p_blkno;
int readflags = OCFS2_BH_CACHED;

if (reada)
readflags |= OCFS2_BH_READAHEAD;

if (((u64)block << inode->i_sb->s_blocksize_bits) >=
i_size_read(inode)) {
BUG_ON(!reada);
return NULL;
}

down_read(&OCFS2_I(inode)->ip_alloc_sem);
tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL,
NULL);
up_read(&OCFS2_I(inode)->ip_alloc_sem);
if (tmperr < 0) {
mlog_errno(tmperr);
goto fail;
}

tmperr = ocfs2_read_blocks(inode, p_blkno, 1, &bh, readflags);
if (tmperr < 0)
goto fail;

tmperr = 0;

*err = 0;
return bh;

fail:
brelse(bh);
bh = NULL;

*err = -EIO;
return NULL;
}

/*
* bh passed here can be an inode block or a dir data block, depending
* on the inode inline data flag.
Expand Down
50 changes: 0 additions & 50 deletions trunk/fs/ocfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,56 +1132,6 @@ void ocfs2_drop_inode(struct inode *inode)
mlog_exit_void();
}

/*
* TODO: this should probably be merged into ocfs2_get_block
*
* However, you now need to pay attention to the cont_prepare_write()
* stuff in ocfs2_get_block (that is, ocfs2_get_block pretty much
* expects never to extend).
*/
struct buffer_head *ocfs2_bread(struct inode *inode,
int block, int *err, int reada)
{
struct buffer_head *bh = NULL;
int tmperr;
u64 p_blkno;
int readflags = OCFS2_BH_CACHED;

if (reada)
readflags |= OCFS2_BH_READAHEAD;

if (((u64)block << inode->i_sb->s_blocksize_bits) >=
i_size_read(inode)) {
BUG_ON(!reada);
return NULL;
}

down_read(&OCFS2_I(inode)->ip_alloc_sem);
tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL,
NULL);
up_read(&OCFS2_I(inode)->ip_alloc_sem);
if (tmperr < 0) {
mlog_errno(tmperr);
goto fail;
}

tmperr = ocfs2_read_blocks(inode, p_blkno, 1, &bh, readflags);
if (tmperr < 0)
goto fail;

tmperr = 0;

*err = 0;
return bh;

fail:
brelse(bh);
bh = NULL;

*err = -EIO;
return NULL;
}

/*
* This is called from our getattr.
*/
Expand Down
2 changes: 0 additions & 2 deletions trunk/fs/ocfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ extern struct kmem_cache *ocfs2_inode_cache;

extern const struct address_space_operations ocfs2_aops;

struct buffer_head *ocfs2_bread(struct inode *inode, int block,
int *err, int reada);
void ocfs2_clear_inode(struct inode *inode);
void ocfs2_delete_inode(struct inode *inode);
void ocfs2_drop_inode(struct inode *inode);
Expand Down

0 comments on commit 83a2548

Please sign in to comment.