From patchwork Sat Jan 19 18:05:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 10772093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40141186E for ; Sat, 19 Jan 2019 18:05:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 321B428AF5 for ; Sat, 19 Jan 2019 18:05:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2622529A99; Sat, 19 Jan 2019 18:05:13 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C246728AF5 for ; Sat, 19 Jan 2019 18:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728827AbfASSFM (ORCPT ); Sat, 19 Jan 2019 13:05:12 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:36779 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728668AbfASSFM (ORCPT ); Sat, 19 Jan 2019 13:05:12 -0500 Received: by mail-qt1-f193.google.com with SMTP id t13so18822897qtn.3 for ; Sat, 19 Jan 2019 10:05:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BR2RmhJOTJBgiIJ2i7GuBYcM1SLipDerQvNJepDZqU0=; b=j+YzevElnuEqVQd1o7IebbbTSeKspM9GLKZGLAUyOVQdZf8q9dGbOtFKOW5arK6fS0 4nuiJWPe5PZqkWGRhZ0EZ0ZSqREvi87I9mmmPJJT2jAwoYUVh7Keg2dwLRv9ZiEtiftq F1tAM/2yGQ+b7+FbLpcNhTwDRyquoEGq/nXHa6W9C39tg3yXJuBA77z3eKzQa2jOKK12 6GAP9hTTnCzR077gMCCC6LWex1GcDQxHZ80xVVzstpyWdI2RCWeusfypZbujxsvrX18i Kp+8pX4NHNrEozPN5OPP3tuyTrIb/hBeNsDAPb6crJEqwxhONTtp0OtWlFyRWXX6Gucd RY6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BR2RmhJOTJBgiIJ2i7GuBYcM1SLipDerQvNJepDZqU0=; b=ousjcDQtNSe/OpCu8DVh/Wkih0AMsVcvLs/V+jYyA2i7Jn7Shb1Tt7bVG9orOmIUL/ hg8XXB60tCHWxYi+n391KjevxLRKC+61uQai4K344nWyWb4LDL+cvekAqjPs3HUDPz6b teLKWqIyMhhw8a8mc8vozUFJQAYgcrQ6uHbDSNXFoJKt9W+vCvWQcRAZRxYdNy9y/srh i5cDSMbE4g2GQf4QNXZPqmlsJlFkZ+gxW/3rBqYyQ3qtua1NJMjhRSsH0iXYNRWXp7SS S5IBjt+VBaCMDW0EIQ0KZNcqT9/ckiM5v4ZR6BMCGt8WuBND8gYXPLIw5qDfQor9g1aq sjuA== X-Gm-Message-State: AJcUukeuhtCklos3txxCnF8b6nhSk/7u0Zmk6fUBWBoTQK/eYYXIqnBH 9yD/3fv3wtflkWb6unjzmn2dSRYm X-Google-Smtp-Source: ALg8bN6rF26fAXwED76Ky/dp8SbPaXma5vLYjoMAt+C29uJ477vS5yYWyJtZPRlx5hL01UDFozcJiA== X-Received: by 2002:aed:36c1:: with SMTP id f59mr20597598qtb.250.1547921111218; Sat, 19 Jan 2019 10:05:11 -0800 (PST) Received: from localhost (pool-68-160-176-113.bstnma.fios.verizon.net. [68.160.176.113]) by smtp.gmail.com with ESMTPSA id t5sm35550589qkl.14.2019.01.19.10.05.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 10:05:10 -0800 (PST) From: Mike Snitzer To: dm-devel@redhat.com Cc: NeilBrown , Ming Lei , axboe@kernel.dk, linux-block@vger.kernel.org Subject: [PATCH 1/4] dm: fix clone_bio() to trigger blk_recount_segments() Date: Sat, 19 Jan 2019 13:05:03 -0500 Message-Id: <20190119180506.1300-2-snitzer@redhat.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190119180506.1300-1-snitzer@redhat.com> References: <20190119180506.1300-1-snitzer@redhat.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 DM's clone_bio() now benefits from using bio_trim() by fixing the fact that clone_bio() wasn't clearing BIO_SEG_VALID like bio_trim() does; which triggers blk_recount_segments() via bio_phys_segments(). Signed-off-by: Mike Snitzer Reviewed-by: Ming Lei --- drivers/md/dm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index d67c95ef8d7e..fcb97b0a5743 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, __bio_clone_fast(clone, bio); - if (unlikely(bio_integrity(bio) != NULL)) { + if (bio_integrity(bio)) { int r; if (unlikely(!dm_target_has_integrity(tio->ti->type) && @@ -1336,11 +1336,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, return r; } - bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); - clone->bi_iter.bi_size = to_bytes(len); - - if (unlikely(bio_integrity(bio) != NULL)) - bio_integrity_trim(clone); + bio_trim(clone, sector - clone->bi_iter.bi_sector, len); return 0; } From patchwork Sat Jan 19 18:05:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 10772095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E8926C5 for ; Sat, 19 Jan 2019 18:05:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 901AF28AF5 for ; Sat, 19 Jan 2019 18:05:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 841FE29A99; Sat, 19 Jan 2019 18:05:15 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 17C4E28AF5 for ; Sat, 19 Jan 2019 18:05:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728862AbfASSFO (ORCPT ); Sat, 19 Jan 2019 13:05:14 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:39321 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728668AbfASSFO (ORCPT ); Sat, 19 Jan 2019 13:05:14 -0500 Received: by mail-qt1-f193.google.com with SMTP id u47so18805392qtj.6 for ; Sat, 19 Jan 2019 10:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=HNtCxs6Hio0+5xh9aKWTwuKO3XPEcG5zRyVZxia7uUY=; b=c9hlF8lfiJSRMxJ4Tm1Eo2UOuH5jkJnlyqf2mrligq4kmSbvGa4KFOyodbR0jwpQkx uifJiwPTcvo4Bp86MARB4piTqK0CpfwIkaa+unEWSuaoHgwkSFouCGx4Zarf38frtxod 4LMLFprcumJGhC3gyEwHsp2CTy1NTEBgGLFpMYTcjoUbY7CG4NijaMce5ZHAWQtRVrP6 Gr6xIzeb9OJ/IOfPR/elIqq3ya/JOJ1qhHkFxdQ5l2DX5r6/wm4h6vsZd6IXkgk5VM8e qydm/N9l1IiINkeTfnFtuce26E3TE7LUXGsB0U9QflQ0GWHiSnNK2sU7zQctqJw07izO FQnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=HNtCxs6Hio0+5xh9aKWTwuKO3XPEcG5zRyVZxia7uUY=; b=hFigAi4En7GegW/tiGMiYnEDoOZ4oj+JF3JhX2B65dwuLfn7vJKVfXnIw7G9P+LQPI tnERBVWhTKsw2j3bFxpNaFl5Ly1OXvnC842v+aYiY/htPa0tfPSTWLcOWcs4Kz75KTap Uw7GdGO8r7THZ83aXLTPrC73KOkPvJz4zeewkcyR1DOddiRs9iNkPMgGVE/kWCzZ0jeC zScJHvZ5fDxRTdUaKq00zUcSaFqdedIZxWro7fwqMycAVbqX0v/5ONxZCBhTNOehpOnr De11Bi7u7JG2xBwmfVPsldLyj4QvnueffW4iNDEgMU84BuItr2AAsk5MCJm67MQgQzew rHfQ== X-Gm-Message-State: AJcUukdSm8MGDDmGMSGlAQnim8/yX3gl6yJX8SX8Ej726b+QjLl9a6JN 55s94gXxIhyj6fuwt8p9Q0M= X-Google-Smtp-Source: ALg8bN5HH966CVOZdkbUHXX6AsCqk+v/Fux8upPWCa8vk6IN9/ymokTGWPHFQbN+MnJR3r99a9In1Q== X-Received: by 2002:ac8:33fc:: with SMTP id d57mr20098374qtb.82.1547921112881; Sat, 19 Jan 2019 10:05:12 -0800 (PST) Received: from localhost (pool-68-160-176-113.bstnma.fios.verizon.net. [68.160.176.113]) by smtp.gmail.com with ESMTPSA id m81sm43331864qkl.92.2019.01.19.10.05.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 10:05:12 -0800 (PST) From: Mike Snitzer To: dm-devel@redhat.com Cc: NeilBrown , Ming Lei , axboe@kernel.dk, linux-block@vger.kernel.org Subject: [PATCH 2/4] dm: fix redundant IO accounting for bios that need splitting Date: Sat, 19 Jan 2019 13:05:04 -0500 Message-Id: <20190119180506.1300-3-snitzer@redhat.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190119180506.1300-1-snitzer@redhat.com> References: <20190119180506.1300-1-snitzer@redhat.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 The risk of redundant IO accounting was not taken into consideration when commit 18a25da84354 ("dm: ensure bio submission follows a depth-first tree walk") introduced IO splitting in terms of recursion via generic_make_request(). Fix this by subtracting the split bio's payload from the IO stats that were already accounted for by start_io_acct() upon dm_make_request() entry. This repeat oscillation of the IO accounting, up then down, isn't ideal but refactoring DM core's IO splitting to pre-split bios _before_ they are accounted turned out to be an excessive amount of change that will need a full development cycle to refine and verify. Before this fix: /dev/mapper/stripe_dev is a 4-way stripe using a 32k chunksize, so bios are split on 32k boundaries. # fio --name=16M --filename=/dev/mapper/stripe_dev --rw=write --bs=64k --size=16M \ --iodepth=1 --ioengine=libaio --direct=1 --refill_buffers with debugging added: [103898.310264] device-mapper: core: start_io_acct: dm-2 WRITE bio->bi_iter.bi_sector=0 len=128 [103898.318704] device-mapper: core: __split_and_process_bio: recursing for following split bio: [103898.329136] device-mapper: core: start_io_acct: dm-2 WRITE bio->bi_iter.bi_sector=64 len=64 ... 16M written yet 136M (278528 * 512b) accounted: # cat /sys/block/dm-2/stat | awk '{ print $7 }' 278528 After this fix: 16M written and 16M (32768 * 512b) accounted: # cat /sys/block/dm-2/stat | awk '{ print $7 }' 32768 Fixes: 18a25da84354 ("dm: ensure bio submission follows a depth-first tree walk") Cc: stable@vger.kernel.org # 4.16+ Reported-by: Bryan Gurney Signed-off-by: Mike Snitzer Reviewed-by: Ming Lei --- drivers/md/dm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index fcb97b0a5743..fbadda68e23b 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1584,6 +1584,9 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md, ci->sector = bio->bi_iter.bi_sector; } +#define __dm_part_stat_sub(part, field, subnd) \ + (part_stat_get(part, field) -= (subnd)) + /* * Entry point to split a bio into clones and submit them to the targets. */ @@ -1638,6 +1641,19 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count, GFP_NOIO, &md->queue->bio_split); ci.io->orig_bio = b; + + /* + * Adjust IO stats for each split, otherwise upon queue + * reentry there will be redundant IO accounting. + * NOTE: this is a stop-gap fix, a proper fix involves + * significant refactoring of DM core's bio splitting + * (by eliminating DM's splitting and just using bio_split) + */ + part_stat_lock(); + __dm_part_stat_sub(&dm_disk(md)->part0, + sectors[op_stat_group(bio_op(bio))], ci.sector_count); + part_stat_unlock(); + bio_chain(b, bio); ret = generic_make_request(bio); break; From patchwork Sat Jan 19 18:05:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 10772097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 089546C5 for ; Sat, 19 Jan 2019 18:05:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF17828AF5 for ; Sat, 19 Jan 2019 18:05:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E32D729A99; Sat, 19 Jan 2019 18:05: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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 9649F28AF5 for ; Sat, 19 Jan 2019 18:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728892AbfASSFQ (ORCPT ); Sat, 19 Jan 2019 13:05:16 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:36785 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728668AbfASSFP (ORCPT ); Sat, 19 Jan 2019 13:05:15 -0500 Received: by mail-qt1-f195.google.com with SMTP id t13so18823014qtn.3 for ; Sat, 19 Jan 2019 10:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Xam2qz/iGZ2SU9NuNxXD/C9OzO4f5Xq2vH+9/0d7tVw=; b=UkL0pU3tdzXtytpB3DbrJUcKw/8NxBnYXSpmwtXHHh0R4iL2Mx9RB5RYDYSJeeCRYy 3PslZyC4PMF716nTYbe1Tn+g6qC0aEBvMXcqw0GK/XkfKtDcY18OzCKMWqh3PwHmhuqS TIHekK7rGpTZMec2AAHYutFl2Rz7+CZomjgwujekSWl3WBCiIUmuYEndnKlGoVx3uZrO m4GNBXvK39bm8YvGWyRZT7PRtXuO7qndG1/KWaiKyKxfZMI/F3aEPRntgLsAaayDvA5v hfNK6yHfFk5IirSOi3sxJRsJNZVfxKs9OHdc/tCx+yeP7FXx86pVPVNzdSAqPdvHZOlC jvoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Xam2qz/iGZ2SU9NuNxXD/C9OzO4f5Xq2vH+9/0d7tVw=; b=EaC91pQ0zmE7ZJG9W2yQVdihx2HXloP4G2dDhC11zoD7G0vPdqHjBMRKKSUDq5r3XZ V5HGqQCL1fJisVMGun5UWPBYZK3+UGCLaV5Cp97Vn+khXW/lqwZRQELjLn5wMeXibUe0 +owrV1qD0z/Oq4PhSimk5nzGUOvXwKpLqiPDOr7BK5I1D3e0J0Sdg6fUpP+Mb+e/HO69 wHDcP33cv8AFK+We78M9pE5etRU66h+a5OtgU5d5kbLezWuCkZSMK96QsZPabeAbONsy CN5NLnd6posUWzCqB3uuPCxElPmBHaGfRZ4EsZaPmfEI0NZS932qT6Z8CV/rn4ly6L3Y v/5A== X-Gm-Message-State: AJcUukfPPX6HEKWzF5SV9FSU5y7zzdMp8oHylkWRX6Ef61kZmQHJHv+j TS/6IGNY2q+8INHw3mapwVg= X-Google-Smtp-Source: ALg8bN7yTv8YKdR7o1QnjRohywutXXp77B/qhQzlxPgyK/2Y/13Afm3nB5navmTvsFkD8HTFqOhXlA== X-Received: by 2002:aed:3b76:: with SMTP id q51mr20739358qte.229.1547921114718; Sat, 19 Jan 2019 10:05:14 -0800 (PST) Received: from localhost (pool-68-160-176-113.bstnma.fios.verizon.net. [68.160.176.113]) by smtp.gmail.com with ESMTPSA id o21sm64275035qto.18.2019.01.19.10.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 10:05:13 -0800 (PST) From: Mike Snitzer To: dm-devel@redhat.com Cc: NeilBrown , Ming Lei , axboe@kernel.dk, linux-block@vger.kernel.org Subject: [PATCH 3/4] dm: fix missing bio_split() pattern code in __split_and_process_bio() Date: Sat, 19 Jan 2019 13:05:05 -0500 Message-Id: <20190119180506.1300-4-snitzer@redhat.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190119180506.1300-1-snitzer@redhat.com> References: <20190119180506.1300-1-snitzer@redhat.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 Use the same BIO_QUEUE_ENTERED pattern that was established by commit cd4a4ae4683dc ("block: don't use blocking queue entered for recursive bio submits") by setting BIO_QUEUE_ENTERED after bio_split() and before recursing via generic_make_request(). Also add trace_block_split() because it provides useful context about bio splits in blktrace. Depends-on: cd4a4ae4683dc ("block: don't use blocking queue entered for recursive bio submits") Fixes: 18a25da84354 ("dm: ensure bio submission follows a depth-first tree walk") Cc: stable@vger.kernel.org # 4.16+ Signed-off-by: Mike Snitzer Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index fbadda68e23b..6e29c2d99b99 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1654,7 +1654,9 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, sectors[op_stat_group(bio_op(bio))], ci.sector_count); part_stat_unlock(); + bio_set_flag(bio, BIO_QUEUE_ENTERED); bio_chain(b, bio); + trace_block_split(md->queue, b, bio->bi_iter.bi_sector); ret = generic_make_request(bio); break; } From patchwork Sat Jan 19 18:05:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 10772099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4117513B5 for ; Sat, 19 Jan 2019 18:05:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3445328AF5 for ; Sat, 19 Jan 2019 18:05:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28CEE29A99; Sat, 19 Jan 2019 18:05:19 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C77E728AF5 for ; Sat, 19 Jan 2019 18:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728916AbfASSFS (ORCPT ); Sat, 19 Jan 2019 13:05:18 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46339 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728668AbfASSFS (ORCPT ); Sat, 19 Jan 2019 13:05:18 -0500 Received: by mail-qt1-f194.google.com with SMTP id y20so18747339qtm.13 for ; Sat, 19 Jan 2019 10:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=g45qMdy3Kp0PFHIpUrKiuZWWVQgkrHivQ30JFr3/2Mw=; b=PM+BS3HnV9IdKEIU1dB30FSOEx6NWB6oGOj1QG3mKGnmBiy08GSqOnW2la6KUZCOGt lNVMT0BfUMmd8Q5dCCOR/3zuYrr8S9leCR+qIC08iCiczfDOAVXJB5qBkCgWMGjRC1sk xio56TbeJr+WtElGMP8OugM92mO58PL6VGDHDO6xcrvx2TuGCo/sSC8qQ2g8MEpfhmOW 3NtAelMmJj8q8PsP0JLwEsKIdJL7jhCs7M1umf1J6oujVnOSOS8I2D9qZuVp3LEOBfEt JYcc0bviJEAf8FUWYAY4wDMYFNznjlCskuMp1GIdgQJIKJIYDuCyDC6yzDH3FqbJwoEC RkAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=g45qMdy3Kp0PFHIpUrKiuZWWVQgkrHivQ30JFr3/2Mw=; b=MCUBwArwIPTKtM9wQUBQu7TBC1lbC0qX/DL5Lh3HfgUubgcVEE1gHPcu+gAsFv/RJN kizii6IIl1ZPxvJmzTsOmYWHhJyE5eJDgQGkWd7U7NHQnpx5n9w14eumQTp8jR4K9at8 6n5iO7LyaR0ggerlzeA7cuVL+ScUJIOnRl0oY7RNAzGoAT8X6GDg3fLPGvUiOEsNhBsf AvIehwQvbFSUEcKdePVQn7eg6Vd0aepGiwwF3FX1JRwQUdqAf+s3Mr1S/Hfx+TJo2s6J W4j0Tyn79phFGwbMcBO7fQX548ALS5XT+NKMzpVOyxbtlrmqjQwSI1W9g/LMMcLNsYqN bt3w== X-Gm-Message-State: AJcUukdJ3L6Wkbjm/pBHoLycbMn/E1UB9JtytGuTPJ0eLF8TBSWBza50 V5Cn9cRiy6YHAFW5yAP9g/E= X-Google-Smtp-Source: ALg8bN6PEMJUiaxDn2v09hGoE6IweZyZL5k9aIsELqSZhXdr0DHxwOO3b/HTIFMA+KTs3OM8YJgMEg== X-Received: by 2002:aed:3968:: with SMTP id l95mr20974027qte.344.1547921116591; Sat, 19 Jan 2019 10:05:16 -0800 (PST) Received: from localhost (pool-68-160-176-113.bstnma.fios.verizon.net. [68.160.176.113]) by smtp.gmail.com with ESMTPSA id n92sm48474086qtd.85.2019.01.19.10.05.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 10:05:15 -0800 (PST) From: Mike Snitzer To: dm-devel@redhat.com Cc: NeilBrown , Ming Lei , axboe@kernel.dk, linux-block@vger.kernel.org Subject: [PATCH 4/4] dm: fix dm_wq_work() to only use __split_and_process_bio() if appropriate Date: Sat, 19 Jan 2019 13:05:06 -0500 Message-Id: <20190119180506.1300-5-snitzer@redhat.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190119180506.1300-1-snitzer@redhat.com> References: <20190119180506.1300-1-snitzer@redhat.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 Otherwise targets that don't support/expect IO splitting could resubmit bios using code paths with unnecessary IO splitting complexity. Depends-on: 24113d487843 ("dm: avoid indirect call in __dm_make_request") Fixes: 978e51ba38e00 ("dm: optimize bio-based NVMe IO submission") Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 6e29c2d99b99..aa7e429646b3 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1727,6 +1727,15 @@ static blk_qc_t __process_bio(struct mapped_device *md, return ret; } +static blk_qc_t dm_process_bio(struct mapped_device *md, + struct dm_table *map, struct bio *bio) +{ + if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) + return __process_bio(md, map, bio); + else + return __split_and_process_bio(md, map, bio); +} + static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) { struct mapped_device *md = q->queuedata; @@ -1747,10 +1756,7 @@ static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) return ret; } - if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) - ret = __process_bio(md, map, bio); - else - ret = __split_and_process_bio(md, map, bio); + ret = dm_process_bio(md, map, bio); dm_put_live_table(md, srcu_idx); return ret; @@ -2429,9 +2435,9 @@ static void dm_wq_work(struct work_struct *work) break; if (dm_request_based(md)) - generic_make_request(c); + (void) generic_make_request(c); else - __split_and_process_bio(md, map, c); + (void) dm_process_bio(md, map, c); } dm_put_live_table(md, srcu_idx);