From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EAD1C433F5 for ; Thu, 27 Jan 2022 20:01:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239817AbiA0UBd (ORCPT ); Thu, 27 Jan 2022 15:01:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234736AbiA0UBc (ORCPT ); Thu, 27 Jan 2022 15:01:32 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E31EC061714 for ; Thu, 27 Jan 2022 12:01:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=YfYqh5AXegFPSYmmpGCNINSsy5Jd2eg32j3jvkQd3As=; b=csFk+qUpLHubPzNbGwN1Gol4Rx e2B3p5i0RvKmyUIyrLJyNypMGMNDO1iq1L2NG8SZXHsfdAER60M62//P+cOoxyy7e1EODx+/oa8XC caVxdHKeU2kVXf76dSqi7bfNjJ+QsaSyJcw7QD7wVvm1dpCU3HwlwJ525G2IO0koNw9PYxSZam+6y TJleGZFS7H8NrQWL3V1vOK8ChwZ5o5W/UdVp6pUNiig4HEi/mjZVKv7Rj0pOvARc3xe3hLbHRp1nQ xcbqPBk/A9O6WrfYmBvToei1UlI8OXb5Z3r2HxJzvZbLR17DHDAzBLUGXpXgzrMw8sjjH0dqjulyl 0I6rY0EA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDAxW-00H0Y1-CQ; Thu, 27 Jan 2022 20:01:30 +0000 Date: Thu, 27 Jan 2022 12:01:30 -0800 From: Christoph Hellwig To: Mike Snitzer Cc: axboe@kernel.dk, linux-block@vger.kernel.org, dm-devel@redhat.com Subject: Re: [dm-devel] [PATCH 1/3] block: add __bio_start_io_acct() to control start_time Message-ID: References: <20220127190742.12776-1-snitzer@redhat.com> <20220127190742.12776-2-snitzer@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220127190742.12776-2-snitzer@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org > -static unsigned long __part_start_io_acct(struct block_device *part, > - unsigned int sectors, unsigned int op) > +static void __part_start_io_acct(struct block_device *part, unsigned int sectors, > + unsigned int op, unsigned long start_time) Please avoid the overly long line. > +/** > + * __bio_start_io_acct - start I/O accounting for bio based drivers > + * @bio: bio to start account for > + * @start_time: start time that should be passed back to bio_end_io_acct(). > + */ > +void __bio_start_io_acct(struct bio *bio, unsigned long start_time) I'd name this something like bio_start_io_acct_time to be a little more descriptive > + unsigned long now = READ_ONCE(jiffies); > + __bio_start_io_acct(bio, now); > + return now; Plase add an empty line after the variable declaration. > } > EXPORT_SYMBOL_GPL(bio_start_io_acct); > > unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, > unsigned int op) > { > - return __part_start_io_acct(disk->part0, sectors, op); > + unsigned long now = READ_ONCE(jiffies); > + __part_start_io_acct(disk->part0, sectors, op, now); > + return now; I wonder if just returning the passed in time from __part_start_io_acct wouldn't be a bit cleaner to avoid all the extra local variables. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 441A0C433EF for ; Thu, 27 Jan 2022 20:01:51 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-IiLiGRtLNI2piAO3drPznw-1; Thu, 27 Jan 2022 15:01:46 -0500 X-MC-Unique: IiLiGRtLNI2piAO3drPznw-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5007E8143E5; Thu, 27 Jan 2022 20:01:42 +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 227D218BA7; Thu, 27 Jan 2022 20:01:42 +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 6FD3E1809CB8; Thu, 27 Jan 2022 20:01:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20RK1d3D008708 for ; Thu, 27 Jan 2022 15:01:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0120A2026612; Thu, 27 Jan 2022 20:01:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F09672026609 for ; Thu, 27 Jan 2022 20:01:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B35B802814 for ; Thu, 27 Jan 2022 20:01:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-JwNcikaxOl6slUxbIPI2sg-1; Thu, 27 Jan 2022 15:01:32 -0500 X-MC-Unique: JwNcikaxOl6slUxbIPI2sg-1 Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDAxW-00H0Y1-CQ; Thu, 27 Jan 2022 20:01:30 +0000 Date: Thu, 27 Jan 2022 12:01:30 -0800 From: Christoph Hellwig To: Mike Snitzer Message-ID: References: <20220127190742.12776-1-snitzer@redhat.com> <20220127190742.12776-2-snitzer@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220127190742.12776-2-snitzer@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: dm-devel@redhat.com Cc: axboe@kernel.dk, linux-block@vger.kernel.org, dm-devel@redhat.com Subject: Re: [dm-devel] [PATCH 1/3] block: add __bio_start_io_acct() to control start_time 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > -static unsigned long __part_start_io_acct(struct block_device *part, > - unsigned int sectors, unsigned int op) > +static void __part_start_io_acct(struct block_device *part, unsigned int sectors, > + unsigned int op, unsigned long start_time) Please avoid the overly long line. > +/** > + * __bio_start_io_acct - start I/O accounting for bio based drivers > + * @bio: bio to start account for > + * @start_time: start time that should be passed back to bio_end_io_acct(). > + */ > +void __bio_start_io_acct(struct bio *bio, unsigned long start_time) I'd name this something like bio_start_io_acct_time to be a little more descriptive > + unsigned long now = READ_ONCE(jiffies); > + __bio_start_io_acct(bio, now); > + return now; Plase add an empty line after the variable declaration. > } > EXPORT_SYMBOL_GPL(bio_start_io_acct); > > unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, > unsigned int op) > { > - return __part_start_io_acct(disk->part0, sectors, op); > + unsigned long now = READ_ONCE(jiffies); > + __part_start_io_acct(disk->part0, sectors, op, now); > + return now; I wonder if just returning the passed in time from __part_start_io_acct wouldn't be a bit cleaner to avoid all the extra local variables. -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel