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=unavailable 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 5C28DC64E7A for ; Thu, 26 Nov 2020 16:59:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35513221F8 for ; Thu, 26 Nov 2020 16:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403834AbgKZQ6w (ORCPT ); Thu, 26 Nov 2020 11:58:52 -0500 Received: from mx2.suse.de ([195.135.220.15]:33458 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391226AbgKZQ6w (ORCPT ); Thu, 26 Nov 2020 11:58:52 -0500 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 28304ACE0; Thu, 26 Nov 2020 16:58:50 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E46921E10D0; Thu, 26 Nov 2020 17:58:49 +0100 (CET) Date: Thu, 26 Nov 2020 17:58:49 +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 32/44] block: move the partition_meta_info to struct block_device Message-ID: <20201126165849.GR422@quack2.suse.cz> References: <20201126130422.92945-1-hch@lst.de> <20201126130422.92945-33-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126130422.92945-33-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Thu 26-11-20 14:04:10, Christoph Hellwig wrote: > Move the partition_meta_info to struct block_device in preparation for > killing struct hd_struct. > > Signed-off-by: Christoph Hellwig Looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > block/blk.h | 1 - > block/genhd.c | 3 ++- > block/partitions/core.c | 18 +++++++----------- > fs/block_dev.c | 1 + > include/linux/blk_types.h | 2 ++ > include/linux/genhd.h | 1 - > init/do_mounts.c | 7 ++++--- > 7 files changed, 16 insertions(+), 17 deletions(-) > > diff --git a/block/blk.h b/block/blk.h > index 3f801f6e86f8a1..0bd4b58bcbaf77 100644 > --- a/block/blk.h > +++ b/block/blk.h > @@ -381,7 +381,6 @@ static inline void hd_struct_put(struct hd_struct *part) > > static inline void hd_free_part(struct hd_struct *part) > { > - kfree(part->info); > bdput(part->bdev); > percpu_ref_exit(&part->ref); > } > diff --git a/block/genhd.c b/block/genhd.c > index 7bb45382658385..fe202a12eec096 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -1002,7 +1002,8 @@ void __init printk_all_partitions(void) > bdevt_str(part_devt(part), devt_buf), > bdev_nr_sectors(part->bdev) >> 1, > disk_name(disk, part->partno, name_buf), > - part->info ? part->info->uuid : ""); > + part->bdev->bd_meta_info ? > + part->bdev->bd_meta_info->uuid : ""); > if (is_part0) { > if (dev->parent && dev->parent->driver) > printk(" driver: %s\n", > diff --git a/block/partitions/core.c b/block/partitions/core.c > index 485777cea26bfa..224a22d82fb86f 100644 > --- a/block/partitions/core.c > +++ b/block/partitions/core.c > @@ -275,8 +275,9 @@ static int part_uevent(struct device *dev, struct kobj_uevent_env *env) > struct hd_struct *part = dev_to_part(dev); > > add_uevent_var(env, "PARTN=%u", part->partno); > - if (part->info && part->info->volname[0]) > - add_uevent_var(env, "PARTNAME=%s", part->info->volname); > + if (part->bdev->bd_meta_info && part->bdev->bd_meta_info->volname[0]) > + add_uevent_var(env, "PARTNAME=%s", > + part->bdev->bd_meta_info->volname); > return 0; > } > > @@ -422,13 +423,10 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > p->policy = get_disk_ro(disk); > > if (info) { > - struct partition_meta_info *pinfo; > - > - pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id); > - if (!pinfo) > + err = -ENOMEM; > + bdev->bd_meta_info = kmemdup(info, sizeof(*info), GFP_KERNEL); > + if (!bdev->bd_meta_info) > goto out_bdput; > - memcpy(pinfo, info, sizeof(*info)); > - p->info = pinfo; > } > > dname = dev_name(ddev); > @@ -444,7 +442,7 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > > err = blk_alloc_devt(p, &devt); > if (err) > - goto out_free_info; > + goto out_bdput; > pdev->devt = devt; > > /* delay uevent until 'holders' subdir is created */ > @@ -481,8 +479,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > kobject_uevent(&pdev->kobj, KOBJ_ADD); > return p; > > -out_free_info: > - kfree(p->info); > out_bdput: > bdput(bdev); > out_free: > diff --git a/fs/block_dev.c b/fs/block_dev.c > index 11e6a9a255845d..62fae6a0e8aa56 100644 > --- a/fs/block_dev.c > +++ b/fs/block_dev.c > @@ -785,6 +785,7 @@ static void bdev_free_inode(struct inode *inode) > struct block_device *bdev = I_BDEV(inode); > > free_percpu(bdev->bd_stats); > + kfree(bdev->bd_meta_info); > > kmem_cache_free(bdev_cachep, BDEV_I(inode)); > } > diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h > index a690008f60cd92..2f8ede04e5a94c 100644 > --- a/include/linux/blk_types.h > +++ b/include/linux/blk_types.h > @@ -49,6 +49,8 @@ struct block_device { > /* Mutex for freeze */ > struct mutex bd_fsfreeze_mutex; > struct super_block *bd_fsfreeze_sb; > + > + struct partition_meta_info *bd_meta_info; > } __randomize_layout; > > #define bdev_whole(_bdev) \ > diff --git a/include/linux/genhd.h b/include/linux/genhd.h > index 50d27f5d38e2af..30d7076155b4d2 100644 > --- a/include/linux/genhd.h > +++ b/include/linux/genhd.h > @@ -57,7 +57,6 @@ struct hd_struct { > struct device __dev; > struct kobject *holder_dir; > int policy, partno; > - struct partition_meta_info *info; > #ifdef CONFIG_FAIL_MAKE_REQUEST > int make_it_fail; > #endif > diff --git a/init/do_mounts.c b/init/do_mounts.c > index 5879edf083b318..368ccb71850126 100644 > --- a/init/do_mounts.c > +++ b/init/do_mounts.c > @@ -79,8 +79,8 @@ static int match_dev_by_uuid(struct device *dev, const void *data) > const struct uuidcmp *cmp = data; > struct hd_struct *part = dev_to_part(dev); > > - if (!part->info || > - strncasecmp(cmp->uuid, part->info->uuid, cmp->len)) > + if (!part->bdev->bd_meta_info || > + strncasecmp(cmp->uuid, part->bdev->bd_meta_info->uuid, cmp->len)) > return 0; > return 1; > } > @@ -169,7 +169,8 @@ static int match_dev_by_label(struct device *dev, const void *data) > const char *label = data; > struct hd_struct *part = dev_to_part(dev); > > - if (!part->info || strcmp(label, part->info->volname)) > + if (!part->bdev->bd_meta_info || > + strcmp(label, part->bdev->bd_meta_info->volname)) > return 0; > return 1; > } > -- > 2.29.2 > -- Jan Kara SUSE Labs, CR 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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 63B9BC56202 for ; Thu, 26 Nov 2020 16:59:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 10EE3221EB for ; Thu, 26 Nov 2020 16:59:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2IsxhpPr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10EE3221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Q8xKbGqOjgNlR3yq2lrj4aJJipxdrwFV+dCUvCSnt58=; b=2IsxhpPra45I6nxxB0d3WYrJr u5WUVh48GKFrjEz0mtaoqLZdgb8RS8n734hD9oQid9IrqSVZY4P0pUQbEpiawcLHxEndBV4TvHVfi ePBtN8bXDmVprL2c6UiXgg17Oh3fmYOf+WB+CukCMiMreehk636EiITgluhvrhGQi+2BO0at09b3W 32poR5wlkx9Ca/fv2zJfibO89BG8S2jaw+DYRIhuYbQPDTJTxlQarUJammV0o6oZ/uj8vjyB4jig0 COs31q6569aIQyhAUC0M+4JH9TxYppeSDJLVKl7UM6/pj/7MWOZ6qcZLO8Nqj7C1CMIqx3J0DTYpn WMsNocbng==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiKbf-0004Je-AW; Thu, 26 Nov 2020 16:58:55 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiKbb-0004IQ-7w for linux-mtd@lists.infradead.org; Thu, 26 Nov 2020 16:58:52 +0000 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 28304ACE0; Thu, 26 Nov 2020 16:58:50 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E46921E10D0; Thu, 26 Nov 2020 17:58:49 +0100 (CET) Date: Thu, 26 Nov 2020 17:58:49 +0100 From: Jan Kara To: Christoph Hellwig Subject: Re: [PATCH 32/44] block: move the partition_meta_info to struct block_device Message-ID: <20201126165849.GR422@quack2.suse.cz> References: <20201126130422.92945-1-hch@lst.de> <20201126130422.92945-33-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201126130422.92945-33-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201126_115851_555912_877D6E1B X-CRM114-Status: GOOD ( 26.05 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jens Axboe , Jan Kara , Mike Snitzer , linux-mm@kvack.org, Greg Kroah-Hartman , Jan Kara , Josef Bacik , Coly Li , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, linux-mtd@lists.infradead.org, Johannes Thumshirn , Tejun Heo , linux-bcache@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Thu 26-11-20 14:04:10, Christoph Hellwig wrote: > Move the partition_meta_info to struct block_device in preparation for > killing struct hd_struct. > > Signed-off-by: Christoph Hellwig Looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > block/blk.h | 1 - > block/genhd.c | 3 ++- > block/partitions/core.c | 18 +++++++----------- > fs/block_dev.c | 1 + > include/linux/blk_types.h | 2 ++ > include/linux/genhd.h | 1 - > init/do_mounts.c | 7 ++++--- > 7 files changed, 16 insertions(+), 17 deletions(-) > > diff --git a/block/blk.h b/block/blk.h > index 3f801f6e86f8a1..0bd4b58bcbaf77 100644 > --- a/block/blk.h > +++ b/block/blk.h > @@ -381,7 +381,6 @@ static inline void hd_struct_put(struct hd_struct *part) > > static inline void hd_free_part(struct hd_struct *part) > { > - kfree(part->info); > bdput(part->bdev); > percpu_ref_exit(&part->ref); > } > diff --git a/block/genhd.c b/block/genhd.c > index 7bb45382658385..fe202a12eec096 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -1002,7 +1002,8 @@ void __init printk_all_partitions(void) > bdevt_str(part_devt(part), devt_buf), > bdev_nr_sectors(part->bdev) >> 1, > disk_name(disk, part->partno, name_buf), > - part->info ? part->info->uuid : ""); > + part->bdev->bd_meta_info ? > + part->bdev->bd_meta_info->uuid : ""); > if (is_part0) { > if (dev->parent && dev->parent->driver) > printk(" driver: %s\n", > diff --git a/block/partitions/core.c b/block/partitions/core.c > index 485777cea26bfa..224a22d82fb86f 100644 > --- a/block/partitions/core.c > +++ b/block/partitions/core.c > @@ -275,8 +275,9 @@ static int part_uevent(struct device *dev, struct kobj_uevent_env *env) > struct hd_struct *part = dev_to_part(dev); > > add_uevent_var(env, "PARTN=%u", part->partno); > - if (part->info && part->info->volname[0]) > - add_uevent_var(env, "PARTNAME=%s", part->info->volname); > + if (part->bdev->bd_meta_info && part->bdev->bd_meta_info->volname[0]) > + add_uevent_var(env, "PARTNAME=%s", > + part->bdev->bd_meta_info->volname); > return 0; > } > > @@ -422,13 +423,10 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > p->policy = get_disk_ro(disk); > > if (info) { > - struct partition_meta_info *pinfo; > - > - pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id); > - if (!pinfo) > + err = -ENOMEM; > + bdev->bd_meta_info = kmemdup(info, sizeof(*info), GFP_KERNEL); > + if (!bdev->bd_meta_info) > goto out_bdput; > - memcpy(pinfo, info, sizeof(*info)); > - p->info = pinfo; > } > > dname = dev_name(ddev); > @@ -444,7 +442,7 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > > err = blk_alloc_devt(p, &devt); > if (err) > - goto out_free_info; > + goto out_bdput; > pdev->devt = devt; > > /* delay uevent until 'holders' subdir is created */ > @@ -481,8 +479,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > kobject_uevent(&pdev->kobj, KOBJ_ADD); > return p; > > -out_free_info: > - kfree(p->info); > out_bdput: > bdput(bdev); > out_free: > diff --git a/fs/block_dev.c b/fs/block_dev.c > index 11e6a9a255845d..62fae6a0e8aa56 100644 > --- a/fs/block_dev.c > +++ b/fs/block_dev.c > @@ -785,6 +785,7 @@ static void bdev_free_inode(struct inode *inode) > struct block_device *bdev = I_BDEV(inode); > > free_percpu(bdev->bd_stats); > + kfree(bdev->bd_meta_info); > > kmem_cache_free(bdev_cachep, BDEV_I(inode)); > } > diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h > index a690008f60cd92..2f8ede04e5a94c 100644 > --- a/include/linux/blk_types.h > +++ b/include/linux/blk_types.h > @@ -49,6 +49,8 @@ struct block_device { > /* Mutex for freeze */ > struct mutex bd_fsfreeze_mutex; > struct super_block *bd_fsfreeze_sb; > + > + struct partition_meta_info *bd_meta_info; > } __randomize_layout; > > #define bdev_whole(_bdev) \ > diff --git a/include/linux/genhd.h b/include/linux/genhd.h > index 50d27f5d38e2af..30d7076155b4d2 100644 > --- a/include/linux/genhd.h > +++ b/include/linux/genhd.h > @@ -57,7 +57,6 @@ struct hd_struct { > struct device __dev; > struct kobject *holder_dir; > int policy, partno; > - struct partition_meta_info *info; > #ifdef CONFIG_FAIL_MAKE_REQUEST > int make_it_fail; > #endif > diff --git a/init/do_mounts.c b/init/do_mounts.c > index 5879edf083b318..368ccb71850126 100644 > --- a/init/do_mounts.c > +++ b/init/do_mounts.c > @@ -79,8 +79,8 @@ static int match_dev_by_uuid(struct device *dev, const void *data) > const struct uuidcmp *cmp = data; > struct hd_struct *part = dev_to_part(dev); > > - if (!part->info || > - strncasecmp(cmp->uuid, part->info->uuid, cmp->len)) > + if (!part->bdev->bd_meta_info || > + strncasecmp(cmp->uuid, part->bdev->bd_meta_info->uuid, cmp->len)) > return 0; > return 1; > } > @@ -169,7 +169,8 @@ static int match_dev_by_label(struct device *dev, const void *data) > const char *label = data; > struct hd_struct *part = dev_to_part(dev); > > - if (!part->info || strcmp(label, part->info->volname)) > + if (!part->bdev->bd_meta_info || > + strcmp(label, part->bdev->bd_meta_info->volname)) > return 0; > return 1; > } > -- > 2.29.2 > -- Jan Kara SUSE Labs, CR ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ 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=unavailable 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 0B951C63697 for ; Thu, 26 Nov 2020 16:59:08 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 83A2D221EB for ; Thu, 26 Nov 2020 16:59:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83A2D221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-283-sdYoGYx8MaCx1DcgLAAMXA-1; Thu, 26 Nov 2020 11:59:04 -0500 X-MC-Unique: sdYoGYx8MaCx1DcgLAAMXA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2FDD8042AA; Thu, 26 Nov 2020 16:58:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7DB2860855; Thu, 26 Nov 2020 16:58:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 266EE180954D; Thu, 26 Nov 2020 16:58:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AQGwu4H027628 for ; Thu, 26 Nov 2020 11:58:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 97A3ACF62E; Thu, 26 Nov 2020 16:58:56 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 92172B6B39 for ; Thu, 26 Nov 2020 16:58:54 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35F40858284 for ; Thu, 26 Nov 2020 16:58:54 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-149-KmJlBqCFPdiNkof2lu2MWg-1; Thu, 26 Nov 2020 11:58:51 -0500 X-MC-Unique: KmJlBqCFPdiNkof2lu2MWg-1 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 28304ACE0; Thu, 26 Nov 2020 16:58:50 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E46921E10D0; Thu, 26 Nov 2020 17:58:49 +0100 (CET) Date: Thu, 26 Nov 2020 17:58:49 +0100 From: Jan Kara To: Christoph Hellwig Message-ID: <20201126165849.GR422@quack2.suse.cz> References: <20201126130422.92945-1-hch@lst.de> <20201126130422.92945-33-hch@lst.de> MIME-Version: 1.0 In-Reply-To: <20201126130422.92945-33-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: dm-devel@redhat.com Cc: Jens Axboe , Jan Kara , Mike Snitzer , linux-mm@kvack.org, Greg Kroah-Hartman , Jan Kara , Josef Bacik , Coly Li , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, linux-mtd@lists.infradead.org, Johannes Thumshirn , Tejun Heo , linux-bcache@vger.kernel.org Subject: Re: [dm-devel] [PATCH 32/44] block: move the partition_meta_info to struct block_device X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Thu 26-11-20 14:04:10, Christoph Hellwig wrote: > Move the partition_meta_info to struct block_device in preparation for > killing struct hd_struct. > > Signed-off-by: Christoph Hellwig Looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > block/blk.h | 1 - > block/genhd.c | 3 ++- > block/partitions/core.c | 18 +++++++----------- > fs/block_dev.c | 1 + > include/linux/blk_types.h | 2 ++ > include/linux/genhd.h | 1 - > init/do_mounts.c | 7 ++++--- > 7 files changed, 16 insertions(+), 17 deletions(-) > > diff --git a/block/blk.h b/block/blk.h > index 3f801f6e86f8a1..0bd4b58bcbaf77 100644 > --- a/block/blk.h > +++ b/block/blk.h > @@ -381,7 +381,6 @@ static inline void hd_struct_put(struct hd_struct *part) > > static inline void hd_free_part(struct hd_struct *part) > { > - kfree(part->info); > bdput(part->bdev); > percpu_ref_exit(&part->ref); > } > diff --git a/block/genhd.c b/block/genhd.c > index 7bb45382658385..fe202a12eec096 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -1002,7 +1002,8 @@ void __init printk_all_partitions(void) > bdevt_str(part_devt(part), devt_buf), > bdev_nr_sectors(part->bdev) >> 1, > disk_name(disk, part->partno, name_buf), > - part->info ? part->info->uuid : ""); > + part->bdev->bd_meta_info ? > + part->bdev->bd_meta_info->uuid : ""); > if (is_part0) { > if (dev->parent && dev->parent->driver) > printk(" driver: %s\n", > diff --git a/block/partitions/core.c b/block/partitions/core.c > index 485777cea26bfa..224a22d82fb86f 100644 > --- a/block/partitions/core.c > +++ b/block/partitions/core.c > @@ -275,8 +275,9 @@ static int part_uevent(struct device *dev, struct kobj_uevent_env *env) > struct hd_struct *part = dev_to_part(dev); > > add_uevent_var(env, "PARTN=%u", part->partno); > - if (part->info && part->info->volname[0]) > - add_uevent_var(env, "PARTNAME=%s", part->info->volname); > + if (part->bdev->bd_meta_info && part->bdev->bd_meta_info->volname[0]) > + add_uevent_var(env, "PARTNAME=%s", > + part->bdev->bd_meta_info->volname); > return 0; > } > > @@ -422,13 +423,10 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > p->policy = get_disk_ro(disk); > > if (info) { > - struct partition_meta_info *pinfo; > - > - pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id); > - if (!pinfo) > + err = -ENOMEM; > + bdev->bd_meta_info = kmemdup(info, sizeof(*info), GFP_KERNEL); > + if (!bdev->bd_meta_info) > goto out_bdput; > - memcpy(pinfo, info, sizeof(*info)); > - p->info = pinfo; > } > > dname = dev_name(ddev); > @@ -444,7 +442,7 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > > err = blk_alloc_devt(p, &devt); > if (err) > - goto out_free_info; > + goto out_bdput; > pdev->devt = devt; > > /* delay uevent until 'holders' subdir is created */ > @@ -481,8 +479,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, > kobject_uevent(&pdev->kobj, KOBJ_ADD); > return p; > > -out_free_info: > - kfree(p->info); > out_bdput: > bdput(bdev); > out_free: > diff --git a/fs/block_dev.c b/fs/block_dev.c > index 11e6a9a255845d..62fae6a0e8aa56 100644 > --- a/fs/block_dev.c > +++ b/fs/block_dev.c > @@ -785,6 +785,7 @@ static void bdev_free_inode(struct inode *inode) > struct block_device *bdev = I_BDEV(inode); > > free_percpu(bdev->bd_stats); > + kfree(bdev->bd_meta_info); > > kmem_cache_free(bdev_cachep, BDEV_I(inode)); > } > diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h > index a690008f60cd92..2f8ede04e5a94c 100644 > --- a/include/linux/blk_types.h > +++ b/include/linux/blk_types.h > @@ -49,6 +49,8 @@ struct block_device { > /* Mutex for freeze */ > struct mutex bd_fsfreeze_mutex; > struct super_block *bd_fsfreeze_sb; > + > + struct partition_meta_info *bd_meta_info; > } __randomize_layout; > > #define bdev_whole(_bdev) \ > diff --git a/include/linux/genhd.h b/include/linux/genhd.h > index 50d27f5d38e2af..30d7076155b4d2 100644 > --- a/include/linux/genhd.h > +++ b/include/linux/genhd.h > @@ -57,7 +57,6 @@ struct hd_struct { > struct device __dev; > struct kobject *holder_dir; > int policy, partno; > - struct partition_meta_info *info; > #ifdef CONFIG_FAIL_MAKE_REQUEST > int make_it_fail; > #endif > diff --git a/init/do_mounts.c b/init/do_mounts.c > index 5879edf083b318..368ccb71850126 100644 > --- a/init/do_mounts.c > +++ b/init/do_mounts.c > @@ -79,8 +79,8 @@ static int match_dev_by_uuid(struct device *dev, const void *data) > const struct uuidcmp *cmp = data; > struct hd_struct *part = dev_to_part(dev); > > - if (!part->info || > - strncasecmp(cmp->uuid, part->info->uuid, cmp->len)) > + if (!part->bdev->bd_meta_info || > + strncasecmp(cmp->uuid, part->bdev->bd_meta_info->uuid, cmp->len)) > return 0; > return 1; > } > @@ -169,7 +169,8 @@ static int match_dev_by_label(struct device *dev, const void *data) > const char *label = data; > struct hd_struct *part = dev_to_part(dev); > > - if (!part->info || strcmp(label, part->info->volname)) > + if (!part->bdev->bd_meta_info || > + strcmp(label, part->bdev->bd_meta_info->volname)) > return 0; > return 1; > } > -- > 2.29.2 > -- Jan Kara SUSE Labs, CR -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel