Commit 32f123a3 authored by Jan Kara's avatar Jan Kara

udf: Fold udf_getblk() into udf_bread()

udf_getblk() has a single call site. Fold it there.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 541e047b
......@@ -401,31 +401,6 @@ static int udf_get_block(struct inode *inode, sector_t block,
return 0;
}
static struct buffer_head *udf_getblk(struct inode *inode, udf_pblk_t block,
int create, int *err)
{
struct buffer_head *bh;
struct udf_map_rq map = {
.lblk = block,
.iflags = UDF_MAP_NOPREALLOC | (create ? UDF_MAP_CREATE : 0),
};
*err = udf_map_block(inode, &map);
if (!*err && map.oflags & UDF_BLK_MAPPED) {
bh = sb_getblk(inode->i_sb, map.pblk);
if (map.oflags & UDF_BLK_NEW) {
lock_buffer(bh);
memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);
set_buffer_uptodate(bh);
unlock_buffer(bh);
mark_buffer_dirty_inode(bh, inode);
}
return bh;
}
return NULL;
}
/* Extend the file with new blocks totaling 'new_block_bytes',
* return the number of extents added
*/
......@@ -1140,11 +1115,29 @@ struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block,
int create, int *err)
{
struct buffer_head *bh = NULL;
struct udf_map_rq map = {
.lblk = block,
.iflags = UDF_MAP_NOPREALLOC | (create ? UDF_MAP_CREATE : 0),
};
bh = udf_getblk(inode, block, create, err);
if (!bh)
*err = udf_map_block(inode, &map);
if (*err || !(map.oflags & UDF_BLK_MAPPED))
return NULL;
bh = sb_getblk(inode->i_sb, map.pblk);
if (!bh) {
*err = -ENOMEM;
return NULL;
}
if (map.oflags & UDF_BLK_NEW) {
lock_buffer(bh);
memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);
set_buffer_uptodate(bh);
unlock_buffer(bh);
mark_buffer_dirty_inode(bh, inode);
return bh;
}
if (bh_read(bh, 0) >= 0)
return bh;
......
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