I'm in the middle of (finally) implementing a bad block list for Linux
md/raid, and I find that the motivation and the desired behaviour
isn't (or wasn't) quite as obvious as I expected. So now that I think
I have sorted it out, it seems sensible to write it up so that you, my
faithful reader, can point out any glaring problems.
The bad block list is simply a list of blocks - one list for each
device - which are to be treated as 'bad'. This does not include any
relocation of bad blocks to some good location. That might be done by
the underlying device, but md doesn't do it. md just tracks which
blocks are bad and which, by implication, are good.
The difficulty comes in understanding exactly what "bad" means, why we
need to record badness, and what to do when we find that we might want
to perform IO against a recorded bad block.
Back in 2003 I wrote a program called "wiggle". Like many interesting projects it was written to
scratch an itch.
While developing code for the Linux kernel I would often need to apply patches made for earlier versions against later versions. Sometimes there would be trivial conflicts and the "patch" program would just give up an create a reject file. After the 50th time that I applied a patch like this by hand it decided that enough was enough so I wrote "wiggle". It takes patches that don't quite apply properly and wiggles them in to place. If there is a change in part of the code that the patch doesn't actually change, wiggle doesn't let that get in the way. If there is a change in part of the code that the patch also changes, wiggle reports that inline as a conflict in a way that makes it easy to resolve by hand.
Since 2003 I have made a few improvements and fixed a few bugs. Just recently the Debian package of wiggle got a new maintainer who was very proactive in trying to get some patches upstream to me, and get some languishing bugs fixed.
Always keen to reward such friendly behaviour I applied the patches, fixed the bugs and finally made a new release
of wiggle, the first in nearly 7 years.
What I really want to know is how to get git to always use wiggle for merging conflicts.
I can do it on a per-repository basis by setting the 'merge' attribute (I think) but I cannot make it
automatically apply to all of my git trees...
I frequently see comments, particularly on the linux-raid mailing list
to the effect that md should be more clever when recovering from an
inconsistent stripe in an array.
In particular, it is suggested that for a RAID1 with more than 2
devices, a vote should be held and if one content occurs more often
than the others (e.g. 2 devices have the same content, the third is
different) then the majority vote should rule and the most common
content be copied over the less common content.
Similarly with RAID6 if the P and Q blocks don't match the data
blocks, it may be possible to find exactly one data block which can be
corrected so as to make both P and Q match - so we could change just
one data block instead of two "parity" blocks to achieve consistency.
I will call this approach the "Smart recovery" approach.
The assertion is that smart recovery will not only make the stripe
consistent, but will also make it "correct".
I do not agree with these comments. It is my position that if there
is an inconsistency that needs to be corrected then it should be
corrected in a simple predictable way and that any extra complexity is
unjustified. For RAID1, that means copying to first block over all
the others. For RAID6, that means calculating new P and Q blocks
based on the data. This is the "simple recovery" approach.
This note is an attempt to justify this position, both to myself and
to you, my loyal reader.
Last week I bought a "Dgtec HDPVR5009" High-definition Personal Video Record from Dick Smith electronics.
Today I returned it, which is a bit disappointing.
It should be a reasonably adequate device. It doesn't have AV input, so I cannot digitise old videos, it doesn't have USB for external storage or network or any of those frills. But it has twin HD DVB-T tuners and 500GB of internal disk drive, and HDMI output, so it should do basic recording and playback OK. But it doesn't.
Also there seem to be a lot of rough edges on the software, enough to make me feel it would constantly annoy me.
The big problems were:
While playing a recording the audio would sometimes drop out. At first I thought there must have been a signal problem during recording, but the video was fine. Then I discovered that if I rewind and play again, the audio will be there. Even "pause then play" will bring back the audio. But sometimes it only comes back for a minute to two. The audio is there, it just wasn't playing. This didn't always happen. Often I could watch a recording with no problems. But the fact that it happened at all is a worry.
Sometimes - possibly dependent on the particular channel I was watching - the audio and video would be a fraction of a second out of sync. When you can see the lips of the person who is talking, this can be very disconcerting. When I want the show using the DVB-T receiver in the TV, it is perfect, when I watch through the Dgtec, it was bad. Again, this wasn't all the time, and may have been fairly rare. But I don't want a device that does that.
Those were enough to convince me to take the device back. Other problems are relatively minor but still an annoyance.
It was awkward to switch between watching the TV live, and watching the on-going recording. There is a 'freeze' button which freezes the image. But when press it again, it doesn't continue from where it was, but rather jumps forward to the current time.
When you do switch to the recording of the current program, you can fairly easily jump forward towards the end, but you can also very easily jump past the end which wraps around to the start again. Going back from the start doesn't take you to the end. So it is quite hard to fast forward to the end of the recording, which is the moment currently being recorded.
There is a nice feature where you can 'mark' the current point in a recording, and it shows as a little mark when you show the slider control for navigating around the recording. However there is no way to jump to the next/previous mark, so the marks are fairly useless. At least, I couldn't find a way, and the documentation didn't list one.
The device supports a list of 'favourite' channels so that it is easy to jump to the channel you want without having to hunt through a long list. However when creating a timer event to record a program, it doesn't allow access to this 'favourites' list, and it doesn't default to the 'current' channel. So you still have to hunt through a long list
When you record a program, it chooses a name for the file base on the name of the program being recorded. But if you want to change this name it isn't easy. Despite the remote having a mobile-phone-like keypad with 3 or 4 letters per digit, you cannot use this to enter a new file name. You have to use arrow buttons to walk around an on-screen key board, and press 'select' for the letters you want. And don't bother trying to enter a space, you cannot.
So, a long way less than perfect. And while the price-point ($400) would lead you not to expect perfection, it was to me sufficiently far from perfect to be unusable. Your mileage might vary....