From patchwork Fri Feb 26 15:40:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 8438781 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 1D1F5C0553 for ; Fri, 26 Feb 2016 15:42:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 34DC620392 for ; Fri, 26 Feb 2016 15:42:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A990203B4 for ; Fri, 26 Feb 2016 15:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933521AbcBZPly (ORCPT ); Fri, 26 Feb 2016 10:41:54 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36037 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933601AbcBZPlj (ORCPT ); Fri, 26 Feb 2016 10:41:39 -0500 Received: by mail-pf0-f195.google.com with SMTP id e127so4841267pfe.3; Fri, 26 Feb 2016 07:41:38 -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=bEHyCqfxGYyls/GmMZkKI+vy4rNZB2nDG1VywFvupss=; b=FcxxZArLZmOyAZU7XzD6TICCjIzwLxasBZtuU0swBKMqqWCGgsITSTudKZKTaKxDKO Jf8O+Gbbi8XWWPPWcqu2xkNwXj54TAoGAnFRkj/HgY0l/ro/LFB/FPvOoVIIQZeFAkdp 8HUk8sgUNzs+e6vuvi0Wk3Eb/DMG3iBxfFLh8xQrWB+8PkdmtYkO+9nJEXS3BfW/Pw7a tMOPA4oYBjQrMYHjCY/aIGT0f9U6EW3SvC+1XSrE9cwcVnqPmrzPfq1BV3UnCxWuZ9tS RGI5xT/9LA1luikpme2RdcPHombbkLX/r0DS4+LY7p5qwn03gANckvJgQiYR0qpG6o16 BCLg== X-Gm-Message-State: AD7BkJIQf2x05vdrhmJ87p2WzjKnsiPjlfo1OD7dzphdoXVFD6yXlRgjAs0KX0hLCcwYQg== X-Received: by 10.98.12.8 with SMTP id u8mr2982463pfi.36.1456501298581; Fri, 26 Feb 2016 07:41:38 -0800 (PST) Received: from localhost ([45.35.47.131]) by smtp.gmail.com with ESMTPSA id u64sm20245116pfa.86.2016.02.26.07.41.37 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 26 Feb 2016 07:41:37 -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 v2 4/4] block: merge: get the 1st and last bvec via helpers Date: Fri, 26 Feb 2016 23:40:53 +0800 Message-Id: <1456501253-7269-5-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456501253-7269-1-git-send-email-ming.lei@canonical.com> References: <1456501253-7269-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. Reviewed-by: Sagi Grimberg Reviewed-by: 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;