Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933491AbcKKMHE (ORCPT ); Fri, 11 Nov 2016 07:07:04 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1036 Lines: 30 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); -- 2.7.4