Skip to contentSkip to conversation

ocfs2: The goto is not useful in the function ocfs2_reserve_cluster_bitmap_bits, so remove it.

PATCH Applied Guozhonghua 3 participants 3 messages Nov 15, 2017 – Nov 16, 2017 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: The goto is not useful in the function ocfs2_reserve_cluster_bitmap_bits, so remove it.

The goto is not useful anymore, removed from the context.

---
 fs/ocfs2/suballoc.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/ocfs2/suballoc.c +1 -4
index 71f22c8..9f0b95a 100644
@@ -1147,12 +1147,9 @@ int ocfs2_reserve_cluster_bitmap_bits(struct ocfs2_super *osb,
 					     GLOBAL_BITMAP_SYSTEM_INODE,
 					     OCFS2_INVALID_SLOT, NULL,
 					     ALLOC_NEW_GROUP);
-	if (status < 0 && status != -ENOSPC) {
+	if (status < 0 && status != -ENOSPC)
 		mlog_errno(status);
-		goto bail;
-	}
 
-bail:
 	return status;
 }
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ocfs2: The goto is not useful in the function ocfs2_reserve_cluster_bitmap_bits, so remove it.

Hi Zhonghua,

Quoted 1 line · Guozhonghua

The goto is not useful anymore, removed from the context.

Perhaps we can make this change-log more clear like:
The bail declare is not necessary any more, so trim it. If code path falls into error branch, ocfs2_reserve_cluster_bitmap_bits will return in next following step, too.

And this title can be changed into 'ocfs2: clean up unnecessary bail declare'

I suppose after that this patch will be neater.

Can you resend this patch?
Moreover, I think we should also CC this patch to OCFS2 maintainers.

Thanks,
Changwei

Quoted 25 lines
---
  fs/ocfs2/suballoc.c |    5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
fs/ocfs2/suballoc.c +1 -4
index 71f22c8..9f0b95a 100644
@@ -1147,12 +1147,9 @@ int ocfs2_reserve_cluster_bitmap_bits(struct ocfs2_super *osb,
  					     GLOBAL_BITMAP_SYSTEM_INODE,
  					     OCFS2_INVALID_SLOT, NULL,
  					     ALLOC_NEW_GROUP);
-	if (status < 0 && status != -ENOSPC) {
+	if (status < 0 && status != -ENOSPC)
  		mlog_errno(status);
-		goto bail;
-	}
 
-bail:
  	return status;
  }
 
#2 lore raw

PATCH 1/1 ocfs2: The goto is not useful in the function ocfs2_reserve_cluster_bitmap_bits, so remove it.

Quoted 9 lines · On Thu, 16 Nov 2017 00:42:09 +0000 Changwei Ge <[email protected]> wrote:

Hi Zhonghua,

Quoted 1 line · Guozhonghua

The goto is not useful anymore, removed from the context.

Perhaps we can make this change-log more clear like:
The bail declare is not necessary any more, so trim it. If code path falls into error branch, ocfs2_reserve_cluster_bitmap_bits will return in next following step, too.

Quoted 7 lines

And this title can be changed into 'ocfs2: clean up unnecessary bail declare'

I suppose after that this patch will be neater.

Can you resend this patch?
Moreover, I think we should also CC this patch to OCFS2 maintainers.

The patch is OK. I reworked it as below. It's so obvious that no changelog is needed.

From: Guozhonghua <[email protected]>
Subject: ocfs2: remove unneeded goto in ocfs2_reserve_cluster_bitmap_bits()

---

 fs/ocfs2/suballoc.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/ocfs2/suballoc.c renamed from fs/ocfs2/suballoc.c~ocfs2-the-goto-is-not-useful-in-the-function-ocfs2_reserve_cluster_bitmap_bits-so-remove-it +1 -4
diff -puN fs/ocfs2/suballoc.c~ocfs2-the-goto-is-not-useful-in-the-function-ocfs2_reserve_cluster_bitmap_bits-so-remove-it fs/ocfs2/suballoc.c
@@ -1147,12 +1147,9 @@ int ocfs2_reserve_cluster_bitmap_bits(st
 					     GLOBAL_BITMAP_SYSTEM_INODE,
 					     OCFS2_INVALID_SLOT, NULL,
 					     ALLOC_NEW_GROUP);
-	if (status < 0 && status != -ENOSPC) {
+	if (status < 0 && status != -ENOSPC)
 		mlog_errno(status);
-		goto bail;
-	}
 
-bail:
 	return status;
 }
 

_