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 1FA2CC2D0E4 for ; Fri, 27 Nov 2020 12:53:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5586E22243 for ; Fri, 27 Nov 2020 12:53:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5586E22243 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A6F4A6B006C; Fri, 27 Nov 2020 07:53:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A44D16B0071; Fri, 27 Nov 2020 07:53:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 982C76B0072; Fri, 27 Nov 2020 07:53:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0217.hostedemail.com [216.40.44.217]) by kanga.kvack.org (Postfix) with ESMTP id 8395C6B006C for ; Fri, 27 Nov 2020 07:53:44 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 36BED180AD81F for ; Fri, 27 Nov 2020 12:53:44 +0000 (UTC) X-FDA: 77530189968.27.spark28_430b50727388 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 0432C3D663 for ; Fri, 27 Nov 2020 12:53:43 +0000 (UTC) X-HE-Tag: spark28_430b50727388 X-Filterd-Recvd-Size: 2911 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Nov 2020 12:53:43 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3E46AABD7; Fri, 27 Nov 2020 12:53:42 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 8B3201E1318; Fri, 27 Nov 2020 13:53:41 +0100 (CET) Date: Fri, 27 Nov 2020 13:53:41 +0100 From: Jan Kara To: Christoph Hellwig Cc: Jens Axboe , Tejun Heo , Josef Bacik , Coly Li , Mike Snitzer , Greg Kroah-Hartman , Jan Kara , 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: <20201127125341.GD27162@quack2.suse.cz> References: <20201126130422.92945-1-hch@lst.de> <20201126130422.92945-42-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126130422.92945-42-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) 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 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? > @@ -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. Honza -- Jan Kara SUSE Labs, CR