Message ID | 20190515065740.12397-1-jack@suse.cz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: Don't revalidate bdev of hidden gendisk | expand |
On 5/15/19 8:57 AM, Jan Kara wrote: > When hidden gendisk is revalidated, there's no point in revalidating > associated block device as there's none. We would thus just create new > bdev inode, report "detected capacity change from 0 to XXX" message and > evict the bdev inode again. Avoid this pointless dance and confusing > message in the kernel log. > > Signed-off-by: Jan Kara <jack@suse.cz> > --- > fs/block_dev.c | 25 ++++++++++++++++--------- > 1 file changed, 16 insertions(+), 9 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes
On Wed, May 15, 2019 at 08:57:40AM +0200, Jan Kara wrote: > When hidden gendisk is revalidated, there's no point in revalidating > associated block device as there's none. We would thus just create new > bdev inode, report "detected capacity change from 0 to XXX" message and > evict the bdev inode again. Avoid this pointless dance and confusing > message in the kernel log. Personally I'd do an early return instead of the indent, but functionally this looks fine: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Wed 15-05-19 08:57:40, Jan Kara wrote: > When hidden gendisk is revalidated, there's no point in revalidating > associated block device as there's none. We would thus just create new > bdev inode, report "detected capacity change from 0 to XXX" message and > evict the bdev inode again. Avoid this pointless dance and confusing > message in the kernel log. > > Signed-off-by: Jan Kara <jack@suse.cz> Jens, ping? Honza > --- > fs/block_dev.c | 25 ++++++++++++++++--------- > 1 file changed, 16 insertions(+), 9 deletions(-) > > diff --git a/fs/block_dev.c b/fs/block_dev.c > index 0f7552a87d54..9e671bbf7362 100644 > --- a/fs/block_dev.c > +++ b/fs/block_dev.c > @@ -1405,20 +1405,27 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev, > */ > int revalidate_disk(struct gendisk *disk) > { > - struct block_device *bdev; > int ret = 0; > > if (disk->fops->revalidate_disk) > ret = disk->fops->revalidate_disk(disk); > - bdev = bdget_disk(disk, 0); > - if (!bdev) > - return ret; > > - mutex_lock(&bdev->bd_mutex); > - check_disk_size_change(disk, bdev, ret == 0); > - bdev->bd_invalidated = 0; > - mutex_unlock(&bdev->bd_mutex); > - bdput(bdev); > + /* > + * Hidden disks don't have associated bdev so there's no point in > + * revalidating it. > + */ > + if (!(disk->flags & GENHD_FL_HIDDEN)) { > + struct block_device *bdev = bdget_disk(disk, 0); > + > + if (!bdev) > + return ret; > + > + mutex_lock(&bdev->bd_mutex); > + check_disk_size_change(disk, bdev, ret == 0); > + bdev->bd_invalidated = 0; > + mutex_unlock(&bdev->bd_mutex); > + bdput(bdev); > + } > return ret; > } > EXPORT_SYMBOL(revalidate_disk); > -- > 2.16.4 >
On 5/15/19 12:57 AM, Jan Kara wrote: > When hidden gendisk is revalidated, there's no point in revalidating > associated block device as there's none. We would thus just create new > bdev inode, report "detected capacity change from 0 to XXX" message and > evict the bdev inode again. Avoid this pointless dance and confusing > message in the kernel log. Applied, thanks.
diff --git a/fs/block_dev.c b/fs/block_dev.c index 0f7552a87d54..9e671bbf7362 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1405,20 +1405,27 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev, */ int revalidate_disk(struct gendisk *disk) { - struct block_device *bdev; int ret = 0; if (disk->fops->revalidate_disk) ret = disk->fops->revalidate_disk(disk); - bdev = bdget_disk(disk, 0); - if (!bdev) - return ret; - mutex_lock(&bdev->bd_mutex); - check_disk_size_change(disk, bdev, ret == 0); - bdev->bd_invalidated = 0; - mutex_unlock(&bdev->bd_mutex); - bdput(bdev); + /* + * Hidden disks don't have associated bdev so there's no point in + * revalidating it. + */ + if (!(disk->flags & GENHD_FL_HIDDEN)) { + struct block_device *bdev = bdget_disk(disk, 0); + + if (!bdev) + return ret; + + mutex_lock(&bdev->bd_mutex); + check_disk_size_change(disk, bdev, ret == 0); + bdev->bd_invalidated = 0; + mutex_unlock(&bdev->bd_mutex); + bdput(bdev); + } return ret; } EXPORT_SYMBOL(revalidate_disk);
When hidden gendisk is revalidated, there's no point in revalidating associated block device as there's none. We would thus just create new bdev inode, report "detected capacity change from 0 to XXX" message and evict the bdev inode again. Avoid this pointless dance and confusing message in the kernel log. Signed-off-by: Jan Kara <jack@suse.cz> --- fs/block_dev.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)