On Thu, May 04 2017, David Brown wrote: > > I have another couple of questions that might be relevant, but I am > really not sure about the correct answers. > > First, if you have a stripe that you know is unused - it has not been > written to since the array was created - could the raid layer safely > return all zeros if an attempt was made to read the stripe? "know is unused" and "it has not been written to since the array was created" are not necessarily the same thing. If I have some devices which used to have a RAID5 array but for which the metadata got destroyed, I might carefully "create" a RAID5 over the devices and then have access to my data. This has been done more than once - it is not just theoretical. But if you really "know" it is unused, then returning zeros should be fine. > > Second, when syncing an unused stripe (such as during creation), rather > than reading the old data and copying it or generating parities, could > we simply write all zeros to all the blocks in the stripes? For many > SSDs, this is very efficient. If you were happy to destroy whatever was there before (see above recovery example for when you wouldn't), then it might be possible to make this work. You would need to be careful not to write zeros over a region that the filesystem has already used. That means you either disable all writes until the initialization completes (waste of time), or you add complexity to track which strips have been written and which haven't, and only initialise strips that have not been written. This complexity would only be used once in the entire life of the RAID. That might not be best use of resources. NeilBrown