Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27651687rwd; Tue, 4 Jul 2023 06:06:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zIYj/QDskOUvL9HysCibZVzGEudJgUjtugGxk5rx5QzIQLhDNmIlzs+saQ6mtNmmOzdpd X-Received: by 2002:a05:6a20:3b99:b0:128:f513:55ed with SMTP id b25-20020a056a203b9900b00128f51355edmr10247815pzh.54.1688475965052; Tue, 04 Jul 2023 06:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688475965; cv=none; d=google.com; s=arc-20160816; b=WsUfPtTfEtGEhFFeTWaY0+JZc9cHV8UpMjtEPFDo+ImFDpWF/iEo8GZGxi7JzwVhpp j7K/sHEf514u2S2dgW4ExxtmUwlP4zHRwvUdF7HXLBjSLAnj0jua0+/Bri4TR3uy9YAL bQfolwuhNPqjNMiMBgqmVwLiw+KlKsr55odl4KXTjcKl7XqDtQ2R/r+KjC9WPnRV7B7S 6L90m1+rOzEaW9sOQLHgqMNGka7IdwcO+VK/HlHIgSo6XYvzCbsJtyQYazTcAM0yVypd dxUo/6xobQRnkkwdtafy1GI7OM/G/yMU0NiK9Ao0xdlJ24cqX9FV9o/kurfnfl/Pv3ud 96ZA== 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 :dkim-signature; bh=rY6MxLY5e9SVa1+4BCCd7ntNwV9Px5uEGT5nvi2Xw9M=; fh=tnV5MaDbY2PEhY3GRwV+04+V5q35I1IAFgO2JKgRuX4=; b=lT4nvYUKmOIy6ce6OJ+qpCZfXVT95kiKRyXrAjDXzjKfxwa1wtlpUh53t5byZ1XAxt H73oW1oQXPCyejyiKI+NssCVCsWOdxJDfdkZoecgjzcqij+ecqOoFTr3ojqcC5Bckek4 NR69tQGDq7+4cnrruXMwGxHnTZ1hpt/6OYVedX2m7H8RZ/JTnEMNuW+ZxO1uMA0G1JF0 JQsCFPtOys438CdOPL7A7fT/DhIYFSYw3RJ6orUuB4N9gS4Z+jfKzxPUYu0kzbQ3/4UH ndPrB3QzKGegsCoWBu2Wgz+QUL8VlnlvnH8sIgFJgoMV5Z3dsaJ70aW1lyEtO2PPQnGw aJLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ejRwbAIw; dkim=neutral (no key) header.i=@suse.cz header.b=T7VmytPR; 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 s17-20020a170902ea1100b001b8a5d9806bsi1426882plg.21.2023.07.04.06.05.39; Tue, 04 Jul 2023 06:06:05 -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=@suse.cz header.s=susede2_rsa header.b=ejRwbAIw; dkim=neutral (no key) header.i=@suse.cz header.b=T7VmytPR; 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 S230137AbjGDNEh (ORCPT + 99 others); Tue, 4 Jul 2023 09:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231497AbjGDNEf (ORCPT ); Tue, 4 Jul 2023 09:04:35 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C1C810C1; Tue, 4 Jul 2023 06:04:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F0F5F20573; Tue, 4 Jul 2023 13:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1688475837; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rY6MxLY5e9SVa1+4BCCd7ntNwV9Px5uEGT5nvi2Xw9M=; b=ejRwbAIwZQbMrOxksN9aG/ZDDESpKoHA5R/d85WHYyhF32Si43PFRfl6mcCR9WYB3Qv5Xb bFzVFYQ3692eypLdUzJN5qIXY9S2kweTJplS9sF53SAyJ7HvtNyhlweUs2wFtrS+zKSTOj TegqbmWrWk4Vs0DZGSAEKRmheCwdTpE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1688475837; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rY6MxLY5e9SVa1+4BCCd7ntNwV9Px5uEGT5nvi2Xw9M=; b=T7VmytPRSDJUviPwV6lejrGCKn7KjlWBXNR5Weqcyul/51HqsbD9tiSRFlJo/bbQX+dGnV 08LOGAmrpvM1ddAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DC3001346D; Tue, 4 Jul 2023 13:03:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kueeNbwYpGTARwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 13:03:56 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 6B4A7A0722; Tue, 4 Jul 2023 15:03:56 +0200 (CEST) Date: Tue, 4 Jul 2023 15:03:56 +0200 From: Jan Kara To: Matthew Wilcox Cc: Jan Kara , 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: <20230704130356.xwdlxvgvi4l6sruc@quack3> 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: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL,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 04-07-23 13:43:51, Matthew Wilcox wrote: > 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. Hum, I've checked a couple of users and it seems it would be more complicated for the users to handle this convention than the one I've chosen. And that one is also pretty standard so I think by the principle of least surprise it is also better. Honza > -- Jan Kara SUSE Labs, CR