diff mbox

[v2,9/9] block: kill disk_{check|set|clear|alloc}_badblocks

Message ID 20160106223139.2736.22899.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Williams Jan. 6, 2016, 10:31 p.m. UTC
These actions are completely managed by a block driver or can use the
badblocks api directly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 block/genhd.c         |   42 ------------------------------------------
 include/linux/genhd.h |    5 -----
 2 files changed, 47 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Vishal Verma Jan. 8, 2016, 10:03 p.m. UTC | #1
On Wed, 2016-01-06 at 14:31 -0800, Dan Williams wrote:
> These actions are completely managed by a block driver or can use the
> badblocks api directly.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  block/genhd.c         |   42 -------------------------------------
> -----
>  include/linux/genhd.h |    5 -----
>  2 files changed, 47 deletions(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index b96012849e26..eae2971a6d91 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -506,16 +506,6 @@ static int exact_lock(dev_t devt, void *data)
>  	return 0;
>  }
>  
> -int disk_alloc_badblocks(struct gendisk *disk)
> -{
> -	disk->bb = kzalloc(sizeof(*(disk->bb)), GFP_KERNEL);
> -	if (!disk->bb)
> -		return -ENOMEM;

In using the badblocks api directly, we lose all of these !disk->bb
checks. I'll send out an incremental patch adding these checks
directly into the badblocks api.

> -
> -	return badblocks_init(disk->bb, 1);
> -}
> -EXPORT_SYMBOL(disk_alloc_badblocks);
> -
>  static void register_disk(struct gendisk *disk)
>  {
>  	struct device *ddev = disk_to_dev(disk);
> @@ -695,38 +685,6 @@ void del_gendisk(struct gendisk *disk)
>  }
>  EXPORT_SYMBOL(del_gendisk);
>  
> -/*
> - * The gendisk usage of badblocks does not track acknowledgements
> for
> - * badblocks. We always assume they are acknowledged.
> - */
> -int disk_check_badblocks(struct gendisk *disk, sector_t s, int
> sectors,
> -		   sector_t *first_bad, int *bad_sectors)
> -{
> -	if (!disk->bb)
> -		return 0;
> -
> -	return badblocks_check(disk->bb, s, sectors, first_bad,
> bad_sectors);
> -}
> -EXPORT_SYMBOL(disk_check_badblocks);
> -
> -int disk_set_badblocks(struct gendisk *disk, sector_t s, int
> sectors)
> -{
> -	if (!disk->bb)
> -		return 0;
> -
> -	return badblocks_set(disk->bb, s, sectors, 1);
> -}
> -EXPORT_SYMBOL(disk_set_badblocks);
> -
> -int disk_clear_badblocks(struct gendisk *disk, sector_t s, int
> sectors)
> -{
> -	if (!disk->bb)
> -		return 0;
> -
> -	return badblocks_clear(disk->bb, s, sectors);
> -}
> -EXPORT_SYMBOL(disk_clear_badblocks);
> -
>  /* sysfs access to bad-blocks list. */
>  static ssize_t disk_badblocks_show(struct device *dev,
>  					struct device_attribute
> *attr,
> diff --git a/include/linux/genhd.h b/include/linux/genhd.h
> index 34dbcd90a8fd..38b4d5d32581 100644
> --- a/include/linux/genhd.h
> +++ b/include/linux/genhd.h
> @@ -436,11 +436,6 @@ extern void del_gendisk(struct gendisk *gp);
>  extern void del_gendisk_queue(struct gendisk *disk);
>  extern struct gendisk *get_gendisk(dev_t dev, int *partno);
>  extern struct block_device *bdget_disk(struct gendisk *disk, int
> partno);
> -int disk_alloc_badblocks(struct gendisk *disk);
> -extern int disk_check_badblocks(struct gendisk *disk, sector_t s,
> int sectors,
> -		   sector_t *first_bad, int *bad_sectors);
> -extern int disk_set_badblocks(struct gendisk *disk, sector_t s, int
> sectors);
> -extern int disk_clear_badblocks(struct gendisk *disk, sector_t s,
> int sectors);
>  
>  extern void set_device_ro(struct block_device *bdev, int flag);
>  extern void set_disk_ro(struct gendisk *disk, int flag);
> 
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/block/genhd.c b/block/genhd.c
index b96012849e26..eae2971a6d91 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -506,16 +506,6 @@  static int exact_lock(dev_t devt, void *data)
 	return 0;
 }
 
-int disk_alloc_badblocks(struct gendisk *disk)
-{
-	disk->bb = kzalloc(sizeof(*(disk->bb)), GFP_KERNEL);
-	if (!disk->bb)
-		return -ENOMEM;
-
-	return badblocks_init(disk->bb, 1);
-}
-EXPORT_SYMBOL(disk_alloc_badblocks);
-
 static void register_disk(struct gendisk *disk)
 {
 	struct device *ddev = disk_to_dev(disk);
@@ -695,38 +685,6 @@  void del_gendisk(struct gendisk *disk)
 }
 EXPORT_SYMBOL(del_gendisk);
 
-/*
- * The gendisk usage of badblocks does not track acknowledgements for
- * badblocks. We always assume they are acknowledged.
- */
-int disk_check_badblocks(struct gendisk *disk, sector_t s, int sectors,
-		   sector_t *first_bad, int *bad_sectors)
-{
-	if (!disk->bb)
-		return 0;
-
-	return badblocks_check(disk->bb, s, sectors, first_bad, bad_sectors);
-}
-EXPORT_SYMBOL(disk_check_badblocks);
-
-int disk_set_badblocks(struct gendisk *disk, sector_t s, int sectors)
-{
-	if (!disk->bb)
-		return 0;
-
-	return badblocks_set(disk->bb, s, sectors, 1);
-}
-EXPORT_SYMBOL(disk_set_badblocks);
-
-int disk_clear_badblocks(struct gendisk *disk, sector_t s, int sectors)
-{
-	if (!disk->bb)
-		return 0;
-
-	return badblocks_clear(disk->bb, s, sectors);
-}
-EXPORT_SYMBOL(disk_clear_badblocks);
-
 /* sysfs access to bad-blocks list. */
 static ssize_t disk_badblocks_show(struct device *dev,
 					struct device_attribute *attr,
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 34dbcd90a8fd..38b4d5d32581 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -436,11 +436,6 @@  extern void del_gendisk(struct gendisk *gp);
 extern void del_gendisk_queue(struct gendisk *disk);
 extern struct gendisk *get_gendisk(dev_t dev, int *partno);
 extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
-int disk_alloc_badblocks(struct gendisk *disk);
-extern int disk_check_badblocks(struct gendisk *disk, sector_t s, int sectors,
-		   sector_t *first_bad, int *bad_sectors);
-extern int disk_set_badblocks(struct gendisk *disk, sector_t s, int sectors);
-extern int disk_clear_badblocks(struct gendisk *disk, sector_t s, int sectors);
 
 extern void set_device_ro(struct block_device *bdev, int flag);
 extern void set_disk_ro(struct gendisk *disk, int flag);