Commit 0c002c2f74e10baa9021d3ecc50585c6eafea568

Authored by Andrew Patterson
Committed by Jens Axboe
1 parent 243294dae0

Wrapper for lower-level revalidate_disk routines.

This is a wrapper for the lower-level revalidate_disk call-backs such
as sd_revalidate_disk(). It allows us to perform pre and post
operations when calling them.

We will use this wrapper in a later patch to adjust block device sizes
after an online resize (a _post_ operation).

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 2 changed files with 22 additions and 0 deletions Side-by-side Diff

... ... @@ -852,6 +852,27 @@
852 852  
853 853 EXPORT_SYMBOL(open_by_devnum);
854 854  
  855 +/**
  856 + * revalidate_disk - wrapper for lower-level driver's revalidate_disk
  857 + * call-back
  858 + *
  859 + * @disk: struct gendisk to be revalidated
  860 + *
  861 + * This routine is a wrapper for lower-level driver's revalidate_disk
  862 + * call-backs. It is used to do common pre and post operations needed
  863 + * for all revalidate_disk operations.
  864 + */
  865 +int revalidate_disk(struct gendisk *disk)
  866 +{
  867 + int ret = 0;
  868 +
  869 + if (disk->fops->revalidate_disk)
  870 + ret = disk->fops->revalidate_disk(disk);
  871 +
  872 + return ret;
  873 +}
  874 +EXPORT_SYMBOL(revalidate_disk);
  875 +
855 876 /*
856 877 * This routine checks whether a removable media has been changed,
857 878 * and invalidates all buffer-cache-entries in that case. This
... ... @@ -1722,6 +1722,7 @@
1722 1722 */
1723 1723 #define bio_data_dir(bio) ((bio)->bi_rw & 1)
1724 1724  
  1725 +extern int revalidate_disk(struct gendisk *);
1725 1726 extern int check_disk_change(struct block_device *);
1726 1727 extern int __invalidate_device(struct block_device *);
1727 1728 extern int invalidate_partition(struct gendisk *, int);