Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27632139rwd; Tue, 4 Jul 2023 05:51:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5bXb05ALEHpoxq4dLP6i1JK5TH9DO8m0EmtG13SKaZqMSOW3MUr8xSuoH98F2v2RXapK3X X-Received: by 2002:a05:6870:5149:b0:1b0:18e8:9536 with SMTP id z9-20020a056870514900b001b018e89536mr15546699oak.52.1688475086650; Tue, 04 Jul 2023 05:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688475086; cv=none; d=google.com; s=arc-20160816; b=uxd9tS+Y87aS4al7KhZ/pd7yQyoxXFnFJSOEHEjqODW6CKI5e3sRgTVXcNp+h+oO9Q Q5cFYNEdFf6pmkVG6VKxIbOkog31dHAgbsA0IL/sJ4WSg/ukkFv+2CEDB7mIFQSm4Y+b id6JQisSuJ4lbwWwlfniwln+LPmub35JQY6fNh0ujaufvuFA9HCy7kA/6FMrCRc3lbig vqKh4Gk2JAzmGJ6/dTe3Z1/0DPV7z3gXhMBp64mo04FwKUngloK7wMX6QeYwB8GIPZFa Lj3ktxWza3OxBenV6yFftJp3SZSE9IuxVbmIiclPtpWpgf+vI3phrux5qw2JQyECjELm dJlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MTt8zrAicdNCIRJKdOYeAgLwlWREbjuubDrB9LDLoHk=; fh=xHHhgXFg1j0vY29h1LnokJjtfE6jcQYD0jXs9j15yYw=; b=vcH93bygZhtE4b61P6ptZ99jgDdZqANIXmqSIm6nRScrOfj8I0ApLDQnO5gQqw0PG5 af8e5+qbIeuvblqh0JWO9P9HjmNXCFekhE6oCbBx96RPZRe4D937DHfUjvAuazCY80ko VignlkjoOtQlq0Nl7FoQ+t0dbTbIR48YD0BZVsPDe8nX81h73/YygXcybGSwVCVHu4j3 1PBgRQmo3rkqfGprse3lTIR36UsIJ0TlNUfG/ryokMKrul2j3QbR4m2sMoo0gG5+UK/o g2QAHOl2OKsjfLDcpyttzC7bn9EIkXjDNGKURTllZy2Qf4FrYKHqRQADdUqpfCzxRpJH 3Ofg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=FQ7AVaBk; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a17090adb0700b00263ed3958bcsi219456pjv.127.2023.07.04.05.51.11; Tue, 04 Jul 2023 05:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=FQ7AVaBk; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbjGDMoC (ORCPT + 99 others); Tue, 4 Jul 2023 08:44:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbjGDMoB (ORCPT ); Tue, 4 Jul 2023 08:44:01 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 199BEFC; Tue, 4 Jul 2023 05:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=MTt8zrAicdNCIRJKdOYeAgLwlWREbjuubDrB9LDLoHk=; b=FQ7AVaBk1GiVkQjqboSqkOGPBq D5twh1rJ7Iuli9ASCg3UlAH0AvBtBUwBmFvGFlq65Bob5lYyyxVWcYsI1kpmfheq88Wy3j6xoPYkH Yr8SWDhirVenxTbYcufP9aI7qtE9tPtw2HdVYrOWl8KhXSL1///8tHp1coXORoa2/ua7NUKFkm8+i dZTW2mGKIGBkD8nw9XAEiECk0hIGw3K+rH1tSbKt2yF6JFa6PpHTgJc3LTGgE/JGwL7FWrIxLj7Op grzKnmKKjadKIKnXmQRg0cnlXA7KWmhAcv93Lftb6rhIWGVuVJI8IrHKh1M51oSxQqR7AKzuvj0MI qnUduz9Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qGfNn-0099Sz-9Z; Tue, 04 Jul 2023 12:43:51 +0000 Date: Tue, 4 Jul 2023 13:43:51 +0100 From: Matthew Wilcox To: Jan Kara Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jens Axboe , Christoph Hellwig , Alasdair Kergon , Andrew Morton , Anna Schumaker , Chao Yu , Christian Borntraeger , "Darrick J. Wong" , Dave Kleikamp , David Sterba , dm-devel@redhat.com, drbd-dev@lists.linbit.com, Gao Xiang , Jack Wang , Jaegeuk Kim , jfs-discussion@lists.sourceforge.net, Joern Engel , Joseph Qi , Kent Overstreet , linux-bcache@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org, linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-nvme@lists.infradead.org, linux-pm@vger.kernel.org, linux-raid@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-xfs@vger.kernel.org, "Md. Haris Iqbal" , Mike Snitzer , Minchan Kim , ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org, Sergey Senozhatsky , Song Liu , Sven Schnelle , target-devel@vger.kernel.org, Ted Tso , Trond Myklebust , xen-devel@lists.xenproject.org Subject: Re: [PATCH 01/32] block: Provide blkdev_get_handle_* functions Message-ID: References: <20230629165206.383-1-jack@suse.cz> <20230704122224.16257-1-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230704122224.16257-1-jack@suse.cz> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jul 04, 2023 at 02:21:28PM +0200, Jan Kara wrote: > +struct bdev_handle *blkdev_get_handle_by_dev(dev_t dev, blk_mode_t mode, > + void *holder, const struct blk_holder_ops *hops) > +{ > + struct bdev_handle *handle = kmalloc(sizeof(struct bdev_handle), > + GFP_KERNEL); > + struct block_device *bdev; > + > + if (!handle) > + return ERR_PTR(-ENOMEM); > + bdev = blkdev_get_by_dev(dev, mode, holder, hops); > + if (IS_ERR(bdev)) > + return ERR_CAST(bdev); Would we be better off with a handle->error (and a NULL return from this function means "we couldn't allocate a handle")? I have no objection to what you've done here, just wondering if it might end up nicer for the users.