Sync() function doesn't really flush cache to disk
I'm running Arc linux 2.6.19, and i've been simply trying to vi a random text file on a SPI flash system then use to the sync() command to force to physically write to flush. So far it wouldn't, unless i issue a reboot command. The sector size on this flash system is 64kb. So far from what i observed, the do_cached_write function in mtdblock.c would be called a couple time each time sync() is trigger. In this function the size variable is never equal to sect_size(64kb) beacuse it's limited by the len variable which is 512 only. Then, mtdblk->cache_state would always be STATE_DIRTY but the mtdblk->cache_offset and sect_start values would be both zero, so in the end all this function did is the following two lines:
memcpy (mtdblk->cache_data + offset, buf, size);
mtdblk->cache_state = STATE_DIRTY;
I realize this is pretty specific, but if any of you experts out there can give me a hint, it would great!