On Thu 09-02-23 19:19:48, Yu Kuai wrote: > 在 2023/02/09 17:57, Jan Kara 写道: > > On Thu 09-02-23 17:32:45, Yu Kuai wrote: > > > 在 2023/02/09 17:04, Jan Kara 写道: > > > I still prefer to open code blkdev_get_by_dev(), because many operations > > > is not necessary here. And this way, we can clear GD_NEED_PART_SCAN > > > inside open_mutex if rescan failed. > > > > I understand many operations are not needed there but this is not a hot > > path and leaking of bdev internal details into genhd.c is not a good > > practice either (e.g. you'd have to make blkdev_get_whole() extern). > > I was thinking that disk_scan_partitions() can be moved to bdev.c to > avoid that... > > > > We could create a special helper for partition rescan in block/bdev.c to > > hide the details but think that bd_start_claiming() - bd_abort_claiming() > > trick is the simplest solution to temporarily grab exclusive ownership if > > we don't have it. > > Now I'm good with this solution. By the way, do you think we must make > sure the first partition scan will be proceed? Sorry, I'm not sure what your are asking about here :) Can you please elaborate more? Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR