UBI: Can we handle -EINTR differently in erase/write path???
Vinit Agnihotri
vinit.agnihotri at gmail.com
Fri Jul 13 02:07:53 EDT 2007
Hi heres few code snip from erase_worker(); from wl.c
if (err != -EIO) {
/*
* If this is not %-EIO, we have no idea what to do. Scheduling
* this physical eraseblock for erasure again would cause
* errors again and again. Well, lets switch to RO mode.
*/
ubi_ro_mode(ubi);
return err;
}
Suppose while erasure in progress & someone pressed "Ctrl+C" then UBI
straight way marks entire device as Read only & its really painful
because then you cant even delete that volume as UBI is read only.
Which I guess its not good way. If use cases are considered it is
highly likely that user can hit "Ctrl+c" , like he want to cancel
erase at that time or something like that. So we can handle -EINTR
differently by following way
if (err != -EIO) {
/*
* If this is not %-EIO, we have no idea what to do. Scheduling
* this physical eraseblock for erasure again would cause
* errors again and again. Well, lets switch to RO mode.
*/
if (err == -EINTR) {
schedule_erase(ubi, e, 0);
return err;
}
else {
ubi_ro_mode(ubi);
return err;
}
}
i.e. we can again put that perticular peb to erase & can return
without making ubi RO mode.
same can be achieved in write path. If write as interrupted then we
can return error to user & can put that peb back to erase list.
This is my initial understanding about handling -EINTR, however I
would like to know views of others. If all agrees I can post patch for
same.
Thanks & Regards
Vinit.
More information about the linux-mtd
mailing list