Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Artem Bityutskiy
On Wed, 2012-07-18 at 22:55 +0300, Shmulik Ladkani wrote: > However, if you DO NOT mark it bad, but instead go into RO mode, you > should be able to later re-attach because the good_peb_count would fit > (no shortage of PEBs). Yeah, you are right, I'll return to the original patch. -- Best

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Shmulik Ladkani
Hi Artem, On Wed, 18 Jul 2012 13:28:37 +0300 Artem Bityutskiy wrote: > The whole thing will become simpler if we first mark the PEB as bad > unconditionally (because it _is_ bad), then grab the lock and do all the > re-calculations. On first glance that would sound the right thing to do.

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Artem Bityutskiy
On Wed, 2012-07-04 at 11:06 +0300, Shmulik Ladkani wrote: > The existing mechanism of reserving PEBs for bad PEB handling has two > flaws: > - It is calculated as a percentage of good PEBs instead of total PEBs. > - There's no limit on the amount of PEBs UBI reserves for future bad > eraseblock

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Artem Bityutskiy
On Wed, 2012-07-18 at 13:28 +0300, Artem Bityutskiy wrote: > > ubi->bad_peb_count += 1; > > ubi->good_peb_count -= 1; > > ubi_calculate_reserved(ubi); > We do not need to call this function from here, right? Err, sorry, it _is_ needed! -- Best Regards, Artem Bityutskiy

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Artem Bityutskiy
On Wed, 2012-07-04 at 11:06 +0300, Shmulik Ladkani wrote: > @@ -1045,20 +1046,14 @@ static int erase_worker(struct ubi_device *ubi, > struct ubi_work *wl_wrk, > } > > spin_lock(>volumes_lock); > - need = ubi->beb_rsvd_level - ubi->beb_rsvd_pebs + 1; > - if (need > 0) { > -

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Artem Bityutskiy
On Wed, 2012-07-04 at 11:06 +0300, Shmulik Ladkani wrote: @@ -1045,20 +1046,14 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk, } spin_lock(ubi-volumes_lock); - need = ubi-beb_rsvd_level - ubi-beb_rsvd_pebs + 1; - if (need 0) { -

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Artem Bityutskiy
On Wed, 2012-07-18 at 13:28 +0300, Artem Bityutskiy wrote: ubi-bad_peb_count += 1; ubi-good_peb_count -= 1; ubi_calculate_reserved(ubi); We do not need to call this function from here, right? Err, sorry, it _is_ needed! -- Best Regards, Artem Bityutskiy signature.asc

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Artem Bityutskiy
On Wed, 2012-07-04 at 11:06 +0300, Shmulik Ladkani wrote: The existing mechanism of reserving PEBs for bad PEB handling has two flaws: - It is calculated as a percentage of good PEBs instead of total PEBs. - There's no limit on the amount of PEBs UBI reserves for future bad eraseblock

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Shmulik Ladkani
Hi Artem, On Wed, 18 Jul 2012 13:28:37 +0300 Artem Bityutskiy dedeki...@gmail.com wrote: The whole thing will become simpler if we first mark the PEB as bad unconditionally (because it _is_ bad), then grab the lock and do all the re-calculations. On first glance that would sound the right

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-18 Thread Artem Bityutskiy
On Wed, 2012-07-18 at 22:55 +0300, Shmulik Ladkani wrote: However, if you DO NOT mark it bad, but instead go into RO mode, you should be able to later re-attach because the good_peb_count would fit (no shortage of PEBs). Yeah, you are right, I'll return to the original patch. -- Best

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-09 Thread Shmulik Ladkani
On Mon, 9 Jul 2012 12:15:17 +0200 Richard Genoud wrote: > 2012/7/4 Shmulik Ladkani : > > + /* > > +* Calculate the actual number of PEBs currently needed to be > > reserved > > +* for future bad eraseblock handling. > > +*/ > > + ubi->beb_rsvd_level =

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-09 Thread Richard Genoud
2012/7/4 Shmulik Ladkani : > diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c > index f6a7d7a..e9dcb83 100644 > --- a/drivers/mtd/ubi/misc.c > +++ b/drivers/mtd/ubi/misc.c > @@ -98,10 +98,18 @@ int ubi_check_volume(struct ubi_device *ubi, int vol_id) > */ > void

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-09 Thread Richard Genoud
2012/7/4 Shmulik Ladkani shmulik.ladk...@gmail.com: diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c index f6a7d7a..e9dcb83 100644 --- a/drivers/mtd/ubi/misc.c +++ b/drivers/mtd/ubi/misc.c @@ -98,10 +98,18 @@ int ubi_check_volume(struct ubi_device *ubi, int vol_id) */ void

Re: [PATCH 2/5] ubi: Limit amount of reserved eraseblocks for bad PEB handling

2012-07-09 Thread Shmulik Ladkani
On Mon, 9 Jul 2012 12:15:17 +0200 Richard Genoud richard.gen...@gmail.com wrote: 2012/7/4 Shmulik Ladkani shmulik.ladk...@gmail.com: + /* +* Calculate the actual number of PEBs currently needed to be reserved +* for future bad eraseblock handling. +*/ +