Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1510618

Re: [RESEND PATCH v2 3/3] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available

From Boris Brezillon <boris.brezillon@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [RESEND PATCH v2 3/3] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available
Date 2016-10-27 22:10 +0200
Message-ID <swZ9T-6wz-5@gated-at.bofh.it> (permalink)
References <swYnv-60b-3@gated-at.bofh.it> <swYnw-60b-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 27 Oct 2016 14:14:02 -0500
Zach Brown <zach.brown@ni.com> wrote:

> From: Jeff Westfahl <jeff.westfahl@ni.com>
> 
> Use the MTD function 'max_bad_blocks' to compute the UBI bad_peb_limit,
> if the function is implemented for an MTD and doesn't return an error.
> 
> Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
> Signed-off-by: Zach Brown <zach.brown@ni.com>
> ---
>  drivers/mtd/ubi/build.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 85d54f3..0648863 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -584,6 +584,15 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
>  	int limit, device_pebs;
>  	uint64_t device_size;
>  
> +	/* If the MTD provides a max_bad_blocks function, use that value. Fall
> +	 * back to max_beb_per1024 if that function returns an error.
> +	 */
> +	if (ubi->mtd->_max_bad_blocks) {
> +		limit = ubi->mtd->_max_bad_blocks(ubi->mtd, 0, ubi->mtd->size);
> +		if (limit > 0)
> +			return limit;
> +	}

Please use the helper I was suggesting in patch 1.

> +
>  	if (!max_beb_per1024)
>  		return 0;
>  

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RESEND PATCH v2 0/3] mtd: use ONFI bad blocks per LUN to calculate UBI bad PEB limit Zach Brown <zach.brown@ni.com> - 2016-10-27 21:20 +0200
  [RESEND PATCH v2 2/3] mtd: nand: implement 'max_bad_blocks' mtd function Zach Brown <zach.brown@ni.com> - 2016-10-27 21:20 +0200
    Re: [RESEND PATCH v2 2/3] mtd: nand: implement 'max_bad_blocks' mtd  function Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-27 22:10 +0200
  [RESEND PATCH v2 1/3] mtd: introduce function max_bad_blocks Zach Brown <zach.brown@ni.com> - 2016-10-27 21:20 +0200
    Re: [RESEND PATCH v2 1/3] mtd: introduce function max_bad_blocks Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-27 22:10 +0200
  [RESEND PATCH v2 3/3] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available Zach Brown <zach.brown@ni.com> - 2016-10-27 21:20 +0200
    Re: [RESEND PATCH v2 3/3] mtd: ubi: use 'max_bad_blocks' to compute  bad_peb_limit if available Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-27 22:10 +0200
  Re: [RESEND PATCH v2 0/3] mtd: use ONFI bad blocks per LUN to  calculate UBI bad PEB limit Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-27 22:00 +0200

csiph-web