Skip to contentSkip to conversation

Btrfs: remove redundant btrfs_trans_release_metadata"

PATCH In review Liu Bo 3 participants 6 messages Sep 5, 2018 – Sep 7, 2018 Btrfs file system

lore
Share & tools
lore

Liu Bo

author
#0 lore raw

PATCH 1/1 Btrfs: remove redundant btrfs_trans_release_metadata"

__btrfs_end_transaction() has done the metadata release twice, probably because it used to process delayed refs in between, but now that we don't process delayed refs any more, the 2nd release is always a noop.

---
 fs/btrfs/transaction.c | 6 ------
 1 file changed, 6 deletions(-)
fs/btrfs/transaction.c +0 -6
index bb1b9f526e98..94b036a74d11 100644
@@ -826,12 +826,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
 		return 0;
 	}
 
-	btrfs_trans_release_metadata(trans);
-	trans->block_rsv = NULL;
-
-	if (!list_empty(&trans->new_bgs))
-		btrfs_create_pending_block_groups(trans);
-
 	trans->delayed_ref_updates = 0;
 	if (!trans->sync) {
 		must_run_delayed_refs =
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Liu Bo

__btrfs_end_transaction() has done the metadata release twice, probably because it used to process delayed refs in between, but now that we don't process delayed refs any more, the 2nd release is always a noop.

Quoted 9 lines
---
 fs/btrfs/transaction.c | 6 ------
 1 file changed, 6 deletions(-)
fs/btrfs/transaction.c +0 -0
index bb1b9f526e98..94b036a74d11 100644

fs/btrfs/transaction.c static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, · line 834

Quoted 9 lines
fs/btrfs/transaction.c +0 -6
@@ -826,12 +826,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
 		return 0;
 	}
 
-	btrfs_trans_release_metadata(trans);
-	trans->block_rsv = NULL;
-
-	if (!list_empty(&trans->new_bgs))
-		btrfs_create_pending_block_groups(trans);
-

The only code which can have any implications to the transaction reserve is the btrfs_Create_pending_block_groups since it does insert items. But at this point trans->block_rsv is already null and additionally even if more reservations are made for this transaction further down either btrfs_commit_transaction is called or the transaction kthread is called which is going to commit it. So this change really seems inconsequential.

Quoted 4 lines
fs/btrfs/transaction.c +0 -0
 	trans->delayed_ref_updates = 0;
 	if (!trans->sync) {
 		must_run_delayed_refs =
#2 lore raw
In reply to Liu Bo

Somehow this ends up with crash in btrfs/124, I'm trying to figure out what went wrong.

thanks,
liubo

Quoted 30 lines · Liu Bo

__btrfs_end_transaction() has done the metadata release twice, probably because it used to process delayed refs in between, but now that we don't process delayed refs any more, the 2nd release is always a noop.

---
 fs/btrfs/transaction.c | 6 ------
 1 file changed, 6 deletions(-)
fs/btrfs/transaction.c +0 -7
index bb1b9f526e98..94b036a74d11 100644
@@ -826,12 +826,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
                return 0;
        }
 
-       btrfs_trans_release_metadata(trans);
-       trans->block_rsv = NULL;
-
-       if (!list_empty(&trans->new_bgs))
-               btrfs_create_pending_block_groups(trans);
-
        trans->delayed_ref_updates = 0;
        if (!trans->sync) {
                must_run_delayed_refs =
--

1.8.3.1

#3 lore raw
Quoted 3 lines · Liu Bo

Somehow this ends up with crash in btrfs/124, I'm trying to figure out what went wrong.

It revealed the problem addressed in Josef's patch[1], so with it, this patch works just fine.

[1] btrfs: make sure we create all new bgs

thanks,
liubo

Quoted 32 lines · Liu Bo
Quoted 30 lines

__btrfs_end_transaction() has done the metadata release twice, probably because it used to process delayed refs in between, but now that we don't process delayed refs any more, the 2nd release is always a noop.

---
 fs/btrfs/transaction.c | 6 ------
 1 file changed, 6 deletions(-)
fs/btrfs/transaction.c +0 -7
index bb1b9f526e98..94b036a74d11 100644
@@ -826,12 +826,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
                return 0;
        }
 
-       btrfs_trans_release_metadata(trans);
-       trans->block_rsv = NULL;
-
-       if (!list_empty(&trans->new_bgs))
-               btrfs_create_pending_block_groups(trans);
-
        trans->delayed_ref_updates = 0;
        if (!trans->sync) {
                must_run_delayed_refs =
--

1.8.3.1

#4 lore raw
Quoted 7 lines · Liu Bo
Quoted 3 lines · Liu Bo

Somehow this ends up with crash in btrfs/124, I'm trying to figure out what went wrong.

It revealed the problem addressed in Josef's patch[1], so with it, this patch works just fine.

What exactly was the crash ?

Quoted 39 lines

[1] btrfs: make sure we create all new bgs

thanks,
liubo

Quoted 32 lines · Liu Bo
Quoted 30 lines

__btrfs_end_transaction() has done the metadata release twice, probably because it used to process delayed refs in between, but now that we don't process delayed refs any more, the 2nd release is always a noop.

---
 fs/btrfs/transaction.c | 6 ------
 1 file changed, 6 deletions(-)
fs/btrfs/transaction.c +0 -7
index bb1b9f526e98..94b036a74d11 100644
@@ -826,12 +826,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
                return 0;
        }
 
-       btrfs_trans_release_metadata(trans);
-       trans->block_rsv = NULL;
-
-       if (!list_empty(&trans->new_bgs))
-               btrfs_create_pending_block_groups(trans);
-
        trans->delayed_ref_updates = 0;
        if (!trans->sync) {
                must_run_delayed_refs =
--

1.8.3.1

#5 lore raw
Quoted 4 lines · Nikolay Borisov
Quoted 1 line · Liu Bo

On Wed, Sep 5, 2018 at 10:45 PM, Liu Bo <[email protected]> wrote:

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Somehow this ends up with crash in btrfs/124, I'm trying to figure out what went wrong.

It revealed the problem addressed in Josef's patch[1], so with it, this patch works just fine.

What exactly was the crash ?

assertion failed: list_empty(&block_group->bg_list), file:
fs/btrfs/extent-tree.c,

kernel BUG at fs/btrfs/ctree.h:3427!
...
close_ctree+0x142/0x310 [btrfs]

thanks,
liubo

Quoted 39 lines
Quoted 39 lines

[1] btrfs: make sure we create all new bgs

thanks,
liubo

Quoted 32 lines · Liu Bo
Quoted 30 lines

__btrfs_end_transaction() has done the metadata release twice, probably because it used to process delayed refs in between, but now that we don't process delayed refs any more, the 2nd release is always a noop.

---
 fs/btrfs/transaction.c | 6 ------
 1 file changed, 6 deletions(-)
fs/btrfs/transaction.c +0 -7
index bb1b9f526e98..94b036a74d11 100644
@@ -826,12 +826,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
                return 0;
        }
 
-       btrfs_trans_release_metadata(trans);
-       trans->block_rsv = NULL;
-
-       if (!list_empty(&trans->new_bgs))
-               btrfs_create_pending_block_groups(trans);
-
        trans->delayed_ref_updates = 0;
        if (!trans->sync) {
                must_run_delayed_refs =
--

1.8.3.1