On Mon, Jul 25, 2011 at 8:23 PM, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > What I *did* consider was to have the bits just be "slow case" bits. > And just set them all (blindly) at inode allocation time. Then, the > users would simply end up doing [ ... ] I ended up with this, after all. Except rather than be "slow case" bits, they are "fast case" bits. The code seemed more natural that way: clear the bits initially, and then set a bit for the default case we care about. And I use inode->i_lock to protect the setting, to avoid the need for atomic ops on an "unsigned short". It's going to happen once per bit and per inode lifetime, it didn't seem worth it to try to be clever about it. I considered using i_state, which is already a proper "unsigned long" exactly so that the bitops will work on it. But since the aim was to be dense in the D$, it seemed more natural to use the 16-bit slot we have next to i_mode. My timings still showed roughly a 2% improvement (well 1.8% on the "repeat ten times, do the average") but I didn't really do a lot of deviation testing. The noise in the numbers is quite noticeable between reboots, but I've seen that 1-2% several times over various different implementations of the same "try to avoid touching inode->i_op->xyz", so I'm pretty convinced it's not just random noise. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html