X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=fs%2Fxfs%2Fxfs_bmap_util.c;h=3bf4ad0d19e4f3203bdb36b23f74616f9c691741;hb=5ee84ba8c7f5a5dd1934459acfec6108b5285940;hp=fa65f67737c579eb3642de4a1b680e4a429f2840;hpb=8d99fe92fed019e203f458370129fb28b3fb5740;p=firefly-linux-kernel-4.4.55.git diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index fa65f67737c5..3bf4ad0d19e4 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -112,24 +112,17 @@ xfs_bmap_finish( return error; } + /* + * Get an EFD and free each extent in the list, logging to the EFD in + * the process. The remaining bmap free list is cleaned up by the caller + * on error. + */ efd = xfs_trans_get_efd(*tp, efi, flist->xbf_count); for (free = flist->xbf_first; free != NULL; free = next) { next = free->xbfi_next; - /* - * Free the extent and log the EFD to dirty the transaction - * before handling errors. This ensures that the transaction is - * aborted, which: - * - * 1.) releases the EFI and frees the EFD - * 2.) shuts down the filesystem - * - * The bmap free list is cleaned up at a higher level. - */ - error = xfs_free_extent(*tp, free->xbfi_startblock, - free->xbfi_blockcount); - xfs_trans_log_efd_extent(*tp, efd, free->xbfi_startblock, - free->xbfi_blockcount); + error = xfs_trans_free_extent(*tp, efd, free->xbfi_startblock, + free->xbfi_blockcount); if (error) return error; @@ -1481,7 +1474,7 @@ xfs_shift_file_space( XFS_DIOSTRAT_SPACE_RES(mp, 0), 0, XFS_QMOPT_RES_REGBLKS); if (error) - goto out; + goto out_trans_cancel; xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); @@ -1495,18 +1488,20 @@ xfs_shift_file_space( &done, stop_fsb, &first_block, &free_list, direction, XFS_BMAP_MAX_SHIFT_EXTENTS); if (error) - goto out; + goto out_bmap_cancel; error = xfs_bmap_finish(&tp, &free_list, &committed); if (error) - goto out; + goto out_bmap_cancel; error = xfs_trans_commit(tp); } return error; -out: +out_bmap_cancel: + xfs_bmap_cancel(&free_list); +out_trans_cancel: xfs_trans_cancel(tp); return error; }