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 X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 386FCC64E7B for ; Fri, 27 Nov 2020 15:24:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9DBA4221F1 for ; Fri, 27 Nov 2020 15:24:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DBA4221F1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DA8B66B006E; Fri, 27 Nov 2020 10:24:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D589D6B0070; Fri, 27 Nov 2020 10:24:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C20736B0071; Fri, 27 Nov 2020 10:24:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id ABFDE6B006E for ; Fri, 27 Nov 2020 10:24:11 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 69013180AD82F for ; Fri, 27 Nov 2020 15:24:11 +0000 (UTC) X-FDA: 77530569102.23.bells20_49007ba27389 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 49F5137608 for ; Fri, 27 Nov 2020 15:24:11 +0000 (UTC) X-HE-Tag: bells20_49007ba27389 X-Filterd-Recvd-Size: 2920 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Nov 2020 15:24:10 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 6661868B05; Fri, 27 Nov 2020 16:24:07 +0100 (CET) Date: Fri, 27 Nov 2020 16:24:07 +0100 From: Christoph Hellwig To: Jan Kara Cc: Christoph Hellwig , Jens Axboe , Tejun Heo , Josef Bacik , Coly Li , Mike Snitzer , Greg Kroah-Hartman , Johannes Thumshirn , dm-devel@redhat.com, Jan Kara , linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 41/44] block: switch disk_part_iter_* to use a struct block_device Message-ID: <20201127152407.GA7115@lst.de> References: <20201126130422.92945-1-hch@lst.de> <20201126130422.92945-42-hch@lst.de> <20201127125341.GD27162@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201127125341.GD27162@quack2.suse.cz> User-Agent: Mutt/1.5.17 (2007-11-01) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Nov 27, 2020 at 01:53:41PM +0100, Jan Kara wrote: > On Thu 26-11-20 14:04:19, Christoph Hellwig wrote: > > Switch the partition iter infrastructure to iterate over block_device > > references instead of hd_struct ones mostly used to get at the > > block_device. > > > > Signed-off-by: Christoph Hellwig > > The patch mostly looks good. Two comments below. > > > diff --git a/block/genhd.c b/block/genhd.c > > index 28299b24173be1..b58595f2ca33b1 100644 > > --- a/block/genhd.c > > +++ b/block/genhd.c > > @@ -233,7 +233,7 @@ EXPORT_SYMBOL_GPL(disk_part_iter_init); > > * CONTEXT: > > * Don't care. > > */ > > -struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter) > > +struct block_device *disk_part_iter_next(struct disk_part_iter *piter) > > { > > struct disk_part_tbl *ptbl; > > int inc, end; > > There's: > > /* put the last partition */ > disk_put_part(piter->part); > piter->part = NULL; > > at the beginning of disk_part_iter_next() which also needs switching to > bdput(), doesn't it? That is switched to call disk_part_iter_exit in patch 13. > > > @@ -271,8 +271,7 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter) > > piter->idx == 0)) > > continue; > > > > - get_device(part_to_dev(part->bd_part)); > > - piter->part = part->bd_part; > > + piter->part = bdgrab(part); > > bdgrab() could return NULL if we are racing with delete_partition() so I > think we need to take care of that. bdgrab never retuns NULL..