From patchwork Fri Nov 11 12:05:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9426769 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4AF1D60471 for ; Mon, 14 Nov 2016 08:27:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AACF2865C for ; Mon, 14 Nov 2016 08:27:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DE18287ED; Mon, 14 Nov 2016 08:27:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB5612865C for ; Mon, 14 Nov 2016 08:27:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAE8QWla016401; Mon, 14 Nov 2016 03:26:32 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uABC710U007520 for ; Fri, 11 Nov 2016 07:07:01 -0500 Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uABC71UE000580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 11 Nov 2016 07:07:01 -0500 Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81E113F1F2; Fri, 11 Nov 2016 12:07:00 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id y68so2416290pfb.1; Fri, 11 Nov 2016 04:07:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q7lGoU7ymBBdcFV89NJENMoMLyS/9DgyQQ2jlEEjlZ8=; b=PxuTWQ3Xt2PMTxnuLLJbzMHXNIdtSqW+6KA6jvRqpUHfGD3SiKGOTxCM4msUSrxJ22 8GbtLtIL2gtb4lPL92a+CZqQt1INsUKRILcD7HQOJe1csyHk5hEqcx5ZnMchNMnnGeU1 jsoFRnKHPTjkn4thPErEhFekHMb3AbsACsKTUKETsKXrfJzG4FOnQZ5Zd15si43OBKZN 8X6yMEIF70fCYsuthe3hLacRZNrJAl0C+FDTY0mcm8QirE7xEsYC38rM3wISZANcdWst qbR0F9DPGiv/1QOrRpvQ1iCUXCU/dhN2th1uYWZImLp6oATxbnFh4mzO0/jRxQWqQpzZ Sb7A== 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=Q7lGoU7ymBBdcFV89NJENMoMLyS/9DgyQQ2jlEEjlZ8=; b=F5jdmvq0Fk4AE12kee87V86qbCkS0OqtQCNWVSsSH0+5JPnHpLqxa2uzvVCOpqUKoM /G98xK2r+/p+r3B3hlqOvzf5u88crc2mkbx1xuGVgAD8Z73Tmy3VrkpMko/PIB25UtTx wRkDcnqCg03ZR9EYCo5KdGI0gQ9bVItBaCOwwBUOpNQkeojEH38jWetKrhjmLDY8Rx2a gXvDq8SRRbnbfM6mK9558rzKPN8onxDdi/hIPUAxZ4I8CASTsDYTGFtLbGUmc5otu5tk A4kGpS9a5uJHWdGWqxHIjuwRPoKDHrEb14U2cBn5IvRCfoBydjsekw1cGNIyOODG5qDR eAIg== X-Gm-Message-State: ABUngvfRvYFO6Z1u1/Nit7srBJHn4IErgQ7DxYWATM94a1aXNuuJdr2M60Y5aWYNZy+FRg== X-Received: by 10.98.149.140 with SMTP id c12mr6473815pfk.100.1478866019535; Fri, 11 Nov 2016 04:06:59 -0800 (PST) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id z6sm14792684pay.31.2016.11.11.04.06.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 04:06:59 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Date: Fri, 11 Nov 2016 20:05:36 +0800 Message-Id: <1478865957-25252-9-git-send-email-tom.leiming@gmail.com> In-Reply-To: <1478865957-25252-1-git-send-email-tom.leiming@gmail.com> References: <1478865957-25252-1-git-send-email-tom.leiming@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 11 Nov 2016 12:07:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 11 Nov 2016 12:07:00 +0000 (UTC) for IP:'209.85.192.194' DOMAIN:'mail-pf0-f194.google.com' HELO:'mail-pf0-f194.google.com' FROM:'tom.leiming@gmail.com' RCPT:'' X-RedHat-Spam-Score: -1.709 (BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.192.194 mail-pf0-f194.google.com 209.85.192.194 mail-pf0-f194.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 14 Nov 2016 03:25:50 -0500 Cc: Christoph Hellwig , Mike Snitzer , Ming Lei , linux-block@vger.kernel.org, "maintainer:DEVICE-MAPPER LVM, Shaohua Li , linux-raid@vger.kernel.org open list:SOFTWARE RAID Multiple DisksSUPPORT" , linux-fsdevel@vger.kernel.org, Alasdair Kergon Subject: [dm-devel] [PATCH 08/12] dm: dm.c: replace 'bio->bi_vcnt == 1' with !bio_multiple_segments X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP Avoid to access .bi_vcnt directly, because the bio can be splitted from block layer, and .bi_vcnt should never have been used here. Signed-off-by: Ming Lei --- drivers/md/dm-rq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index b2a9e2d161e4..d9cc8324e597 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -797,8 +797,13 @@ static void dm_old_request_fn(struct request_queue *q) if (req_op(rq) != REQ_OP_FLUSH) pos = blk_rq_pos(rq); + /* + * bio can be splitted from block layer, so use + * !bio_multiple_segments instead of 'bio->bi_vcnt == 1' + */ if ((dm_old_request_peeked_before_merge_deadline(md) && - md_in_flight(md) && rq->bio && rq->bio->bi_vcnt == 1 && + md_in_flight(md) && rq->bio && + !bio_multiple_segments(rq->bio) && md->last_rq_pos == pos && md->last_rq_rw == rq_data_dir(rq)) || (ti->type->busy && ti->type->busy(ti))) { blk_delay_queue(q, 10);