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 4C525C433FE for ; Mon, 10 Oct 2022 07:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231326AbiJJH7J (ORCPT ); Mon, 10 Oct 2022 03:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230470AbiJJH7I (ORCPT ); Mon, 10 Oct 2022 03:59:08 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB6E72D74A; Mon, 10 Oct 2022 00:59:07 -0700 (PDT) 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=sWolSNkLX1ZPnLQhfmowne8piiQT5rQ6uM09AjXa5Dc=; b=aJIBlsb0nSpWjrle4oZywMion1 d0M1TLezw/OcG2P0MgPxI6aB4/HTO9AxzYy4TBBhT7iUcr9rtBjX/6QDGEY3NVp14bJ4/jDCFWOLR AQbNGi/LTMEXH3wmTjrkT5Y5SGv/Ib9V7XughQZRpp+pgf73tDFKD5qBO9fZNJp7D5XdpZAn047TZ EiJJmMepreW3fKePOipspGiOfrSt007DayqpG0JoDUJoeTic1aqPtkls/MHiWNJVicPA3qcsuILrN M+txLRN4vmfGm/5lZL3wxlLajTmeHmNW15SUYd9J3te7dVhIl6aHu6Zoczw8l4kTSbppDR+vGd2rO RUq4Vc7g==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohngj-00HSJR-TP; Mon, 10 Oct 2022 07:59:01 +0000 Date: Mon, 10 Oct 2022 00:59:01 -0700 From: Christoph Hellwig To: Chaitanya Kulkarni Cc: ogeert@linux-m68k.org, linux-block@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, drbd-dev@lists.linbit.com, nbd@other.debian.org, linux-mtd@lists.infradead.org, axboe@kernel.dk, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, christoph.boehmwalder@linbit.com, efremov@linux.com, josef@toxicpanda.com, tim@cyberelk.net, haris.iqbal@ionos.com, jinpu.wang@ionos.com, richard@nod.at, miquel.raynal@bootlin.com, vigneshr@ti.com, mcgrof@kernel.org, hare@suse.de, damien.lemoal@opensource.wdc.com, johannes.thumshirn@wdc.com, bvanassche@acm.org, ming.lei@redhat.com, vincent.fu@samsung.com, shinichiro.kawasaki@wdc.com Subject: Re: [RFC PATCH 01/18] block: add and use init disk helper Message-ID: References: <20221005050027.39591-1-kch@nvidia.com> <20221005050027.39591-2-kch@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221005050027.39591-2-kch@nvidia.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-m68k@vger.kernel.org On Tue, Oct 04, 2022 at 10:00:10PM -0700, Chaitanya Kulkarni wrote: > +void init_disk(struct gendisk *disk, int major, int first_minor, > + int minors, sector_t sectors, void *private_data, > + const struct block_device_operations *fops) > +{ > + disk->major = major; > + disk->first_minor = first_minor; > + disk->minors = minors; > + set_capacity(disk, sectors); > + disk->private_data = private_data; > + disk->fops = fops; I don't like this at all. For one major/first_minor/minors are optional and discouraged for new drivers. Setting the capacity is a different thing and is done by helpers also used for revalidation in many drivers. It might make sense to pass the fops (and maybe private_data) to blk_mq_alloc_disk / blk_alloc_disk, but even then I'm not quite sure it is worth the churn.