Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124887
b: refs/heads/master
c: 0924b58
h: refs/heads/master
i:
  124885: b2d72c8
  124883: 85460fc
  124879: 11dbb7d
v: v3
  • Loading branch information
Dave Chinner authored and Niv Sardi committed Dec 1, 2008
1 parent fdc31ce commit edbbfae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 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: 2e6560929d8ab4b650fecc3a87013852b34f0922
refs/heads/master: 0924b585fc49bf371bc700c23e516a538bf589af
39 changes: 18 additions & 21 deletions trunk/fs/xfs/xfs_rtalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ xfs_growfs_rt_alloc(
{
xfs_fileoff_t bno; /* block number in file */
xfs_buf_t *bp; /* temporary buffer for zeroing */
int cancelflags; /* flags for xfs_trans_cancel */
int committed; /* transaction committed flag */
xfs_daddr_t d; /* disk block address */
int error; /* error return value */
Expand All @@ -96,15 +95,16 @@ xfs_growfs_rt_alloc(
xfs_bmbt_irec_t map; /* block map output */
int nmap; /* number of block maps */
int resblks; /* space reservation */
xfs_trans_t *tp; /* transaction pointer */

/*
* Allocate space to the file, as necessary.
*/
while (oblocks < nblocks) {
int cancelflags = 0;
xfs_trans_t *tp;

tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_ALLOC);
resblks = XFS_GROWFSRT_SPACE_RES(mp, nblocks - oblocks);
cancelflags = 0;
/*
* Reserve space & log for one extent added to the file.
*/
Expand Down Expand Up @@ -171,7 +171,9 @@ xfs_growfs_rt_alloc(
mp->m_bsize, 0);
if (bp == NULL) {
error = XFS_ERROR(EIO);
goto error_cancel;
error_cancel:
xfs_trans_cancel(tp, cancelflags);
goto error;
}
memset(XFS_BUF_PTR(bp), 0, mp->m_sb.sb_blocksize);
xfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1);
Expand All @@ -188,8 +190,6 @@ xfs_growfs_rt_alloc(
oblocks = map.br_startoff + map.br_blockcount;
}
return 0;
error_cancel:
xfs_trans_cancel(tp, cancelflags);
error:
return error;
}
Expand Down Expand Up @@ -1856,7 +1856,6 @@ xfs_growfs_rt(
{
xfs_rtblock_t bmbno; /* bitmap block number */
xfs_buf_t *bp; /* temporary buffer */
int cancelflags; /* flags for xfs_trans_cancel */
int error; /* error return value */
xfs_inode_t *ip; /* bitmap inode, used as lock */
xfs_mount_t *nmp; /* new (fake) mount structure */
Expand All @@ -1872,10 +1871,8 @@ xfs_growfs_rt(
xfs_extlen_t rsumblocks; /* current number of rt summary blks */
xfs_sb_t *sbp; /* old superblock */
xfs_fsblock_t sumbno; /* summary block number */
xfs_trans_t *tp; /* transaction pointer */

sbp = &mp->m_sb;
cancelflags = 0;
/*
* Initial error checking.
*/
Expand Down Expand Up @@ -1942,6 +1939,9 @@ xfs_growfs_rt(
((sbp->sb_rextents & ((1 << mp->m_blkbit_log) - 1)) != 0);
bmbno < nrbmblocks;
bmbno++) {
xfs_trans_t *tp;
int cancelflags = 0;

*nmp = *mp;
nsbp = &nmp->m_sb;
/*
Expand All @@ -1967,16 +1967,15 @@ xfs_growfs_rt(
* Start a transaction, get the log reservation.
*/
tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_FREE);
cancelflags = 0;
if ((error = xfs_trans_reserve(tp, 0,
XFS_GROWRTFREE_LOG_RES(nmp), 0, 0, 0)))
break;
goto error_cancel;
/*
* Lock out other callers by grabbing the bitmap inode lock.
*/
if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0,
XFS_ILOCK_EXCL, &ip)))
break;
goto error_cancel;
ASSERT(ip == mp->m_rbmip);
/*
* Update the bitmap inode's size.
Expand All @@ -1990,7 +1989,7 @@ xfs_growfs_rt(
*/
if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0,
XFS_ILOCK_EXCL, &ip)))
break;
goto error_cancel;
ASSERT(ip == mp->m_rsumip);
/*
* Update the summary inode's size.
Expand All @@ -2005,7 +2004,7 @@ xfs_growfs_rt(
mp->m_rsumlevels != nmp->m_rsumlevels) {
error = xfs_rtcopy_summary(mp, nmp, tp);
if (error)
break;
goto error_cancel;
}
/*
* Update superblock fields.
Expand All @@ -2031,8 +2030,11 @@ xfs_growfs_rt(
bp = NULL;
error = xfs_rtfree_range(nmp, tp, sbp->sb_rextents,
nsbp->sb_rextents - sbp->sb_rextents, &bp, &sumbno);
if (error)
if (error) {
error_cancel:
xfs_trans_cancel(tp, cancelflags);
break;
}
/*
* Mark more blocks free in the superblock.
*/
Expand All @@ -2045,15 +2047,10 @@ xfs_growfs_rt(
mp->m_rsumsize = nrsumsize;

error = xfs_trans_commit(tp, 0);
if (error) {
tp = NULL;
if (error)
break;
}
}

if (error && tp)
xfs_trans_cancel(tp, cancelflags);

/*
* Free the fake mp structure.
*/
Expand Down

0 comments on commit edbbfae

Please sign in to comment.