Skip to contentSkip to conversation

btrfs: fix unlikely in btrfs_insert_one_raid_extent()

PATCH In review Mark Harmstone 2 participants 3 messages Feb 18 – Feb 20 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: fix unlikely in btrfs_insert_one_raid_extent()

Fix the unlikely added to btrfs_insert_one_raid_extent() by commit
a929904c: the exclamation point is in the wrong place, so we are telling the compiler that allocation failure is actually expected.

Fixes a929904cf73b ("btrfs: add unlikely annotations to branches leading to transaction abort")
---
 fs/btrfs/raid-stripe-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/raid-stripe-tree.c +1 -1
index 2987cb7c686e..638c4ad572c9 100644
@@ -300,7 +300,7 @@ int btrfs_insert_one_raid_extent(struct btrfs_trans_handle *trans,
 	int ret;
 
 	stripe_extent = kzalloc(item_size, GFP_NOFS);
-	if (!unlikely(stripe_extent)) {
+	if (unlikely(!stripe_extent)) {
 		btrfs_abort_transaction(trans, -ENOMEM);
 		btrfs_end_transaction(trans);
 		return -ENOMEM;
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mark Harmstone

Fix the unlikely added to btrfs_insert_one_raid_extent() by commit
a929904c: the exclamation point is in the wrong place, so we are telling the compiler that allocation failure is actually expected.

Fixes a929904cf73b ("btrfs: add unlikely annotations to branches leading to transaction abort")

We use the Fixes tag for things that must be backported, which are aither bug fixes or rather severe performance regressions (i.e. things that affect users), and this doesn't fit into these categories.

Otherwise:

Quoted 21 lines
---
 fs/btrfs/raid-stripe-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/raid-stripe-tree.c +1 -2
index 2987cb7c686e..638c4ad572c9 100644
@@ -300,7 +300,7 @@ int btrfs_insert_one_raid_extent(struct btrfs_trans_handle *trans,
        int ret;
 
        stripe_extent = kzalloc(item_size, GFP_NOFS);
-       if (!unlikely(stripe_extent)) {
+       if (unlikely(!stripe_extent)) {
                btrfs_abort_transaction(trans, -ENOMEM);
                btrfs_end_transaction(trans);
                return -ENOMEM;
--

2.52.0

#2 lore raw
Quoted 6 lines · Filipe Manana
Quoted 5 lines · Mark Harmstone

Fix the unlikely added to btrfs_insert_one_raid_extent() by commit
a929904c: the exclamation point is in the wrong place, so we are telling the compiler that allocation failure is actually expected.

Quoted 6 lines
Quoted 2 lines
Fixes a929904cf73b ("btrfs: add unlikely annotations to branches leading to transaction abort")

We use the Fixes tag for things that must be backported, which are aither bug fixes or rather severe performance regressions (i.e. things that affect users), and this doesn't fit into these categories.

Okay - thanks Filipe, I'll push it with the Fixes line taken out.

Quoted 26 lines

Otherwise:

Quoted 21 lines
---
  fs/btrfs/raid-stripe-tree.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/raid-stripe-tree.c +1 -2
index 2987cb7c686e..638c4ad572c9 100644
@@ -300,7 +300,7 @@ int btrfs_insert_one_raid_extent(struct btrfs_trans_handle *trans,
         int ret;
 
         stripe_extent = kzalloc(item_size, GFP_NOFS);
-       if (!unlikely(stripe_extent)) {
+       if (unlikely(!stripe_extent)) {
                 btrfs_abort_transaction(trans, -ENOMEM);
                 btrfs_end_transaction(trans);
                 return -ENOMEM;
--

2.52.0