Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #30735
| From | Don Y <blockedofcourse@foo.invalid> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: Shutdown behavior and flash storage devices |
| Date | 2021-07-25 09:30 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <sdk3jg$si2$1@dont-email.me> (permalink) |
| References | <sdhb29$ibh$1@gioia.aioe.org> <sdidmc$d9c$1@dont-email.me> <sdjmlo$4ji$1@gioia.aioe.org> |
On 7/25/2021 5:49 AM, Dave Nadler wrote: > On 7/24/2021 9:10 PM, Don Y wrote: >>> So, how do you avoid this kind of corruption in your designs? >> >> Two (transient) copies of each "chunk" of data. Update the second >> copy (on or before impending power fail). When complete, toggle >> a pointer to reference it as the most recent (assuming you don't >> have metadata that automatically provides that sort of information). >> >> The "first" copy can now be removed and its space reallocated to >> some other "second copy" >> >> Then, move on to the next "chunk". Design your algorithms so that >> you can tolerate some chunks being "stale" (not updated in time) >> wrt the others. > > Don, I don't think that works. The entire contents of the volume can > be corrupted if power is removed during wear-leveling operations that are > invisible to the host OS. And I guess you are assuming no file system is in use > (because file system internals would still get corrupted)? [I don't use filesystems; do you use a filesystem to manage your *RAM*? :> ] I use "raw" devices and have the FTL (and wear-leveling) in my firmware. So, I know what the hardware is being asked to do when I talk to it; there's no "black magic" sitting in the middle that I can't quantify/qualify. If you're going to use a "smart" device, then you have to come up with a strategy that lets you recover from arbitrary levels of corruption (because you don't know what that device is going to be doing when the fit hits the shan). I suspect you will see your losses limited to a single block (or so) as it would require more resources to transfer a block's contents into RAM while another block is nominated to receive them. There might be different strategies employed by different device vendors. E.g., one may defer the program/erase of that block until a later time; another may opt to do it "now". I don't see how you can expose enough of the internals of a "smart" device in a manufacturer/model-independent manner. I.e., even storing a hash with each "file", there's no guarantee as to WHERE that will reside on the device. And, when it might "move" (be exposed to loss). [You also have to be prepared for "good data" being lost in such a reshuffling; in my case, I can ensure "what I have, I keep (but may lose something NEW)"] If your needs are for things like configuration parameters (presumably few), can you consider an EEPROM? Use FLASH for bigger things -- that tend to change less frequently (and in more user-visible ways)?
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Shutdown behavior and flash storage devices Dave Nadler <drn@nadler.com> - 2021-07-24 11:19 -0400
Re: Shutdown behavior and flash storage devices Theo <theom+news@chiark.greenend.org.uk> - 2021-07-24 16:37 +0100
Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-24 18:10 -0700
Re: Shutdown behavior and flash storage devices Dimiter_Popoff <dp@tgi-sci.com> - 2021-07-25 14:18 +0300
Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 09:20 -0700
Re: Shutdown behavior and flash storage devices Dave Nadler <drn@nadler.com> - 2021-07-25 08:49 -0400
Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 09:30 -0700
Re: Shutdown behavior and flash storage devices Dimiter_Popoff <dp@tgi-sci.com> - 2021-07-25 22:51 +0300
Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 13:27 -0700
Re: Shutdown behavior and flash storage devices Dimiter_Popoff <dp@tgi-sci.com> - 2021-07-26 00:00 +0300
Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 17:35 -0700
Re: Shutdown behavior and flash storage devices kegs@provalid.com (Kent Dickey) - 2021-07-25 13:53 -0500
Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 13:20 -0700
Re: Shutdown behavior and flash storage devices Jaded Hobo <badboy@heaven.org> - 2021-07-27 19:44 +0200
Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-27 11:27 -0700
csiph-web