2011/7/19 Robert Wang <wdon...@linux.vnet.ibm.com>: > 2) * Create a new file block/raw-cow.c. It will be much more like the > mixture of block/cow.c and block/raw.c. > > So I will change some functions in cow.c and raw.c to none-static, then > raw-cow.c can re-use them. When read operation occurs, determine whether > dirty flag in raw-cow image is set. If true, read directly from the raw > file. After write operation, set related dirty flag in raw-cow image. > And other functions might also be modified.
The block/cow.c driver is inefficient because it does I/O for each bitmap set/test operation. I think doing this more efficiently means basically rewriting the bitmap code to keep a writethrough bitmap in memory. Regarding the file header, the msize is not really useful - there is no interface to read it and no feature makes use of msize. The sector_size field could also be dropped. The true sector size does from the underlying storage that contains this image file. Especially in the cache=none (O_DIRECT) case we need to honor the underlying sector size and I'm not sure the sector_size field helps. Stefan