In message <20080501122136.bc2215c9.akpm@linux-foundation.org>, Andrew Morton writes:
Sure, I can implement it and submit a patch. But I've got two questions
first:
1. i_size_read has a tri-state behaviour:
#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
// play with seqcount
#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
// wrap in preempt_disable/enable
#else
// just return value
#endif
Shouldn't the same be done for i_blocks, with matching i_blocks_read(),
i_blocks_write(), and adding an inode->i_blocks_seqcount field?
2. I've rewritten your suggested code a bit to reduce stack use. Modulo
having 32-bit spin_lock/unlock variants, do you see any problem with this
code below? My testing of it so far on 32/64-bit SMP/UMP have all
passed.
void fsstack_copy_inode_size(struct inode *dst, struct inode *src)
{
#if BITS_PER_LONG == 32
blkcnt_t i_blocks;
spin_lock(&src->i_lock);
i_blocks = src->i_blocks;
spin_unlock(&src->i_lock);
spin_lock(&dst->i_lock);
dst->i_blocks = i_blocks;
spin_unlock(&dst->i_lock);
#else
dst->i_blocks = src->i_blocks;
#endif
i_size_write(dst, i_size_read(src));
}
Thanks,
Erez.
--