diff mbox series

blokc/blk-merge: remove the next_bvec label in __blk_bios_map_sg()linux-block@vger.kernel.org (open list:BLOCK LAYER)

Message ID 20201223043158.GA1502002@ubuntu-A520I-AC (mailing list archive)
State New, archived
Headers show
Series blokc/blk-merge: remove the next_bvec label in __blk_bios_map_sg()linux-block@vger.kernel.org (open list:BLOCK LAYER) | expand

Commit Message

Hui Su Dec. 23, 2020, 4:31 a.m. UTC
remove the next_bvec label in __blk_bios_map_sg(), simplify the logic
of traversal bvec.

Signed-off-by: sh <sh_def@163.com>
---
 block/blk-merge.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Hui Su Dec. 23, 2020, 5:38 a.m. UTC | #1
Hi, all:

Please ignore this change, i will resend a patch V2 later.
Christoph Hellwig Dec. 23, 2020, 8:33 a.m. UTC | #2
On Wed, Dec 23, 2020 at 12:31:58PM +0800, sh wrote:
> remove the next_bvec label in __blk_bios_map_sg(), simplify the logic
> of traversal bvec.

What makes you believe that this simplifies anything?
Hui Su Dec. 23, 2020, 9:24 a.m. UTC | #3
On Wed, Dec 23, 2020 at 08:33:07AM +0000, Christoph Hellwig wrote:
> On Wed, Dec 23, 2020 at 12:31:58PM +0800, sh wrote:
> > remove the next_bvec label in __blk_bios_map_sg(), simplify the logic
> > of traversal bvec.
> 
> What makes you believe that this simplifies anything?

1. this change remove the jump lable, so we do not need goto.
2. we do not need to assign flase to new_bio in the
bio_for_each_bvec, we only need to assign false to new_bio at first.

And I have resend a PATCH V2, this change have some format problem.

Thanks.
diff mbox series

Patch

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 808768f6b174..aa113cbc0f35 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -494,15 +494,15 @@  static int __blk_bios_map_sg(struct request_queue *q, struct bio *bio,
 			 * to bio
 			 */
 			if (new_bio &&
-			    __blk_segment_map_sg_merge(q, &bvec, &bvprv, sg))
-				goto next_bvec;
+			    __blk_segment_map_sg_merge(q, &bvec, &bvprv, sg)) {
+				new_bio = false;
+				continue;
+			}
 
 			if (bvec.bv_offset + bvec.bv_len <= PAGE_SIZE)
 				nsegs += __blk_bvec_map_sg(bvec, sglist, sg);
 			else
 				nsegs += blk_bvec_map_sg(q, &bvec, sglist, sg);
- next_bvec:
-			new_bio = false;
 		}
 		if (likely(bio->bi_iter.bi_size)) {
 			bvprv = bvec;