public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [Q] ubi->beb_rsvd_pebs calculations
@ 2012-07-01 16:52 Shmulik Ladkani
  2012-07-03 10:53 ` Artem Bityutskiy
  0 siblings, 1 reply; 7+ messages in thread
From: Shmulik Ladkani @ 2012-07-01 16:52 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd

Hi Artem,

While working on improving reserved bad PEBs calculations, I encounted
some code portion whose reasoning can't be easily understood.

I'd be happy if you can comment on the following:

from 'erase_worker' in wl.c:

> 	/* It is %-EIO, the PEB went bad */
> 
> 	if (!ubi->bad_allowed) {
> 		ubi_err("bad physical eraseblock %d detected", pnum);
> 		goto out_ro;
> 	}
> 
> 	spin_lock(&ubi->volumes_lock);
> 	need = ubi->beb_rsvd_level - ubi->beb_rsvd_pebs + 1;
> 	if (need > 0) {
> 		need = ubi->avail_pebs >= need ? need : ubi->avail_pebs;
> 		ubi->avail_pebs -= need;
> 		ubi->rsvd_pebs += need;
> 		ubi->beb_rsvd_pebs += need;
> 		if (need > 0)
> 			ubi_msg("reserve more %d PEBs", need);
> 	}

Why attempting to reclaim available PEBs into the 'beb_rsvd_pebs' here
within 'erase_worker'?
If 'beb_rsvd_pebs' was already below the required level, how could it be
that suddenly during 'erase_worker' more PEBs will be available?

The 2 other places which perform this "reclaim" are volume shrink and
volume remove. Within these places reclaim makes sense, as the
shrink/remove operations result in increasing the available PEBs.
(BTW the same code reclaiming beb_rsvd_pebs is duplicated, I've unified
all places).

However here in 'erase_worker' I expect either 'beb_rsvd_pebs' to already be
at the required level, or to be less than the required level - but in
the latter case reclaiming seems as a no-op.

What do you say?
Would you consider removing this "beb_rsvd_pebs reclaim" block?

Regards,
Shmulik

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-16 14:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-01 16:52 [Q] ubi->beb_rsvd_pebs calculations Shmulik Ladkani
2012-07-03 10:53 ` Artem Bityutskiy
2012-07-03 12:33   ` Shmulik Ladkani
2012-07-03 12:42     ` Artem Bityutskiy
2012-07-03 12:57       ` Shmulik Ladkani
2012-07-03 16:01       ` Shmulik Ladkani
2012-07-16 14:40         ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox