Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1270477pxa; Thu, 20 Aug 2020 07:12:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm+T4TcntvRYECxFuqDNrYT4kDCLRcpc8TrKqvmgT7JpcIyPYmEDU4u0o2uGenYX4HK6yP X-Received: by 2002:a17:906:f0cc:: with SMTP id dk12mr3324811ejb.97.1597932733732; Thu, 20 Aug 2020 07:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597932733; cv=none; d=google.com; s=arc-20160816; b=i2Tf9xTVLa9IWfjXj6Tv6NzcckOIF94gqnxoy+M5G+TLIVKf41/o86Kzd0ANUEMQBU TPIzszVeLm/qeQUZD56Gk/ouXwrQGv+ZFFk1rZVAjwa3hYiZfgNxmZLp6x29REA0G3UO ZfJ+Tmr9u3fZi642iXW4AKzPn+pCsUUFCYS2kBsciU3G7oz5STbBTEd7I6ttMpNWgUMk hyWMgvLAmsuqlrf2RWTrRzfBsoKIdejHcnle49it/hlJ8kgxXvztxOjYJwqpJ5qNMMvP qP/TmoZk1qDfav7cWLgKZGdtBE/OBTZeEaV46yFBPFXIeOaupCsQg52GjYRqsP4E75XA sDUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QyW4TXYvrMJhHtF5dTFZC77l9vk286Lef3An4TpTPhE=; b=SZ9zrdrNIxj/xf3Nfx01XcMMFLeal8Ic0C3xd9Vm6T4ayan1FRype0V70Yx3F4PDra MukciHYJ21LOlyKmph4JdtYTCLUL4rQrxikYrafqWOSW8/mCjl7CTija5uDPXLv11eMy EhiPVWeLkCcHJLGudttY5fuT51fSBDHztA0BMsNxs+r99VMJ8Hyx7puh2Ds2TI7Yvowz e56wEr69HE947pMhrG8uNwqH+zqDqAmk6SsgSOitKo0L2ONZpbNAbMMhd1V8SU5ByfVt eWhICpwFG43cheVp/PT6Y+9TR27uMbDRMhQlQySG36DWKIqM2uCVd9SLOzdFruE+facx Y71A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yI1K5NPK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga10si1297689ejb.372.2020.08.20.07.11.49; Thu, 20 Aug 2020 07:12:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yI1K5NPK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731020AbgHTNyW (ORCPT + 99 others); Thu, 20 Aug 2020 09:54:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:35656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727898AbgHTJ0e (ORCPT ); Thu, 20 Aug 2020 05:26:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F10AF22D00; Thu, 20 Aug 2020 09:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915594; bh=OR7j9qoFQeMiFNy5PaaWKvdEV1b7geYDxd0P+SguzH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yI1K5NPK1nGgSwLKPdIxFu+3w1h6qAV1BLNFnbnsuVGL8FimmcigmHVNOeLEjwbBs kUppKSAV8ohBiRHSJDZutJCu6jXvfSBltcVCwSvkS1ZJWMOUBOXAuI5Q2noT3KFo4L KXfszU9Ziwyt5sjrcE/C1BybXADU1Zs9sAtSpUXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coly Li , Christoph Hellwig , Jens Axboe Subject: [PATCH 5.8 069/232] bcache: use disk_{start,end}_io_acct() to count I/O for bcache device Date: Thu, 20 Aug 2020 11:18:40 +0200 Message-Id: <20200820091616.139861355@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Coly Li commit c5be1f2c5bab1538aa29cd42e226d6b80391e3ff upstream. This patch is a fix to patch "bcache: fix bio_{start,end}_io_acct with proper device". The previous patch uses a hack to temporarily set bi_disk to bcache device, which is mistaken too. As Christoph suggests, this patch uses disk_{start,end}_io_acct() to count I/O for bcache device in the correct way. Fixes: 85750aeb748f ("bcache: use bio_{start,end}_io_acct") Signed-off-by: Coly Li Cc: Christoph Hellwig Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/request.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -617,28 +617,6 @@ static void cache_lookup(struct closure /* Common code for the make_request functions */ -static inline void bch_bio_start_io_acct(struct gendisk *acct_bi_disk, - struct bio *bio, - unsigned long *start_time) -{ - struct gendisk *saved_bi_disk = bio->bi_disk; - - bio->bi_disk = acct_bi_disk; - *start_time = bio_start_io_acct(bio); - bio->bi_disk = saved_bi_disk; -} - -static inline void bch_bio_end_io_acct(struct gendisk *acct_bi_disk, - struct bio *bio, - unsigned long start_time) -{ - struct gendisk *saved_bi_disk = bio->bi_disk; - - bio->bi_disk = acct_bi_disk; - bio_end_io_acct(bio, start_time); - bio->bi_disk = saved_bi_disk; -} - static void request_endio(struct bio *bio) { struct closure *cl = bio->bi_private; @@ -690,7 +668,9 @@ static void backing_request_endio(struct static void bio_complete(struct search *s) { if (s->orig_bio) { - bch_bio_end_io_acct(s->d->disk, s->orig_bio, s->start_time); + /* Count on bcache device */ + disk_end_io_acct(s->d->disk, bio_op(s->orig_bio), s->start_time); + trace_bcache_request_end(s->d, s->orig_bio); s->orig_bio->bi_status = s->iop.status; bio_endio(s->orig_bio); @@ -750,8 +730,8 @@ static inline struct search *search_allo s->recoverable = 1; s->write = op_is_write(bio_op(bio)); s->read_dirty_data = 0; - bch_bio_start_io_acct(d->disk, bio, &s->start_time); - + /* Count on the bcache device */ + s->start_time = disk_start_io_acct(d->disk, bio_sectors(bio), bio_op(bio)); s->iop.c = d->c; s->iop.bio = NULL; s->iop.inode = d->id; @@ -1102,7 +1082,8 @@ static void detached_dev_end_io(struct b bio->bi_end_io = ddip->bi_end_io; bio->bi_private = ddip->bi_private; - bch_bio_end_io_acct(ddip->d->disk, bio, ddip->start_time); + /* Count on the bcache device */ + disk_end_io_acct(ddip->d->disk, bio_op(bio), ddip->start_time); if (bio->bi_status) { struct cached_dev *dc = container_of(ddip->d, @@ -1127,8 +1108,8 @@ static void detached_dev_do_request(stru */ ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); ddip->d = d; - bch_bio_start_io_acct(d->disk, bio, &ddip->start_time); - + /* Count on the bcache device */ + ddip->start_time = disk_start_io_acct(d->disk, bio_sectors(bio), bio_op(bio)); ddip->bi_end_io = bio->bi_end_io; ddip->bi_private = bio->bi_private; bio->bi_end_io = detached_dev_end_io;