btrfs: fix structs where bitfields and spinlock/atomic share 8B word
authorDavid Sterba <dsterba@suse.cz>
Thu, 26 Jan 2012 20:01:12 +0000 (15:01 -0500)
committerDavid Sterba <dsterba@suse.cz>
Wed, 15 Feb 2012 15:40:25 +0000 (16:40 +0100)
On ia64, powerpc64 and sparc64 the bitfield is modified through a RMW cycle and current
gcc rewrites the adjacent 4B word, which in case of a spinlock or atomic has
disaterous effect.

https://lkml.org/lkml/2012/2/1/220

Signed-off-by: David Sterba <dsterba@suse.cz>
fs/btrfs/ctree.h
fs/btrfs/extent_map.h

index 3c2cbf7b666355b1106fb3fae80451b66ac56086..8e4457e0478eddcaa700b93afe3063895dc63820 100644 (file)
@@ -886,7 +886,7 @@ struct btrfs_block_rsv {
        u64 reserved;
        struct btrfs_space_info *space_info;
        spinlock_t lock;
-       unsigned int full:1;
+       unsigned int full;
 };
 
 /*
index 33a7890b1f4091479df52d7a13c1532ba911ce76..1195f09761fedd2e5c109b74d3000c2973bc75f4 100644 (file)
@@ -26,8 +26,8 @@ struct extent_map {
        unsigned long flags;
        struct block_device *bdev;
        atomic_t refs;
-       unsigned int in_tree:1;
-       unsigned int compress_type:4;
+       unsigned int in_tree;
+       unsigned int compress_type;
 };
 
 struct extent_map_tree {