From patchwork Thu Feb 14 15:00:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 10812985 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-2.web.codeaurora.org (Postfix) with ESMTP id D893713B5 for ; Thu, 14 Feb 2019 15:01:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C61E52E965 for ; Thu, 14 Feb 2019 15:01:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C472C2E96C; Thu, 14 Feb 2019 15:01:23 +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.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7120D2E970 for ; Thu, 14 Feb 2019 15:01:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0B937C845; Thu, 14 Feb 2019 15:01:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87D448271D; Thu, 14 Feb 2019 15:01:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8C3B9181A00C; Thu, 14 Feb 2019 15:01:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1EF16Mw005324 for ; Thu, 14 Feb 2019 10:01:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7AD9B5447E; Thu, 14 Feb 2019 15:01:06 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from leontynka.twibright.com (ovpn-204-36.brq.redhat.com [10.40.204.36]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1EB8646E75; Thu, 14 Feb 2019 15:01:06 +0000 (UTC) Received: from debian-a64.vm ([192.168.208.2]) by leontynka.twibright.com with smtp (Exim 4.89) (envelope-from ) id 1guIVb-0008Rp-I9; Thu, 14 Feb 2019 16:01:04 +0100 Received: by debian-a64.vm (sSMTP sendmail emulation); Thu, 14 Feb 2019 16:01:03 +0100 Message-Id: <20190214150102.931117000@debian-a64.vm> User-Agent: quilt/0.65 Date: Thu, 14 Feb 2019 16:00:03 +0100 From: Mikulas Patocka To: Mike Snitzer , Alasdair G Kergon MIME-Version: 1.0 Content-Disposition: inline; filename=refactor-start-io-acct.patch X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Mikulas Patocka Subject: [dm-devel] [PATCH 1/4] dm: refactor start_io_acct 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: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 14 Feb 2019 15:01:18 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This patch refactors start_io_acct, so that it doesn't take a pointer to struct dm_io - so that it could be used in the following patch. Signed-off-by: Mikulas Patocka --- drivers/md/dm.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/drivers/md/dm.c =================================================================== --- linux-2.6.orig/drivers/md/dm.c 2019-02-05 12:07:21.000000000 +0100 +++ linux-2.6/drivers/md/dm.c 2019-02-05 14:31:56.000000000 +0100 @@ -580,7 +580,10 @@ out: return r; } -static void start_io_acct(struct dm_io *io); +static void start_io_acct(struct mapped_device *md, struct bio *bio) +{ + generic_start_io_acct(md->queue, bio_op(bio), bio_sectors(bio), &dm_disk(md)->part0); +} static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio) { @@ -604,7 +607,14 @@ static struct dm_io *alloc_io(struct map io->md = md; spin_lock_init(&io->endio_lock); - start_io_acct(io); + io->start_time = jiffies; + + start_io_acct(md, bio); + + if (unlikely(dm_stats_used(&md->stats))) + dm_stats_account_io(&md->stats, bio_data_dir(bio), + bio->bi_iter.bi_sector, bio_sectors(bio), + false, 0, &io->stats_aux); return io; } @@ -668,22 +678,6 @@ static bool md_in_flight(struct mapped_d return md_in_flight_bios(md); } -static void start_io_acct(struct dm_io *io) -{ - struct mapped_device *md = io->md; - struct bio *bio = io->orig_bio; - - io->start_time = jiffies; - - generic_start_io_acct(md->queue, bio_op(bio), bio_sectors(bio), - &dm_disk(md)->part0); - - if (unlikely(dm_stats_used(&md->stats))) - dm_stats_account_io(&md->stats, bio_data_dir(bio), - bio->bi_iter.bi_sector, bio_sectors(bio), - false, 0, &io->stats_aux); -} - static void end_io_acct(struct dm_io *io) { struct mapped_device *md = io->md; From patchwork Thu Feb 14 15:00:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 10812987 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-2.web.codeaurora.org (Postfix) with ESMTP id 1A1C313B5 for ; Thu, 14 Feb 2019 15:01:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 074A72E964 for ; Thu, 14 Feb 2019 15:01:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 059382E973; Thu, 14 Feb 2019 15:01:29 +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.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D5F92E964 for ; Thu, 14 Feb 2019 15:01:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B990961D07; Thu, 14 Feb 2019 15:01:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 999E546E61; Thu, 14 Feb 2019 15:01:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2BFDB3F7CD; Thu, 14 Feb 2019 15:01:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1EF175q005334 for ; Thu, 14 Feb 2019 10:01:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id AAC0C5FCD3; Thu, 14 Feb 2019 15:01:07 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from leontynka.twibright.com (ovpn-204-36.brq.redhat.com [10.40.204.36]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 586D584895; Thu, 14 Feb 2019 15:01:07 +0000 (UTC) Received: from debian-a64.vm ([192.168.208.2]) by leontynka.twibright.com with smtp (Exim 4.89) (envelope-from ) id 1guIVc-0008Rt-QG; Thu, 14 Feb 2019 16:01:05 +0100 Received: by debian-a64.vm (sSMTP sendmail emulation); Thu, 14 Feb 2019 16:01:04 +0100 Message-Id: <20190214150104.178508520@debian-a64.vm> User-Agent: quilt/0.65 Date: Thu, 14 Feb 2019 16:00:04 +0100 From: Mikulas Patocka To: Mike Snitzer , Alasdair G Kergon MIME-Version: 1.0 Content-Disposition: inline; filename=refactor-end-io-acct.patch X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Mikulas Patocka Subject: [dm-devel] [PATCH 2/4] dm: refactor end_io_acct 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: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 14 Feb 2019 15:01:27 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This patch refactors end_io_acct, so that it doesn't take a pointer to struct dm_io - so that it could be used in the following patch. Signed-off-by: Mikulas Patocka --- drivers/md/dm.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/drivers/md/dm.c =================================================================== --- linux-2.6.orig/drivers/md/dm.c 2019-02-05 14:32:08.000000000 +0100 +++ linux-2.6/drivers/md/dm.c 2019-02-05 14:36:13.000000000 +0100 @@ -585,6 +585,15 @@ static void start_io_acct(struct mapped_ generic_start_io_acct(md->queue, bio_op(bio), bio_sectors(bio), &dm_disk(md)->part0); } +static void end_io_acct(struct mapped_device *md, struct bio *bio, unsigned long start_time) +{ + generic_end_io_acct(md->queue, bio_op(bio), &dm_disk(md)->part0, start_time); + + /* nudge anyone waiting on suspend queue */ + if (unlikely(wq_has_sleeper(&md->wait))) + wake_up(&md->wait); +} + static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio) { struct dm_io *io; @@ -678,25 +687,6 @@ static bool md_in_flight(struct mapped_d return md_in_flight_bios(md); } -static void end_io_acct(struct dm_io *io) -{ - struct mapped_device *md = io->md; - struct bio *bio = io->orig_bio; - unsigned long duration = jiffies - io->start_time; - - generic_end_io_acct(md->queue, bio_op(bio), &dm_disk(md)->part0, - io->start_time); - - if (unlikely(dm_stats_used(&md->stats))) - dm_stats_account_io(&md->stats, bio_data_dir(bio), - bio->bi_iter.bi_sector, bio_sectors(bio), - true, duration, &io->stats_aux); - - /* nudge anyone waiting on suspend queue */ - if (unlikely(wq_has_sleeper(&md->wait))) - wake_up(&md->wait); -} - /* * Add the bio to the list of deferred io. */ @@ -935,7 +925,15 @@ static void dec_pending(struct dm_io *io io_error = io->status; bio = io->orig_bio; - end_io_acct(io); + + if (unlikely(dm_stats_used(&md->stats))) { + unsigned long duration = jiffies - io->start_time; + dm_stats_account_io(&md->stats, bio_data_dir(bio), + bio->bi_iter.bi_sector, bio_sectors(bio), + true, duration, &io->stats_aux); + } + + end_io_acct(md, bio, io->start_time); free_io(md, io); if (io_error == BLK_STS_DM_REQUEUE)