diff options
Diffstat (limited to 'fs/xfs/libxfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 5648a177e0ac..2760314fdf7f 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -712,19 +712,14 @@ xfs_bmap_extents_to_btree( | |||
712 | args.wasdel = wasdel; | 712 | args.wasdel = wasdel; |
713 | *logflagsp = 0; | 713 | *logflagsp = 0; |
714 | if ((error = xfs_alloc_vextent(&args))) { | 714 | if ((error = xfs_alloc_vextent(&args))) { |
715 | xfs_iroot_realloc(ip, -1, whichfork); | ||
716 | ASSERT(ifp->if_broot == NULL); | 715 | ASSERT(ifp->if_broot == NULL); |
717 | XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS); | 716 | goto err1; |
718 | xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); | ||
719 | return error; | ||
720 | } | 717 | } |
721 | 718 | ||
722 | if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) { | 719 | if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) { |
723 | xfs_iroot_realloc(ip, -1, whichfork); | ||
724 | ASSERT(ifp->if_broot == NULL); | 720 | ASSERT(ifp->if_broot == NULL); |
725 | XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS); | 721 | error = -ENOSPC; |
726 | xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); | 722 | goto err1; |
727 | return -ENOSPC; | ||
728 | } | 723 | } |
729 | /* | 724 | /* |
730 | * Allocation can't fail, the space was reserved. | 725 | * Allocation can't fail, the space was reserved. |
@@ -736,6 +731,10 @@ xfs_bmap_extents_to_btree( | |||
736 | ip->i_d.di_nblocks++; | 731 | ip->i_d.di_nblocks++; |
737 | xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L); | 732 | xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L); |
738 | abp = xfs_btree_get_bufl(mp, tp, args.fsbno, 0); | 733 | abp = xfs_btree_get_bufl(mp, tp, args.fsbno, 0); |
734 | if (!abp) { | ||
735 | error = -ENOSPC; | ||
736 | goto err2; | ||
737 | } | ||
739 | /* | 738 | /* |
740 | * Fill in the child block. | 739 | * Fill in the child block. |
741 | */ | 740 | */ |
@@ -775,6 +774,15 @@ xfs_bmap_extents_to_btree( | |||
775 | *curp = cur; | 774 | *curp = cur; |
776 | *logflagsp = XFS_ILOG_CORE | xfs_ilog_fbroot(whichfork); | 775 | *logflagsp = XFS_ILOG_CORE | xfs_ilog_fbroot(whichfork); |
777 | return 0; | 776 | return 0; |
777 | |||
778 | err2: | ||
779 | xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L); | ||
780 | err1: | ||
781 | xfs_iroot_realloc(ip, -1, whichfork); | ||
782 | XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS); | ||
783 | xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); | ||
784 | |||
785 | return error; | ||
778 | } | 786 | } |
779 | 787 | ||
780 | /* | 788 | /* |