On 21/10/2019 11:27, Guoqing Jiang wrote: >>>> static void bdev_disk_changed(struct block_device *bdev, bool >>>> invalidate) >>>> { >>>> - if (invalidate) >>>> - invalidate_partitions(bdev->bd_disk, bdev); >>>> - else >>>> - rescan_partitions(bdev->bd_disk, bdev); >>>> + if (disk_part_scan_enabled(bdev->bd_disk)) { >>>> + if (invalidate) >>>> + invalidate_partitions(bdev->bd_disk, bdev); >>>> + else >>>> + rescan_partitions(bdev->bd_disk, bdev); >>> Maybe use the new common helper to replace above. >> What do you mean exactly? Because there's only this place that has the >> code >> pattern here... > > The above looks same as the new function. The above is changed in the new bdev_disk_changed() function. Patch 1/2 factors out the pattern and this patch changes the behaviour -- Johannes Thumshirn SUSE Labs Filesystems jthumshirn@xxxxxxx +49 911 74053 689 SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 Nürnberg Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850