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: 9422887 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 24EF060233 for ; Fri, 11 Nov 2016 12:08:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17271299EE for ; Fri, 11 Nov 2016 12:08:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B1BD29A81; Fri, 11 Nov 2016 12:08:16 +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 vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAD8F299EE for ; Fri, 11 Nov 2016 12:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933380AbcKKMHD (ORCPT ); Fri, 11 Nov 2016 07:07:03 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35220 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933254AbcKKMHA (ORCPT ); Fri, 11 Nov 2016 07:07:00 -0500 Received: by mail-pf0-f195.google.com with SMTP id i88so2404580pfk.2; 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=QAWuxlBj0Y+ZS0pNKlElTC7uF7lFw2SEKLrd7MnnvBLf1V+1Q80olFrGVWq79gnCeC QJYbuf7YcVaB2wv6dnFr9HTaJALvq+MGoMaVYgxPZBSHwf4iJwF1OOdqrxVpcsi8guQg w80jfGLjwGZ+qi82O0t9QBTdhWE2Vt+VbuXSG0ZQ/P5a2HzW4h5zEJUlXvy2O5iySjyG 5evTAWx962y/RYXJOLTGk0aRmSHf2N/oFYO/047/LOrXSeaan1MQQ/Ayg3iinkuDTilo Wf3uKpq3AOE6QeYYmgGH73+GeNrAS7x6i/lz+1la2XTI4ahhPVXEaxp+7Nltc+3cIrAL P9Tg== X-Gm-Message-State: ABUngvd/LNVSTuyuFHK1y0SNf6rvQzgABEzIISXGs6gkZwFdy15h+QVZysFQfDqIyxOzaA== 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 Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , Ming Lei , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com (maintainer:DEVICE-MAPPER (LVM)), Shaohua Li , linux-raid@vger.kernel.org (open list:SOFTWARE RAID (Multiple Disks) SUPPORT) Subject: [PATCH 08/12] dm: dm.c: replace 'bio->bi_vcnt == 1' with !bio_multiple_segments Date: Fri, 11 Nov 2016 20:05:36 +0800 Message-Id: <1478865957-25252-9-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478865957-25252-1-git-send-email-tom.leiming@gmail.com> References: <1478865957-25252-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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);