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


Groups > linux.kernel > #1527009 > unrolled thread

[RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available

Started byZach Brown <zach.brown@ni.com>
First post2016-11-21 21:00 +0100
Last post2016-11-22 20:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available Zach Brown <zach.brown@ni.com> - 2016-11-21 21:00 +0100
    Re: [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute  bad_peb_limit if available Brian Norris <computersforpeace@gmail.com> - 2016-11-22 19:50 +0100
    Re: [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute  bad_peb_limit if available Brian Norris <computersforpeace@gmail.com> - 2016-11-22 20:00 +0100

#1527009 — [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available

FromZach Brown <zach.brown@ni.com>
Date2016-11-21 21:00 +0100
Subject[RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available
Message-ID<sG2UW-5ut-3@gated-at.bofh.it>
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>
Acked-by: Boris Brezillon <boris.brezillon@free-electron.com>
---
 drivers/mtd/ubi/build.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 85d54f3..e9940a9 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -584,6 +584,10 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
 	int limit, device_pebs;
 	uint64_t device_size;
 
+	limit = mtd_max_bad_blocks(ubi->mtd, 0, ubi->mtd->size);
+	if (limit > 0)
+		return limit;
+
 	if (!max_beb_per1024)
 		return 0;
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1527839 — Re: [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available

FromBrian Norris <computersforpeace@gmail.com>
Date2016-11-22 19:50 +0100
SubjectRe: [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available
Message-ID<sGoiJ-2wz-1@gated-at.bofh.it>
In reply to#1527009
On Mon, Nov 21, 2016 at 01:51:36PM -0600, Zach Brown 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.

I'm not exactly a UBI expert here, but it seems reasonable that we
should adjust the Kconfig documentation for MTD_UBI_BEB_LIMIT to further
emphasize that it's a default, if the value can't be determined by other
means.

> Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
> Signed-off-by: Zach Brown <zach.brown@ni.com>
> Acked-by: Boris Brezillon <boris.brezillon@free-electron.com>
> ---
>  drivers/mtd/ubi/build.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 85d54f3..e9940a9 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -584,6 +584,10 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
>  	int limit, device_pebs;
>  	uint64_t device_size;
>  
> +	limit = mtd_max_bad_blocks(ubi->mtd, 0, ubi->mtd->size);
> +	if (limit > 0)
> +		return limit;

Are you sure you want to even override the user-provided
max_beb_per1024 value taken from the mtd= line? I'd think if someone
went as far as to specify this in the kernel command line, they don't
expect it to get overridden. Just my two cents.

Brian

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

[toc] | [prev] | [next] | [standalone]


#1527848 — Re: [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available

FromBrian Norris <computersforpeace@gmail.com>
Date2016-11-22 20:00 +0100
SubjectRe: [RESEND PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available
Message-ID<sGosp-2Ad-5@gated-at.bofh.it>
In reply to#1527009
On Mon, Nov 21, 2016 at 01:51:36PM -0600, Zach Brown 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>
> Acked-by: Boris Brezillon <boris.brezillon@free-electron.com>
> ---
>  drivers/mtd/ubi/build.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 85d54f3..e9940a9 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -584,6 +584,10 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
>  	int limit, device_pebs;
>  	uint64_t device_size;
>  
> +	limit = mtd_max_bad_blocks(ubi->mtd, 0, ubi->mtd->size);
> +	if (limit > 0)

I guess we're assuming 0 is an erroneous value? Otherwise, why would
mtd_can_have_bb() be true?

Brian

> +		return limit;
> +
>  	if (!max_beb_per1024)
>  		return 0;
>  
> -- 
> 2.7.4
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web