Am Di, 2003-07-22 um 23.58 schrieb Alasdair G Kergon: > On Tue, Jul 22, 2003 at 11:17:39PM +0200, Christophe Saout wrote: > > I just wrote a dm target uses a file as backend instead of another block > > device. > > Another suggestion: > > A target that always returns a block of zeros [or more generally, > some other repeating pattern e.g. if the read goes beyond the end > of your file - required to be multiple of sector size - it loops > round to the beginning; writes get dropped] > > So you can easily create, for example a /dev/zero-like block device of > arbitrary size, which might be useful for replacing a lost disk that > contained a stripe if you want to read off the data from the other > stripes at correct offsets. Well, a /dev/zero-like target is very easy (attached). I'm not sure how to make it more "generic". I could think of several possible implementations. What exactly do you have in mind? Your description sounds like a modified version of my file target (drop the write support, limit size to a multiple of the sector size, make requests loop around if they go beyond the file end). If the files are very small you could also read the file data into the memory once and then server it from there. ??? BTW: There are some things in dm-file.c and dm-zero.c that I don't like having there - especially the thing with the io restrictions. Is it possible to make dm-table automatically use these restrictions when there are only targets that don't use dm_get_device? These default restrictions are the on ll_rw_blk.c uses when they don't get overrided. -- Christophe Saout <christophe@xxxxxxxx> Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html