Re: [PATCH 36/44] block: allocate struct hd_struct as part of struct bdev_inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu 26-11-20 18:35:18, Jan Kara wrote:
> On Thu 26-11-20 14:04:14, Christoph Hellwig wrote:
> > Allocate hd_struct together with struct block_device to pre-load
> > the lifetime rule changes in preparation of merging the two structures.
> > 
> > Note that part0 was previously embedded into struct gendisk, but is
> > a separate allocation now, and already points to the block_device instead
> > of the hd_struct.  The lifetime of struct gendisk is still controlled by
> > the struct device embedded in the part0 hd_struct.
> > 
> > Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> 
> Just one comment below. With that fixed feel free to add:
> 
> Reviewed-by: Jan Kara <jack@xxxxxxx>
> 
> > diff --git a/block/partitions/core.c b/block/partitions/core.c
> > index f397ec9922bd6e..9c7e6730fa6098 100644
> > --- a/block/partitions/core.c
> > +++ b/block/partitions/core.c
> > @@ -265,9 +265,9 @@ static const struct attribute_group *part_attr_groups[] = {
> >  static void part_release(struct device *dev)
> >  {
> >  	struct hd_struct *p = dev_to_part(dev);
> > +
> >  	blk_free_devt(dev->devt);
> > -	hd_free_part(p);
> > -	kfree(p);
> > +	bdput(p->bdev);
> >  }
> 
> I don't think hd_struct holds a reference to block_device, does it?
> bdev_alloc() now just assigns bdev->bd_part->bdev = bdev...

Now I understood this is probably correct - each partition (including
gendisk as 0 partition) holds the initial bdev reference and only when
corresponding kobject is getting destroyed we stop holding onto that
reference. Right?

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux