From patchwork Mon Feb 15 07:05:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 8310461 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A14A29F2F0 for ; Mon, 15 Feb 2016 07:05:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C341B204DE for ; Mon, 15 Feb 2016 07:05:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB5C820114 for ; Mon, 15 Feb 2016 07:05:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752324AbcBOHFP (ORCPT ); Mon, 15 Feb 2016 02:05:15 -0500 Received: from mail-pa0-f67.google.com ([209.85.220.67]:35312 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbcBOHFM (ORCPT ); Mon, 15 Feb 2016 02:05:12 -0500 Received: by mail-pa0-f67.google.com with SMTP id fl4so6826141pad.2; Sun, 14 Feb 2016 23:05:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PlIix0/8EGzZm9U5WIzFWGZRDTpfu3zEc56TkipyKy0=; b=HrExBxkigFhzzcvwHpfQTyeB5GQ4ByYWxV008nnIEk7EfvM4CJI8sLx+Xr8lm+QBuh c/JVAAguuew6oxvkJVp1K5EdrioWCkU6Wzff6yyZLExQl7hDbnMY+eAX204EnzlELi1R GFlkbPjW39bdlc3UlB0dx/U9isjsUG9ZsMDVHsytUDqQYHFHe0RLoJoL6l1GGAe+EW4I vFGIT6qpJeXEGwMoLMiyN/6G7T7wf1Jo0ieFxmfCgqvGVmfMPhG1AivtLMtgvQCy+jOX cmbJ04iJpdTBYsVq8lgvwPQox4j5H1UZAt9eXLKw7FnFKAGEXzhiFA7ftW/y1CDuMeid Mzag== X-Gm-Message-State: AG10YOT4EDUEA5F/wqja2egqS3/3jJWN18Zvtc4/fCzC7C+wLpXUV9HJxGM2QRoA3R+XMQ== X-Received: by 10.66.190.40 with SMTP id gn8mr21298332pac.64.1455519912378; Sun, 14 Feb 2016 23:05:12 -0800 (PST) Received: from localhost ([116.251.208.106]) by smtp.gmail.com with ESMTPSA id r26sm35865354pfb.21.2016.02.14.23.05.10 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 14 Feb 2016 23:05:11 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Sagi Grimberg , Ming Lei Subject: [PATCH 4/4] block: merge: get the 1st and last bvec via helpers Date: Mon, 15 Feb 2016 15:05:04 +0800 Message-Id: <1455519904-24138-1-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.9.1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch applies the two introduced helpers to figure out the 1st and last bvec. Cc: Sagi Grimberg Cc: Christoph Hellwig Signed-off-by: Ming Lei --- block/blk-merge.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 888a7fe..2613531 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -304,7 +304,6 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio, struct bio *nxt) { struct bio_vec end_bv = { NULL }, nxt_bv; - struct bvec_iter iter; if (!blk_queue_cluster(q)) return 0; @@ -316,11 +315,8 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio, if (!bio_has_data(bio)) return 1; - bio_for_each_segment(end_bv, bio, iter) - if (end_bv.bv_len == iter.bi_size) - break; - - nxt_bv = bio_iovec(nxt); + bio_get_last_bvec(bio, &end_bv); + bio_get_first_bvec(nxt, &nxt_bv); if (!BIOVEC_PHYS_MERGEABLE(&end_bv, &nxt_bv)) return 0;