提交 3bf25cb4 编写于 作者: J Jan Kara 提交者: Linus Torvalds

udf: use get_bh()

Make UDF use get_bh() instead of directly accessing b_count and use
brelse() instead of udf_release_data() which does just brelse()...
Signed-off-by: NJan Kara <jack@suse.cz>
Acked-by: NChristoph Hellwig <hch@infradead.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 ff116fc8
...@@ -508,8 +508,8 @@ static void udf_table_free_blocks(struct super_block * sb, ...@@ -508,8 +508,8 @@ static void udf_table_free_blocks(struct super_block * sb,
{ {
i = -1; i = -1;
oepos.block = epos.block; oepos.block = epos.block;
udf_release_data(oepos.bh); brelse(oepos.bh);
atomic_inc(&epos.bh->b_count); get_bh(epos.bh);
oepos.bh = epos.bh; oepos.bh = epos.bh;
oepos.offset = 0; oepos.offset = 0;
} }
...@@ -546,8 +546,8 @@ static void udf_table_free_blocks(struct super_block * sb, ...@@ -546,8 +546,8 @@ static void udf_table_free_blocks(struct super_block * sb,
adsize = sizeof(long_ad); adsize = sizeof(long_ad);
else else
{ {
udf_release_data(oepos.bh); brelse(oepos.bh);
udf_release_data(epos.bh); brelse(epos.bh);
goto error_return; goto error_return;
} }
...@@ -556,7 +556,7 @@ static void udf_table_free_blocks(struct super_block * sb, ...@@ -556,7 +556,7 @@ static void udf_table_free_blocks(struct super_block * sb,
char *sptr, *dptr; char *sptr, *dptr;
int loffset; int loffset;
udf_release_data(oepos.bh); brelse(oepos.bh);
oepos = epos; oepos = epos;
/* Steal a block from the extent being free'd */ /* Steal a block from the extent being free'd */
...@@ -567,7 +567,7 @@ static void udf_table_free_blocks(struct super_block * sb, ...@@ -567,7 +567,7 @@ static void udf_table_free_blocks(struct super_block * sb,
if (!(epos.bh = udf_tread(sb, if (!(epos.bh = udf_tread(sb,
udf_get_lb_pblock(sb, epos.block, 0)))) udf_get_lb_pblock(sb, epos.block, 0))))
{ {
udf_release_data(oepos.bh); brelse(oepos.bh);
goto error_return; goto error_return;
} }
aed = (struct allocExtDesc *)(epos.bh->b_data); aed = (struct allocExtDesc *)(epos.bh->b_data);
...@@ -658,8 +658,8 @@ static void udf_table_free_blocks(struct super_block * sb, ...@@ -658,8 +658,8 @@ static void udf_table_free_blocks(struct super_block * sb,
} }
} }
udf_release_data(epos.bh); brelse(epos.bh);
udf_release_data(oepos.bh); brelse(oepos.bh);
error_return: error_return:
sb->s_dirt = 1; sb->s_dirt = 1;
...@@ -723,7 +723,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb, ...@@ -723,7 +723,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb,
else else
alloc_count = 0; alloc_count = 0;
udf_release_data(epos.bh); brelse(epos.bh);
if (alloc_count && UDF_SB_LVIDBH(sb)) if (alloc_count && UDF_SB_LVIDBH(sb))
{ {
...@@ -789,9 +789,9 @@ static int udf_table_new_block(struct super_block * sb, ...@@ -789,9 +789,9 @@ static int udf_table_new_block(struct super_block * sb,
spread = nspread; spread = nspread;
if (goal_epos.bh != epos.bh) if (goal_epos.bh != epos.bh)
{ {
udf_release_data(goal_epos.bh); brelse(goal_epos.bh);
goal_epos.bh = epos.bh; goal_epos.bh = epos.bh;
atomic_inc(&goal_epos.bh->b_count); get_bh(goal_epos.bh);
} }
goal_epos.block = epos.block; goal_epos.block = epos.block;
goal_epos.offset = epos.offset - adsize; goal_epos.offset = epos.offset - adsize;
...@@ -800,11 +800,11 @@ static int udf_table_new_block(struct super_block * sb, ...@@ -800,11 +800,11 @@ static int udf_table_new_block(struct super_block * sb,
} }
} }
udf_release_data(epos.bh); brelse(epos.bh);
if (spread == 0xFFFFFFFF) if (spread == 0xFFFFFFFF)
{ {
udf_release_data(goal_epos.bh); brelse(goal_epos.bh);
mutex_unlock(&sbi->s_alloc_mutex); mutex_unlock(&sbi->s_alloc_mutex);
return 0; return 0;
} }
...@@ -820,7 +820,7 @@ static int udf_table_new_block(struct super_block * sb, ...@@ -820,7 +820,7 @@ static int udf_table_new_block(struct super_block * sb,
if (inode && DQUOT_ALLOC_BLOCK(inode, 1)) if (inode && DQUOT_ALLOC_BLOCK(inode, 1))
{ {
udf_release_data(goal_epos.bh); brelse(goal_epos.bh);
mutex_unlock(&sbi->s_alloc_mutex); mutex_unlock(&sbi->s_alloc_mutex);
*err = -EDQUOT; *err = -EDQUOT;
return 0; return 0;
...@@ -830,7 +830,7 @@ static int udf_table_new_block(struct super_block * sb, ...@@ -830,7 +830,7 @@ static int udf_table_new_block(struct super_block * sb,
udf_write_aext(table, &goal_epos, goal_eloc, goal_elen, 1); udf_write_aext(table, &goal_epos, goal_eloc, goal_elen, 1);
else else
udf_delete_aext(table, goal_epos, goal_eloc, goal_elen); udf_delete_aext(table, goal_epos, goal_eloc, goal_elen);
udf_release_data(goal_epos.bh); brelse(goal_epos.bh);
if (UDF_SB_LVIDBH(sb)) if (UDF_SB_LVIDBH(sb))
{ {
...@@ -915,11 +915,14 @@ inline int udf_new_block(struct super_block * sb, ...@@ -915,11 +915,14 @@ inline int udf_new_block(struct super_block * sb,
struct inode * inode, struct inode * inode,
uint16_t partition, uint32_t goal, int *err) uint16_t partition, uint32_t goal, int *err)
{ {
int ret;
if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP)
{ {
return udf_bitmap_new_block(sb, inode, ret = udf_bitmap_new_block(sb, inode,
UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_bitmap, UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_bitmap,
partition, goal, err); partition, goal, err);
return ret;
} }
else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE)
{ {
......
...@@ -144,7 +144,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d ...@@ -144,7 +144,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block)))
{ {
udf_release_data(epos.bh); brelse(epos.bh);
return -EIO; return -EIO;
} }
...@@ -172,7 +172,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d ...@@ -172,7 +172,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
} }
else else
{ {
udf_release_data(epos.bh); brelse(epos.bh);
return -ENOENT; return -ENOENT;
} }
...@@ -185,9 +185,9 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d ...@@ -185,9 +185,9 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
if (!fi) if (!fi)
{ {
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
udf_release_data(epos.bh); brelse(epos.bh);
return 0; return 0;
} }
...@@ -245,9 +245,9 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d ...@@ -245,9 +245,9 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
if (filldir(dirent, fname, flen, filp->f_pos, iblock, dt_type) < 0) if (filldir(dirent, fname, flen, filp->f_pos, iblock, dt_type) < 0)
{ {
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
udf_release_data(epos.bh); brelse(epos.bh);
return 0; return 0;
} }
} }
...@@ -256,9 +256,9 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d ...@@ -256,9 +256,9 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
filp->f_pos = nf_pos + 1; filp->f_pos = nf_pos + 1;
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
udf_release_data(epos.bh); brelse(epos.bh);
return 0; return 0;
} }
...@@ -36,14 +36,14 @@ udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size, ...@@ -36,14 +36,14 @@ udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size,
if (!ad) if (!ad)
{ {
udf_release_data(*bh); brelse(*bh);
*error = 1; *error = 1;
return NULL; return NULL;
} }
if (*offset == dir->i_sb->s_blocksize) if (*offset == dir->i_sb->s_blocksize)
{ {
udf_release_data(*bh); brelse(*bh);
block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos); block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
if (!block) if (!block)
return NULL; return NULL;
...@@ -57,7 +57,7 @@ udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size, ...@@ -57,7 +57,7 @@ udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size,
remainder = dir->i_sb->s_blocksize - loffset; remainder = dir->i_sb->s_blocksize - loffset;
memcpy((uint8_t *)ad, (*bh)->b_data + loffset, remainder); memcpy((uint8_t *)ad, (*bh)->b_data + loffset, remainder);
udf_release_data(*bh); brelse(*bh);
block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos); block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
if (!block) if (!block)
return NULL; return NULL;
...@@ -120,7 +120,7 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -120,7 +120,7 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
else else
epos->offset = lextoffset; epos->offset = lextoffset;
udf_release_data(fibh->sbh); brelse(fibh->sbh);
if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block))) if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block)))
return NULL; return NULL;
fibh->soffset = fibh->eoffset = 0; fibh->soffset = fibh->eoffset = 0;
...@@ -149,7 +149,7 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -149,7 +149,7 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
} }
else if (fibh->sbh != fibh->ebh) else if (fibh->sbh != fibh->ebh)
{ {
udf_release_data(fibh->sbh); brelse(fibh->sbh);
fibh->sbh = fibh->ebh; fibh->sbh = fibh->ebh;
} }
......
...@@ -247,7 +247,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int ...@@ -247,7 +247,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int
sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, NULL, NULL, NULL); sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, NULL, NULL, NULL);
if (!sfi) if (!sfi)
{ {
udf_release_data(dbh); brelse(dbh);
return NULL; return NULL;
} }
UDF_I_ALLOCTYPE(inode) = alloctype; UDF_I_ALLOCTYPE(inode) = alloctype;
...@@ -259,7 +259,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int ...@@ -259,7 +259,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int
sfi->fileIdent + le16_to_cpu(sfi->lengthOfImpUse))) sfi->fileIdent + le16_to_cpu(sfi->lengthOfImpUse)))
{ {
UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB;
udf_release_data(dbh); brelse(dbh);
return NULL; return NULL;
} }
} }
...@@ -277,7 +277,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int ...@@ -277,7 +277,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int
udf_add_aext(inode, &epos, eloc, elen, 0); udf_add_aext(inode, &epos, eloc, elen, 0);
/* UniqueID stuff */ /* UniqueID stuff */
udf_release_data(epos.bh); brelse(epos.bh);
mark_inode_dirty(inode); mark_inode_dirty(inode);
return dbh; return dbh;
} }
...@@ -386,14 +386,14 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block, ...@@ -386,14 +386,14 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block,
{ {
if (prev_epos.bh != cur_epos.bh) if (prev_epos.bh != cur_epos.bh)
{ {
udf_release_data(prev_epos.bh); brelse(prev_epos.bh);
atomic_inc(&cur_epos.bh->b_count); get_bh(cur_epos.bh);
prev_epos.bh = cur_epos.bh; prev_epos.bh = cur_epos.bh;
} }
if (cur_epos.bh != next_epos.bh) if (cur_epos.bh != next_epos.bh)
{ {
udf_release_data(cur_epos.bh); brelse(cur_epos.bh);
atomic_inc(&next_epos.bh->b_count); get_bh(next_epos.bh);
cur_epos.bh = next_epos.bh; cur_epos.bh = next_epos.bh;
} }
...@@ -436,9 +436,9 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block, ...@@ -436,9 +436,9 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block,
~(inode->i_sb->s_blocksize - 1)); ~(inode->i_sb->s_blocksize - 1));
etype = udf_write_aext(inode, &cur_epos, eloc, elen, 1); etype = udf_write_aext(inode, &cur_epos, eloc, elen, 1);
} }
udf_release_data(prev_epos.bh); brelse(prev_epos.bh);
udf_release_data(cur_epos.bh); brelse(cur_epos.bh);
udf_release_data(next_epos.bh); brelse(next_epos.bh);
newblock = udf_get_lb_pblock(inode->i_sb, eloc, offset); newblock = udf_get_lb_pblock(inode->i_sb, eloc, offset);
*phys = newblock; *phys = newblock;
return NULL; return NULL;
...@@ -492,8 +492,8 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block, ...@@ -492,8 +492,8 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block,
else else
lastblock = 1; lastblock = 1;
} }
udf_release_data(cur_epos.bh); brelse(cur_epos.bh);
udf_release_data(next_epos.bh); brelse(next_epos.bh);
/* if the current extent is not recorded but allocated, get the /* if the current extent is not recorded but allocated, get the
block in the extent corresponding to the requested block */ block in the extent corresponding to the requested block */
...@@ -513,7 +513,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block, ...@@ -513,7 +513,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block,
if (!(newblocknum = udf_new_block(inode->i_sb, inode, if (!(newblocknum = udf_new_block(inode->i_sb, inode,
UDF_I_LOCATION(inode).partitionReferenceNum, goal, err))) UDF_I_LOCATION(inode).partitionReferenceNum, goal, err)))
{ {
udf_release_data(prev_epos.bh); brelse(prev_epos.bh);
*err = -ENOSPC; *err = -ENOSPC;
return NULL; return NULL;
} }
...@@ -538,7 +538,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block, ...@@ -538,7 +538,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block,
the new number of extents is less than the old number */ the new number of extents is less than the old number */
udf_update_extents(inode, laarr, startnum, endnum, &prev_epos); udf_update_extents(inode, laarr, startnum, endnum, &prev_epos);
udf_release_data(prev_epos.bh); brelse(prev_epos.bh);
if (!(newblock = udf_get_pblock(inode->i_sb, newblocknum, if (!(newblock = udf_get_pblock(inode->i_sb, newblocknum,
UDF_I_LOCATION(inode).partitionReferenceNum, 0))) UDF_I_LOCATION(inode).partitionReferenceNum, 0)))
...@@ -934,7 +934,7 @@ __udf_read_inode(struct inode *inode) ...@@ -934,7 +934,7 @@ __udf_read_inode(struct inode *inode)
{ {
printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed ident=%d\n", printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed ident=%d\n",
inode->i_ino, ident); inode->i_ino, ident);
udf_release_data(bh); brelse(bh);
make_bad_inode(inode); make_bad_inode(inode);
return; return;
} }
...@@ -963,35 +963,35 @@ __udf_read_inode(struct inode *inode) ...@@ -963,35 +963,35 @@ __udf_read_inode(struct inode *inode)
ident == TAG_IDENT_EFE) ident == TAG_IDENT_EFE)
{ {
memcpy(&UDF_I_LOCATION(inode), &loc, sizeof(kernel_lb_addr)); memcpy(&UDF_I_LOCATION(inode), &loc, sizeof(kernel_lb_addr));
udf_release_data(bh); brelse(bh);
udf_release_data(ibh); brelse(ibh);
udf_release_data(nbh); brelse(nbh);
__udf_read_inode(inode); __udf_read_inode(inode);
return; return;
} }
else else
{ {
udf_release_data(nbh); brelse(nbh);
udf_release_data(ibh); brelse(ibh);
} }
} }
else else
udf_release_data(ibh); brelse(ibh);
} }
} }
else else
udf_release_data(ibh); brelse(ibh);
} }
else if (le16_to_cpu(fe->icbTag.strategyType) != 4) else if (le16_to_cpu(fe->icbTag.strategyType) != 4)
{ {
printk(KERN_ERR "udf: unsupported strategy type: %d\n", printk(KERN_ERR "udf: unsupported strategy type: %d\n",
le16_to_cpu(fe->icbTag.strategyType)); le16_to_cpu(fe->icbTag.strategyType));
udf_release_data(bh); brelse(bh);
make_bad_inode(inode); make_bad_inode(inode);
return; return;
} }
udf_fill_inode(inode, bh); udf_fill_inode(inode, bh);
udf_release_data(bh); brelse(bh);
} }
static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
...@@ -1334,7 +1334,7 @@ udf_update_inode(struct inode *inode, int do_sync) ...@@ -1334,7 +1334,7 @@ udf_update_inode(struct inode *inode, int do_sync)
use->descTag.tagChecksum += ((uint8_t *)&(use->descTag))[i]; use->descTag.tagChecksum += ((uint8_t *)&(use->descTag))[i];
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
udf_release_data(bh); brelse(bh);
return err; return err;
} }
...@@ -1523,7 +1523,7 @@ udf_update_inode(struct inode *inode, int do_sync) ...@@ -1523,7 +1523,7 @@ udf_update_inode(struct inode *inode, int do_sync)
err = -EIO; err = -EIO;
} }
} }
udf_release_data(bh); brelse(bh);
return err; return err;
} }
...@@ -1670,7 +1670,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, ...@@ -1670,7 +1670,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos,
else else
udf_update_tag(epos->bh->b_data, sizeof(struct allocExtDesc)); udf_update_tag(epos->bh->b_data, sizeof(struct allocExtDesc));
mark_buffer_dirty_inode(epos->bh, inode); mark_buffer_dirty_inode(epos->bh, inode);
udf_release_data(epos->bh); brelse(epos->bh);
} }
else else
mark_inode_dirty(inode); mark_inode_dirty(inode);
...@@ -1761,7 +1761,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos, ...@@ -1761,7 +1761,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
{ {
epos->block = *eloc; epos->block = *eloc;
epos->offset = sizeof(struct allocExtDesc); epos->offset = sizeof(struct allocExtDesc);
udf_release_data(epos->bh); brelse(epos->bh);
if (!(epos->bh = udf_tread(inode->i_sb, udf_get_lb_pblock(inode->i_sb, epos->block, 0)))) if (!(epos->bh = udf_tread(inode->i_sb, udf_get_lb_pblock(inode->i_sb, epos->block, 0))))
{ {
udf_debug("reading block %d failed!\n", udf_debug("reading block %d failed!\n",
...@@ -1841,7 +1841,7 @@ udf_insert_aext(struct inode *inode, struct extent_position epos, ...@@ -1841,7 +1841,7 @@ udf_insert_aext(struct inode *inode, struct extent_position epos,
int8_t etype; int8_t etype;
if (epos.bh) if (epos.bh)
atomic_inc(&epos.bh->b_count); get_bh(epos.bh);
while ((etype = udf_next_aext(inode, &epos, &oeloc, &oelen, 0)) != -1) while ((etype = udf_next_aext(inode, &epos, &oeloc, &oelen, 0)) != -1)
{ {
...@@ -1851,7 +1851,7 @@ udf_insert_aext(struct inode *inode, struct extent_position epos, ...@@ -1851,7 +1851,7 @@ udf_insert_aext(struct inode *inode, struct extent_position epos,
nelen = (etype << 30) | oelen; nelen = (etype << 30) | oelen;
} }
udf_add_aext(inode, &epos, neloc, nelen, 1); udf_add_aext(inode, &epos, neloc, nelen, 1);
udf_release_data(epos.bh); brelse(epos.bh);
return (nelen >> 30); return (nelen >> 30);
} }
...@@ -1865,8 +1865,8 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, ...@@ -1865,8 +1865,8 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos,
if (epos.bh) if (epos.bh)
{ {
atomic_inc(&epos.bh->b_count); get_bh(epos.bh);
atomic_inc(&epos.bh->b_count); get_bh(epos.bh);
} }
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT) if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
...@@ -1886,8 +1886,8 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, ...@@ -1886,8 +1886,8 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos,
if (oepos.bh != epos.bh) if (oepos.bh != epos.bh)
{ {
oepos.block = epos.block; oepos.block = epos.block;
udf_release_data(oepos.bh); brelse(oepos.bh);
atomic_inc(&epos.bh->b_count); get_bh(epos.bh);
oepos.bh = epos.bh; oepos.bh = epos.bh;
oepos.offset = epos.offset - adsize; oepos.offset = epos.offset - adsize;
} }
...@@ -1938,8 +1938,8 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, ...@@ -1938,8 +1938,8 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos,
} }
} }
udf_release_data(epos.bh); brelse(epos.bh);
udf_release_data(oepos.bh); brelse(oepos.bh);
return (elen >> 30); return (elen >> 30);
} }
...@@ -1992,7 +1992,7 @@ long udf_block_map(struct inode *inode, sector_t block) ...@@ -1992,7 +1992,7 @@ long udf_block_map(struct inode *inode, sector_t block)
ret = 0; ret = 0;
unlock_kernel(); unlock_kernel();
udf_release_data(epos.bh); brelse(epos.bh);
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_VARCONV)) if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_VARCONV))
return udf_fixed_to_variable(ret); return udf_fixed_to_variable(ret);
......
...@@ -274,12 +274,6 @@ udf_read_ptagged(struct super_block *sb, kernel_lb_addr loc, uint32_t offset, ui ...@@ -274,12 +274,6 @@ udf_read_ptagged(struct super_block *sb, kernel_lb_addr loc, uint32_t offset, ui
loc.logicalBlockNum + offset, ident); loc.logicalBlockNum + offset, ident);
} }
void udf_release_data(struct buffer_head *bh)
{
if (bh)
brelse(bh);
}
void udf_update_tag(char *data, int length) void udf_update_tag(char *data, int length)
{ {
tag *tptr = (tag *)data; tag *tptr = (tag *)data;
......
...@@ -182,13 +182,13 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -182,13 +182,13 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block))) if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block)))
{ {
udf_release_data(epos.bh); brelse(epos.bh);
return NULL; return NULL;
} }
} }
else else
{ {
udf_release_data(epos.bh); brelse(epos.bh);
return NULL; return NULL;
} }
...@@ -199,9 +199,9 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -199,9 +199,9 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
if (!fi) if (!fi)
{ {
if (fibh->sbh != fibh->ebh) if (fibh->sbh != fibh->ebh)
udf_release_data(fibh->ebh); brelse(fibh->ebh);
udf_release_data(fibh->sbh); brelse(fibh->sbh);
udf_release_data(epos.bh); brelse(epos.bh);
return NULL; return NULL;
} }
...@@ -247,15 +247,15 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -247,15 +247,15 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
{ {
if (udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name)) if (udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name))
{ {
udf_release_data(epos.bh); brelse(epos.bh);
return fi; return fi;
} }
} }
} }
if (fibh->sbh != fibh->ebh) if (fibh->sbh != fibh->ebh)
udf_release_data(fibh->ebh); brelse(fibh->ebh);
udf_release_data(fibh->sbh); brelse(fibh->sbh);
udf_release_data(epos.bh); brelse(epos.bh);
return NULL; return NULL;
} }
...@@ -321,8 +321,8 @@ udf_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) ...@@ -321,8 +321,8 @@ udf_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
if (udf_find_entry(dir, dentry, &fibh, &cfi)) if (udf_find_entry(dir, dentry, &fibh, &cfi))
{ {
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
inode = udf_iget(dir->i_sb, lelb_to_cpu(cfi.icb.extLocation)); inode = udf_iget(dir->i_sb, lelb_to_cpu(cfi.icb.extLocation));
if ( !inode ) if ( !inode )
...@@ -400,7 +400,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -400,7 +400,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block))) if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block)))
{ {
udf_release_data(epos.bh); brelse(epos.bh);
*err = -EIO; *err = -EIO;
return NULL; return NULL;
} }
...@@ -423,9 +423,9 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -423,9 +423,9 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
if (!fi) if (!fi)
{ {
if (fibh->sbh != fibh->ebh) if (fibh->sbh != fibh->ebh)
udf_release_data(fibh->ebh); brelse(fibh->ebh);
udf_release_data(fibh->sbh); brelse(fibh->sbh);
udf_release_data(epos.bh); brelse(epos.bh);
*err = -EIO; *err = -EIO;
return NULL; return NULL;
} }
...@@ -455,7 +455,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -455,7 +455,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
{ {
if (((sizeof(struct fileIdentDesc) + liu + lfi + 3) & ~3) == nfidlen) if (((sizeof(struct fileIdentDesc) + liu + lfi + 3) & ~3) == nfidlen)
{ {
udf_release_data(epos.bh); brelse(epos.bh);
cfi->descTag.tagSerialNum = cpu_to_le16(1); cfi->descTag.tagSerialNum = cpu_to_le16(1);
cfi->fileVersionNum = cpu_to_le16(1); cfi->fileVersionNum = cpu_to_le16(1);
cfi->fileCharacteristics = 0; cfi->fileCharacteristics = 0;
...@@ -478,9 +478,9 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -478,9 +478,9 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name)) udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name))
{ {
if (fibh->sbh != fibh->ebh) if (fibh->sbh != fibh->ebh)
udf_release_data(fibh->ebh); brelse(fibh->ebh);
udf_release_data(fibh->sbh); brelse(fibh->sbh);
udf_release_data(epos.bh); brelse(epos.bh);
*err = -EEXIST; *err = -EEXIST;
return NULL; return NULL;
} }
...@@ -492,14 +492,14 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -492,14 +492,14 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB && if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB &&
sb->s_blocksize - fibh->eoffset < nfidlen) sb->s_blocksize - fibh->eoffset < nfidlen)
{ {
udf_release_data(epos.bh); brelse(epos.bh);
epos.bh = NULL; epos.bh = NULL;
fibh->soffset -= udf_ext0_offset(dir); fibh->soffset -= udf_ext0_offset(dir);
fibh->eoffset -= udf_ext0_offset(dir); fibh->eoffset -= udf_ext0_offset(dir);
f_pos -= (udf_ext0_offset(dir) >> 2); f_pos -= (udf_ext0_offset(dir) >> 2);
if (fibh->sbh != fibh->ebh) if (fibh->sbh != fibh->ebh)
udf_release_data(fibh->ebh); brelse(fibh->ebh);
udf_release_data(fibh->sbh); brelse(fibh->sbh);
if (!(fibh->sbh = fibh->ebh = udf_expand_dir_adinicb(dir, &block, err))) if (!(fibh->sbh = fibh->ebh = udf_expand_dir_adinicb(dir, &block, err)))
return NULL; return NULL;
epos.block = UDF_I_LOCATION(dir); epos.block = UDF_I_LOCATION(dir);
...@@ -519,7 +519,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -519,7 +519,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
fibh->eoffset += nfidlen; fibh->eoffset += nfidlen;
if (fibh->sbh != fibh->ebh) if (fibh->sbh != fibh->ebh)
{ {
udf_release_data(fibh->sbh); brelse(fibh->sbh);
fibh->sbh = fibh->ebh; fibh->sbh = fibh->ebh;
} }
...@@ -541,7 +541,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -541,7 +541,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
fibh->eoffset += nfidlen - sb->s_blocksize; fibh->eoffset += nfidlen - sb->s_blocksize;
if (fibh->sbh != fibh->ebh) if (fibh->sbh != fibh->ebh)
{ {
udf_release_data(fibh->sbh); brelse(fibh->sbh);
fibh->sbh = fibh->ebh; fibh->sbh = fibh->ebh;
} }
...@@ -550,8 +550,8 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -550,8 +550,8 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
if (!(fibh->ebh = udf_bread(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), 1, err))) if (!(fibh->ebh = udf_bread(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), 1, err)))
{ {
udf_release_data(epos.bh); brelse(epos.bh);
udf_release_data(fibh->sbh); brelse(fibh->sbh);
return NULL; return NULL;
} }
...@@ -566,7 +566,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -566,7 +566,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
else else
block ++; block ++;
udf_release_data(fibh->sbh); brelse(fibh->sbh);
fibh->sbh = fibh->ebh; fibh->sbh = fibh->ebh;
fi = (struct fileIdentDesc *)(fibh->sbh->b_data); fi = (struct fileIdentDesc *)(fibh->sbh->b_data);
} }
...@@ -587,7 +587,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -587,7 +587,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
cfi->lengthOfImpUse = cpu_to_le16(0); cfi->lengthOfImpUse = cpu_to_le16(0);
if (!udf_write_fi(dir, cfi, fi, fibh, NULL, name)) if (!udf_write_fi(dir, cfi, fi, fibh, NULL, name))
{ {
udf_release_data(epos.bh); brelse(epos.bh);
dir->i_size += nfidlen; dir->i_size += nfidlen;
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
UDF_I_LENALLOC(dir) += nfidlen; UDF_I_LENALLOC(dir) += nfidlen;
...@@ -596,10 +596,10 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, ...@@ -596,10 +596,10 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
} }
else else
{ {
udf_release_data(epos.bh); brelse(epos.bh);
if (fibh->sbh != fibh->ebh) if (fibh->sbh != fibh->ebh)
udf_release_data(fibh->ebh); brelse(fibh->ebh);
udf_release_data(fibh->sbh); brelse(fibh->sbh);
*err = -EIO; *err = -EIO;
return NULL; return NULL;
} }
...@@ -656,8 +656,8 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, struct ...@@ -656,8 +656,8 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, struct
mark_inode_dirty(dir); mark_inode_dirty(dir);
} }
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
unlock_kernel(); unlock_kernel();
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
return 0; return 0;
...@@ -701,8 +701,8 @@ static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t ...@@ -701,8 +701,8 @@ static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t
mark_inode_dirty(inode); mark_inode_dirty(inode);
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
err = 0; err = 0;
out: out:
...@@ -743,7 +743,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode) ...@@ -743,7 +743,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
cpu_to_le32(UDF_I_UNIQUE(dir) & 0x00000000FFFFFFFFUL); cpu_to_le32(UDF_I_UNIQUE(dir) & 0x00000000FFFFFFFFUL);
cfi.fileCharacteristics = FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT; cfi.fileCharacteristics = FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT;
udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL); udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
inode->i_mode = S_IFDIR | mode; inode->i_mode = S_IFDIR | mode;
if (dir->i_mode & S_ISGID) if (dir->i_mode & S_ISGID)
inode->i_mode |= S_ISGID; inode->i_mode |= S_ISGID;
...@@ -766,8 +766,8 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode) ...@@ -766,8 +766,8 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
mark_inode_dirty(dir); mark_inode_dirty(dir);
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
err = 0; err = 0;
out: out:
unlock_kernel(); unlock_kernel();
...@@ -808,13 +808,13 @@ static int empty_dir(struct inode *dir) ...@@ -808,13 +808,13 @@ static int empty_dir(struct inode *dir)
if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block)))
{ {
udf_release_data(epos.bh); brelse(epos.bh);
return 0; return 0;
} }
} }
else else
{ {
udf_release_data(epos.bh); brelse(epos.bh);
return 0; return 0;
} }
...@@ -826,25 +826,25 @@ static int empty_dir(struct inode *dir) ...@@ -826,25 +826,25 @@ static int empty_dir(struct inode *dir)
if (!fi) if (!fi)
{ {
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
udf_release_data(epos.bh); brelse(epos.bh);
return 0; return 0;
} }
if (cfi.lengthFileIdent && (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) == 0) if (cfi.lengthFileIdent && (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) == 0)
{ {
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
udf_release_data(epos.bh); brelse(epos.bh);
return 0; return 0;
} }
} }
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
udf_release_data(epos.bh); brelse(epos.bh);
return 1; return 1;
} }
...@@ -884,8 +884,8 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry) ...@@ -884,8 +884,8 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry)
end_rmdir: end_rmdir:
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
out: out:
unlock_kernel(); unlock_kernel();
return retval; return retval;
...@@ -928,8 +928,8 @@ static int udf_unlink(struct inode * dir, struct dentry * dentry) ...@@ -928,8 +928,8 @@ static int udf_unlink(struct inode * dir, struct dentry * dentry)
end_unlink: end_unlink:
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
out: out:
unlock_kernel(); unlock_kernel();
return retval; return retval;
...@@ -977,7 +977,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * ...@@ -977,7 +977,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
elen = inode->i_sb->s_blocksize; elen = inode->i_sb->s_blocksize;
UDF_I_LENEXTENTS(inode) = elen; UDF_I_LENEXTENTS(inode) = elen;
udf_add_aext(inode, &epos, eloc, elen, 0); udf_add_aext(inode, &epos, eloc, elen, 0);
udf_release_data(epos.bh); brelse(epos.bh);
block = udf_get_pblock(inode->i_sb, block, block = udf_get_pblock(inode->i_sb, block,
UDF_I_LOCATION(inode).partitionReferenceNum, 0); UDF_I_LOCATION(inode).partitionReferenceNum, 0);
...@@ -1060,7 +1060,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * ...@@ -1060,7 +1060,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
} }
} }
udf_release_data(epos.bh); brelse(epos.bh);
inode->i_size = elen; inode->i_size = elen;
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
UDF_I_LENALLOC(inode) = inode->i_size; UDF_I_LENALLOC(inode) = inode->i_size;
...@@ -1089,8 +1089,8 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * ...@@ -1089,8 +1089,8 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
mark_inode_dirty(dir); mark_inode_dirty(dir);
} }
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
err = 0; err = 0;
...@@ -1145,8 +1145,8 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir, ...@@ -1145,8 +1145,8 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir,
mark_inode_dirty(dir); mark_inode_dirty(dir);
} }
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
udf_release_data(fibh.ebh); brelse(fibh.ebh);
udf_release_data(fibh.sbh); brelse(fibh.sbh);
inc_nlink(inode); inc_nlink(inode);
inode->i_ctime = current_fs_time(inode->i_sb); inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode); mark_inode_dirty(inode);
...@@ -1174,8 +1174,8 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, ...@@ -1174,8 +1174,8 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
if ((ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi))) if ((ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi)))
{ {
if (ofibh.sbh != ofibh.ebh) if (ofibh.sbh != ofibh.ebh)
udf_release_data(ofibh.ebh); brelse(ofibh.ebh);
udf_release_data(ofibh.sbh); brelse(ofibh.sbh);
} }
tloc = lelb_to_cpu(ocfi.icb.extLocation); tloc = lelb_to_cpu(ocfi.icb.extLocation);
if (!ofi || udf_get_lb_pblock(old_dir->i_sb, tloc, 0) if (!ofi || udf_get_lb_pblock(old_dir->i_sb, tloc, 0)
...@@ -1188,8 +1188,8 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, ...@@ -1188,8 +1188,8 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
if (!new_inode) if (!new_inode)
{ {
if (nfibh.sbh != nfibh.ebh) if (nfibh.sbh != nfibh.ebh)
udf_release_data(nfibh.ebh); brelse(nfibh.ebh);
udf_release_data(nfibh.sbh); brelse(nfibh.sbh);
nfi = NULL; nfi = NULL;
} }
} }
...@@ -1290,19 +1290,19 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, ...@@ -1290,19 +1290,19 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
if (ofi) if (ofi)
{ {
if (ofibh.sbh != ofibh.ebh) if (ofibh.sbh != ofibh.ebh)
udf_release_data(ofibh.ebh); brelse(ofibh.ebh);
udf_release_data(ofibh.sbh); brelse(ofibh.sbh);
} }
retval = 0; retval = 0;
end_rename: end_rename:
udf_release_data(dir_bh); brelse(dir_bh);
if (nfi) if (nfi)
{ {
if (nfibh.sbh != nfibh.ebh) if (nfibh.sbh != nfibh.ebh)
udf_release_data(nfibh.ebh); brelse(nfibh.ebh);
udf_release_data(nfibh.sbh); brelse(nfibh.sbh);
} }
unlock_kernel(); unlock_kernel();
return retval; return retval;
......
...@@ -81,7 +81,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, uint16_t ...@@ -81,7 +81,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, uint16_t
loc = le32_to_cpu(((__le32 *)bh->b_data)[index]); loc = le32_to_cpu(((__le32 *)bh->b_data)[index]);
udf_release_data(bh); brelse(bh);
if (UDF_I_LOCATION(UDF_SB_VAT(sb)).partitionReferenceNum == partition) if (UDF_I_LOCATION(UDF_SB_VAT(sb)).partitionReferenceNum == partition)
{ {
......
...@@ -563,7 +563,7 @@ udf_vrs(struct super_block *sb, int silent) ...@@ -563,7 +563,7 @@ udf_vrs(struct super_block *sb, int silent)
if (vsd->stdIdent[0] == 0) if (vsd->stdIdent[0] == 0)
{ {
udf_release_data(bh); brelse(bh);
break; break;
} }
else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN)) else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN))
...@@ -596,7 +596,7 @@ udf_vrs(struct super_block *sb, int silent) ...@@ -596,7 +596,7 @@ udf_vrs(struct super_block *sb, int silent)
} }
else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN)) else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN))
{ {
udf_release_data(bh); brelse(bh);
break; break;
} }
else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN)) else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN))
...@@ -607,7 +607,7 @@ udf_vrs(struct super_block *sb, int silent) ...@@ -607,7 +607,7 @@ udf_vrs(struct super_block *sb, int silent)
{ {
nsr03 = sector; nsr03 = sector;
} }
udf_release_data(bh); brelse(bh);
} }
if (nsr03) if (nsr03)
...@@ -673,7 +673,7 @@ udf_find_anchor(struct super_block *sb) ...@@ -673,7 +673,7 @@ udf_find_anchor(struct super_block *sb)
{ {
ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
udf_release_data(bh); brelse(bh);
} }
if (ident == TAG_IDENT_AVDP) if (ident == TAG_IDENT_AVDP)
...@@ -708,7 +708,7 @@ udf_find_anchor(struct super_block *sb) ...@@ -708,7 +708,7 @@ udf_find_anchor(struct super_block *sb)
{ {
ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
udf_release_data(bh); brelse(bh);
} }
if (ident == TAG_IDENT_AVDP && if (ident == TAG_IDENT_AVDP &&
...@@ -727,7 +727,7 @@ udf_find_anchor(struct super_block *sb) ...@@ -727,7 +727,7 @@ udf_find_anchor(struct super_block *sb)
{ {
ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
udf_release_data(bh); brelse(bh);
} }
if (ident == TAG_IDENT_AVDP && if (ident == TAG_IDENT_AVDP &&
...@@ -749,7 +749,7 @@ udf_find_anchor(struct super_block *sb) ...@@ -749,7 +749,7 @@ udf_find_anchor(struct super_block *sb)
{ {
ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
udf_release_data(bh); brelse(bh);
if (ident == TAG_IDENT_AVDP && location == 256) if (ident == TAG_IDENT_AVDP && location == 256)
UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
...@@ -766,7 +766,7 @@ udf_find_anchor(struct super_block *sb) ...@@ -766,7 +766,7 @@ udf_find_anchor(struct super_block *sb)
} }
else else
{ {
udf_release_data(bh); brelse(bh);
if ((ident != TAG_IDENT_AVDP) && (i || if ((ident != TAG_IDENT_AVDP) && (i ||
(ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE))) (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE)))
{ {
...@@ -795,7 +795,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr ...@@ -795,7 +795,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr
return 1; return 1;
else if (ident != TAG_IDENT_FSD) else if (ident != TAG_IDENT_FSD)
{ {
udf_release_data(bh); brelse(bh);
return 1; return 1;
} }
...@@ -834,7 +834,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr ...@@ -834,7 +834,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr
newfileset.logicalBlockNum += 1 + newfileset.logicalBlockNum += 1 +
((le32_to_cpu(sp->numOfBytes) + sizeof(struct spaceBitmapDesc) - 1) ((le32_to_cpu(sp->numOfBytes) + sizeof(struct spaceBitmapDesc) - 1)
>> sb->s_blocksize_bits); >> sb->s_blocksize_bits);
udf_release_data(bh); brelse(bh);
break; break;
} }
case TAG_IDENT_FSD: case TAG_IDENT_FSD:
...@@ -845,7 +845,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr ...@@ -845,7 +845,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr
default: default:
{ {
newfileset.logicalBlockNum ++; newfileset.logicalBlockNum ++;
udf_release_data(bh); brelse(bh);
bh = NULL; bh = NULL;
break; break;
} }
...@@ -865,7 +865,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr ...@@ -865,7 +865,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr
UDF_SB_PARTITION(sb) = fileset->partitionReferenceNum; UDF_SB_PARTITION(sb) = fileset->partitionReferenceNum;
udf_load_fileset(sb, bh, root); udf_load_fileset(sb, bh, root);
udf_release_data(bh); brelse(bh);
return 0; return 0;
} }
return 1; return 1;
...@@ -1083,7 +1083,7 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_a ...@@ -1083,7 +1083,7 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_a
if (ident != 0 || if (ident != 0 ||
strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING))) strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING)))
{ {
udf_release_data(UDF_SB_TYPESPAR(sb,i).s_spar_map[j]); brelse(UDF_SB_TYPESPAR(sb,i).s_spar_map[j]);
UDF_SB_TYPESPAR(sb,i).s_spar_map[j] = NULL; UDF_SB_TYPESPAR(sb,i).s_spar_map[j] = NULL;
} }
} }
...@@ -1137,12 +1137,12 @@ udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc) ...@@ -1137,12 +1137,12 @@ udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc)
udf_load_logicalvolint(sb, leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt)); udf_load_logicalvolint(sb, leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt));
if (UDF_SB_LVIDBH(sb) != bh) if (UDF_SB_LVIDBH(sb) != bh)
udf_release_data(bh); brelse(bh);
loc.extLength -= sb->s_blocksize; loc.extLength -= sb->s_blocksize;
loc.extLocation ++; loc.extLocation ++;
} }
if (UDF_SB_LVIDBH(sb) != bh) if (UDF_SB_LVIDBH(sb) != bh)
udf_release_data(bh); brelse(bh);
} }
/* /*
...@@ -1245,7 +1245,7 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_ ...@@ -1245,7 +1245,7 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_
done = 1; done = 1;
break; break;
} }
udf_release_data(bh); brelse(bh);
} }
for (i=0; i<VDS_POS_LENGTH; i++) for (i=0; i<VDS_POS_LENGTH; i++)
{ {
...@@ -1267,10 +1267,10 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_ ...@@ -1267,10 +1267,10 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_
gd = (struct generic_desc *)bh2->b_data; gd = (struct generic_desc *)bh2->b_data;
if (ident == TAG_IDENT_PD) if (ident == TAG_IDENT_PD)
udf_load_partdesc(sb, bh2); udf_load_partdesc(sb, bh2);
udf_release_data(bh2); brelse(bh2);
} }
} }
udf_release_data(bh); brelse(bh);
} }
} }
...@@ -1333,7 +1333,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) ...@@ -1333,7 +1333,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
reserve_e = reserve_e >> sb->s_blocksize_bits; reserve_e = reserve_e >> sb->s_blocksize_bits;
reserve_e += reserve_s; reserve_e += reserve_s;
udf_release_data(bh); brelse(bh);
/* Process the main & reserve sequences */ /* Process the main & reserve sequences */
/* responsible for finding the PartitionDesc(s) */ /* responsible for finding the PartitionDesc(s) */
...@@ -1408,7 +1408,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) ...@@ -1408,7 +1408,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
udf_ext0_offset(UDF_SB_VAT(sb)); udf_ext0_offset(UDF_SB_VAT(sb));
UDF_SB_TYPEVIRT(sb,i).s_num_entries = (UDF_SB_VAT(sb)->i_size - UDF_SB_TYPEVIRT(sb,i).s_num_entries = (UDF_SB_VAT(sb)->i_size -
UDF_SB_TYPEVIRT(sb,i).s_start_offset) >> 2; UDF_SB_TYPEVIRT(sb,i).s_start_offset) >> 2;
udf_release_data(bh); brelse(bh);
} }
UDF_SB_PARTROOT(sb,i) = udf_get_pblock(sb, 0, i, 0); UDF_SB_PARTROOT(sb,i) = udf_get_pblock(sb, 0, i, 0);
UDF_SB_PARTLEN(sb,i) = UDF_SB_PARTLEN(sb,ino.partitionReferenceNum); UDF_SB_PARTLEN(sb,i) = UDF_SB_PARTLEN(sb,ino.partitionReferenceNum);
...@@ -1680,7 +1680,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -1680,7 +1680,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15)
{ {
for (i=0; i<4; i++) for (i=0; i<4; i++)
udf_release_data(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]); brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]);
} }
} }
#ifdef CONFIG_UDF_NLS #ifdef CONFIG_UDF_NLS
...@@ -1689,7 +1689,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -1689,7 +1689,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
#endif #endif
if (!(sb->s_flags & MS_RDONLY)) if (!(sb->s_flags & MS_RDONLY))
udf_close_lvid(sb); udf_close_lvid(sb);
udf_release_data(UDF_SB_LVIDBH(sb)); brelse(UDF_SB_LVIDBH(sb));
UDF_SB_FREE(sb); UDF_SB_FREE(sb);
kfree(sbi); kfree(sbi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
...@@ -1758,7 +1758,7 @@ udf_put_super(struct super_block *sb) ...@@ -1758,7 +1758,7 @@ udf_put_super(struct super_block *sb)
if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15)
{ {
for (i=0; i<4; i++) for (i=0; i<4; i++)
udf_release_data(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]); brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]);
} }
} }
#ifdef CONFIG_UDF_NLS #ifdef CONFIG_UDF_NLS
...@@ -1767,7 +1767,7 @@ udf_put_super(struct super_block *sb) ...@@ -1767,7 +1767,7 @@ udf_put_super(struct super_block *sb)
#endif #endif
if (!(sb->s_flags & MS_RDONLY)) if (!(sb->s_flags & MS_RDONLY))
udf_close_lvid(sb); udf_close_lvid(sb);
udf_release_data(UDF_SB_LVIDBH(sb)); brelse(UDF_SB_LVIDBH(sb));
UDF_SB_FREE(sb); UDF_SB_FREE(sb);
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
...@@ -1837,7 +1837,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) ...@@ -1837,7 +1837,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap)
} }
else if (ident != TAG_IDENT_SBD) else if (ident != TAG_IDENT_SBD)
{ {
udf_release_data(bh); brelse(bh);
printk(KERN_ERR "udf: udf_count_free failed\n"); printk(KERN_ERR "udf: udf_count_free failed\n");
goto out; goto out;
} }
...@@ -1859,7 +1859,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) ...@@ -1859,7 +1859,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap)
} }
if ( bytes ) if ( bytes )
{ {
udf_release_data(bh); brelse(bh);
newblock = udf_get_lb_pblock(sb, loc, ++block); newblock = udf_get_lb_pblock(sb, loc, ++block);
bh = udf_tread(sb, newblock); bh = udf_tread(sb, newblock);
if (!bh) if (!bh)
...@@ -1871,7 +1871,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) ...@@ -1871,7 +1871,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap)
ptr = (uint8_t *)bh->b_data; ptr = (uint8_t *)bh->b_data;
} }
} }
udf_release_data(bh); brelse(bh);
out: out:
unlock_kernel(); unlock_kernel();
...@@ -1896,7 +1896,7 @@ udf_count_free_table(struct super_block *sb, struct inode * table) ...@@ -1896,7 +1896,7 @@ udf_count_free_table(struct super_block *sb, struct inode * table)
while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1)
accum += (elen >> table->i_sb->s_blocksize_bits); accum += (elen >> table->i_sb->s_blocksize_bits);
udf_release_data(epos.bh); brelse(epos.bh);
unlock_kernel(); unlock_kernel();
......
...@@ -95,7 +95,7 @@ static int udf_symlink_filler(struct file *file, struct page *page) ...@@ -95,7 +95,7 @@ static int udf_symlink_filler(struct file *file, struct page *page)
} }
udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p); udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p);
udf_release_data(bh); brelse(bh);
unlock_kernel(); unlock_kernel();
SetPageUptodate(page); SetPageUptodate(page);
......
...@@ -119,7 +119,7 @@ void udf_discard_prealloc(struct inode * inode) ...@@ -119,7 +119,7 @@ void udf_discard_prealloc(struct inode * inode)
} }
UDF_I_LENEXTENTS(inode) = lbcount; UDF_I_LENEXTENTS(inode) = lbcount;
udf_release_data(epos.bh); brelse(epos.bh);
} }
void udf_truncate_extents(struct inode * inode) void udf_truncate_extents(struct inode * inode)
...@@ -287,5 +287,5 @@ void udf_truncate_extents(struct inode * inode) ...@@ -287,5 +287,5 @@ void udf_truncate_extents(struct inode * inode)
} }
UDF_I_LENEXTENTS(inode) = inode->i_size; UDF_I_LENEXTENTS(inode) = inode->i_size;
udf_release_data(epos.bh); brelse(epos.bh);
} }
...@@ -93,7 +93,7 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb) ...@@ -93,7 +93,7 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
for (i=0; i<nr_groups; i++)\ for (i=0; i<nr_groups; i++)\
{\ {\
if (UDF_SB_BITMAP(X,Y,Z,i))\ if (UDF_SB_BITMAP(X,Y,Z,i))\
udf_release_data(UDF_SB_BITMAP(X,Y,Z,i));\ brelse(UDF_SB_BITMAP(X,Y,Z,i));\
}\ }\
if (size <= PAGE_SIZE)\ if (size <= PAGE_SIZE)\
kfree(UDF_SB_PARTMAPS(X)[Y].Z.s_bitmap);\ kfree(UDF_SB_PARTMAPS(X)[Y].Z.s_bitmap);\
......
...@@ -106,6 +106,7 @@ extern void udf_delete_inode(struct inode *); ...@@ -106,6 +106,7 @@ extern void udf_delete_inode(struct inode *);
extern void udf_clear_inode(struct inode *); extern void udf_clear_inode(struct inode *);
extern int udf_write_inode(struct inode *, int); extern int udf_write_inode(struct inode *, int);
extern long udf_block_map(struct inode *, sector_t); extern long udf_block_map(struct inode *, sector_t);
extern int udf_extend_file(struct inode *, struct extent_position *, kernel_long_ad *, sector_t);
extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *, kernel_lb_addr *, uint32_t *, sector_t *); extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *, kernel_lb_addr *, uint32_t *, sector_t *);
extern int8_t udf_add_aext(struct inode *, struct extent_position *, kernel_lb_addr, uint32_t, int); extern int8_t udf_add_aext(struct inode *, struct extent_position *, kernel_lb_addr, uint32_t, int);
extern int8_t udf_write_aext(struct inode *, struct extent_position *, kernel_lb_addr, uint32_t, int); extern int8_t udf_write_aext(struct inode *, struct extent_position *, kernel_lb_addr, uint32_t, int);
...@@ -120,7 +121,6 @@ extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t, uint ...@@ -120,7 +121,6 @@ extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t, uint
extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, uint8_t); extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, uint8_t);
extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t, uint32_t, uint16_t *); extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t, uint32_t, uint16_t *);
extern struct buffer_head *udf_read_ptagged(struct super_block *, kernel_lb_addr, uint32_t, uint16_t *); extern struct buffer_head *udf_read_ptagged(struct super_block *, kernel_lb_addr, uint32_t, uint16_t *);
extern void udf_release_data(struct buffer_head *);
extern void udf_update_tag(char *, int); extern void udf_update_tag(char *, int);
extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int); extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册