From: brijesh.singh@calsoftinc.com
To: linux-mtd@lists.infradead.org
Subject: UBI: io_write_path
Date: Thu, 12 Jul 2007 16:01:37 +0530 (IST) [thread overview]
Message-ID: <33922.172.16.0.34.1184236297.squirrel@webmail.calsoftinc.com> (raw)
Hi,
I walked through eba_write path.I found that,if EBUSY or EAGAIN is
returned as err code from ubi_io_write_vid_hdr or ubi_io_write_data
,still the PEB is put back to wear-levelling.This is
unnecessary.Shouldn't it retry on same PEB again?
Code Snip:
----------------------------------------------------------------------------
retry:
pnum = ubi_wl_get_peb(ubi, dtype);
if (pnum < 0) {
ubi_free_vid_hdr(ubi, vid_hdr);
leb_write_unlock(ubi, vol_id, lnum);
return pnum;
}
err = ubi_io_write_vid_hdr(ubi, pnum, vid_hdr);
if (err) {
ubi_warn("failed to write VID header to LEB %d:%d, PEB %d",
vol_id, lnum, pnum);
goto write_error;
}
err = ubi_io_write_data(ubi, buf, pnum, offset, len);
if (err) {
ubi_warn("failed to write %d bytes at offset %d of LEB %d:%d, " "PEB
%d", len, offset, vol_id, lnum, pnum);
goto write_error;
}
...
write_error:
if (err != -EIO || !ubi->bad_allowed) {
ubi_ro_mode(ubi);
leb_write_unlock(ubi, vol_id, lnum);
ubi_free_vid_hdr(ubi, vid_hdr);
return err;
}
/*
* Fortunately, this is the first write operation to this physical
* eraseblock, so just put it and request a new one. We assume that if
* this physical eraseblock went bad, the erase code will handle that.
*/
err = ubi_wl_put_peb(ubi, pnum, 1);
if (err || ++tries > UBI_IO_RETRIES) {
ubi_ro_mode(ubi);
leb_write_unlock(ubi, vol_id, lnum);
ubi_free_vid_hdr(ubi, vid_hdr);
return err;
}
vid_hdr->sqnum = cpu_to_be64(next_sqnum(ubi));
ubi_msg("try another PEB");
goto retry;
-------------------------------------------------------------------------
Regards,
Brijesh
next reply other threads:[~2007-07-12 10:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-12 10:31 brijesh.singh [this message]
2007-07-12 12:28 ` UBI: io_write_path Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=33922.172.16.0.34.1184236297.squirrel@webmail.calsoftinc.com \
--to=brijesh.singh@calsoftinc.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox