From patchwork Fri Feb 19 03:20:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 8355881 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED7C5C0553 for ; Fri, 19 Feb 2016 03:21:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1574E203E9 for ; Fri, 19 Feb 2016 03:21:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2502A20357 for ; Fri, 19 Feb 2016 03:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423069AbcBSDVa (ORCPT ); Thu, 18 Feb 2016 22:21:30 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33033 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422953AbcBSDVU (ORCPT ); Thu, 18 Feb 2016 22:21:20 -0500 Received: by mail-pa0-f50.google.com with SMTP id fl4so42386049pad.0; Thu, 18 Feb 2016 19:21:19 -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:in-reply-to :references; bh=PlIix0/8EGzZm9U5WIzFWGZRDTpfu3zEc56TkipyKy0=; b=YAy8NdMa6wTrhpxE9FziSgok9kUSP9wq4k6sJtOpBo+AlchjP7MBtZRDOJ4ECp41a1 fJxIKGVOpW7jC22+HDXvogtJ/f5s+sw9xff10wsnfSBKykKFSET40nUryJZjMh3Jk0Y2 hxYDeLPrmFy520K7paQjkitFPHJgzKyT+o6lVVgIVwy9IUhzLblvkvC78us9YJyJj53/ vZNiTb1VoF51o4N4Ro2uSn//shN8CDLaT0Ez/Dx9jvMN8ADZefbg+MlOAb9JLuiTyVXq P9eDVospvLZduEyLfpWodxumDz4JLw8Q/aS6wMRK4KEEOQFJzSUTx0j8nIxPRJC7ZkA6 Nj7w== X-Gm-Message-State: AG10YOT1GytDCqrm2ftVyarwREInm0QiLvFALUWV6OsnOpMdhfw4ArER5z2+7YHv1Hcq3g== X-Received: by 10.66.226.238 with SMTP id rv14mr15111801pac.41.1455852079619; Thu, 18 Feb 2016 19:21:19 -0800 (PST) Received: from localhost ([116.251.208.106]) by smtp.gmail.com with ESMTPSA id d8sm13535198pas.14.2016.02.18.19.21.18 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 18 Feb 2016 19:21:18 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Sagi Grimberg , Kent Overstreet , Keith Busch , Elliott Robert , Ming Lei Subject: [PATCH v1 4/4] block: merge: get the 1st and last bvec via helpers Date: Fri, 19 Feb 2016 11:20:22 +0800 Message-Id: <1455852022-14188-5-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455852022-14188-1-git-send-email-ming.lei@canonical.com> References: <1455852022-14188-1-git-send-email-ming.lei@canonical.com> 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 Reviewed-by: Sagi Grimberg Reviewed-by: Christoph Hellwig --- 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;