diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-05-15 09:48:26 +0200 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-06-14 17:29:45 +0200 |
commit | 25d8c284c7d9b9d536a1334f6b670645da971a19 (patch) | |
tree | f2d7c360b2ec1b3cfb02793890cd92a87cecba92 /fs/btrfs/transaction.c | |
parent | Btrfs: cleanup unnecessary assignment when cleaning up all the residual trans... (diff) | |
download | linux-25d8c284c7d9b9d536a1334f6b670645da971a19.tar.xz linux-25d8c284c7d9b9d536a1334f6b670645da971a19.zip |
Btrfs: remove the code for the impossible case in cleanup_transaction()
If the transaction is removed from the transaction list, it means the
transaction has been committed successfully. So it is impossible to
call cleanup_transaction(), otherwise there is something wrong with
the code logic. Thus, we use BUG_ON() instead of the original handle.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index bc22be9b69b4..cf8706ce85ac 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1450,11 +1450,12 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans, spin_lock(&root->fs_info->trans_lock); - if (list_empty(&cur_trans->list)) { - spin_unlock(&root->fs_info->trans_lock); - btrfs_end_transaction(trans, root); - return; - } + /* + * If the transaction is removed from the list, it means this + * transaction has been committed successfully, so it is impossible + * to call the cleanup function. + */ + BUG_ON(list_empty(&cur_trans->list)); list_del_init(&cur_trans->list); if (cur_trans == root->fs_info->running_transaction) { |