Re: [PATCH 2/3] ext4: Context support
From: Nicolas Pitre <hidden>
Date: 2012-06-14 16:14:17
Also in:
linux-fsdevel, linux-mmc
On Wed, 13 Jun 2012, Ted Ts'o wrote:
On Wed, Jun 13, 2012 at 08:43:47PM +0000, Arnd Bergmann wrote:quoted
For SD cards, almost everyone is lying and we cannot trust the information, and for USB flash, there is no way to ask the device. In both of these cases, we probably want to detect the erase block size at mkfs time using some timing attack that I worked on before. Note that those devices also do not offer support for context IDs.Yes, although presumably aligning large files to erase block boundaries would still be useful, yes? So adding an erase block size to the ext2/3/4 superblock sounds like a first great step. By making it be a superblock field, that way it's possible to override the value returned by the hardware if it turns out to be a lie, and we can also use programs like flashbench to figure out the erase block size and populate the superblock value via some userspace process. (Possibly called out of mke2fs directly if we can automate it completely, and make it dead reliable.)
Let's not forget that, in almost all cases, filesystem images are not created live on the final medium. Factories are picking a batch of flash devices and a pre-built filesystem image is stamped on them, and there might not even be a guarantee that those flash devices will all have the same characteristics. So to say that making this tuning at mkfs time is probably not the best strategy. Nicolas