If I am setting two variables in sequence and it is essential that if a
different cpu reads those variables it seems them updated in the same
order as they were written in the C code do I need a write barrier in
between the two? For example:
ntfs_inode->allocated_size = 10;
ntfs_inode->initilized_size = 10;
Should another CPU see initialized_size = 10 but allocated_size < 10 the
ntfs driver will blow up in some places. So does that mean I need a
write barrier, between the two?
If yes, do I still need it if I wrap the two settings (and all accesses)
with a spin lock? And in particular with a rw-spinlock? For example:
write_lock_irqsave(&ntfs_inode->size_lock, flags);
ntfs_inode->allocated_size = 10;
ntfs_inode->initilized_size = 10;
write_unlock_irqrestore(&ntfs_inode->size_lock, flags);
Do I still need a write barrier or does the spinlock imply it already?
Thanks a lot in advance and apologies for the stupid(?) questions...