diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-07-23 23:37:10 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-09-17 16:37:45 -0400 |
commit | d5ee37bcb1dff9c1d1cac5f7e5752309f1ff66b6 (patch) | |
tree | 769d23c296d9630af81595dd2071d029682e0895 /fs/btrfs/volumes.h | |
parent | 5f546063cee93047af90cf2756e023da9f9fca51 (diff) |
Btrfs: make the device lock and its protected data in the same cacheline
The lock in btrfs_device structure was far away from its protected data, it would
make CPU load the cache line twice when we accessed them, move them together.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r-- | fs/btrfs/volumes.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 2aaa00c47816..6fcc8eae7834 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -36,30 +36,31 @@ struct btrfs_device { | |||
36 | struct list_head dev_list; | 36 | struct list_head dev_list; |
37 | struct list_head dev_alloc_list; | 37 | struct list_head dev_alloc_list; |
38 | struct btrfs_fs_devices *fs_devices; | 38 | struct btrfs_fs_devices *fs_devices; |
39 | |||
39 | struct btrfs_root *dev_root; | 40 | struct btrfs_root *dev_root; |
40 | 41 | ||
42 | struct rcu_string *name; | ||
43 | |||
44 | u64 generation; | ||
45 | |||
46 | spinlock_t io_lock ____cacheline_aligned; | ||
47 | int running_pending; | ||
41 | /* regular prio bios */ | 48 | /* regular prio bios */ |
42 | struct btrfs_pending_bios pending_bios; | 49 | struct btrfs_pending_bios pending_bios; |
43 | /* WRITE_SYNC bios */ | 50 | /* WRITE_SYNC bios */ |
44 | struct btrfs_pending_bios pending_sync_bios; | 51 | struct btrfs_pending_bios pending_sync_bios; |
45 | 52 | ||
46 | u64 generation; | 53 | struct block_device *bdev; |
47 | int running_pending; | 54 | |
55 | /* the mode sent to blkdev_get */ | ||
56 | fmode_t mode; | ||
57 | |||
48 | int writeable; | 58 | int writeable; |
49 | int in_fs_metadata; | 59 | int in_fs_metadata; |
50 | int missing; | 60 | int missing; |
51 | int can_discard; | 61 | int can_discard; |
52 | int is_tgtdev_for_dev_replace; | 62 | int is_tgtdev_for_dev_replace; |
53 | 63 | ||
54 | spinlock_t io_lock; | ||
55 | /* the mode sent to blkdev_get */ | ||
56 | fmode_t mode; | ||
57 | |||
58 | struct block_device *bdev; | ||
59 | |||
60 | |||
61 | struct rcu_string *name; | ||
62 | |||
63 | /* the internal btrfs device id */ | 64 | /* the internal btrfs device id */ |
64 | u64 devid; | 65 | u64 devid; |
65 | 66 | ||
@@ -83,7 +84,6 @@ struct btrfs_device { | |||
83 | /* minimal io size for this device */ | 84 | /* minimal io size for this device */ |
84 | u32 sector_size; | 85 | u32 sector_size; |
85 | 86 | ||
86 | |||
87 | /* physical drive uuid (or lvm uuid) */ | 87 | /* physical drive uuid (or lvm uuid) */ |
88 | u8 uuid[BTRFS_UUID_SIZE]; | 88 | u8 uuid[BTRFS_UUID_SIZE]; |
89 | 89 | ||
@@ -107,7 +107,6 @@ struct btrfs_device { | |||
107 | struct radix_tree_root reada_zones; | 107 | struct radix_tree_root reada_zones; |
108 | struct radix_tree_root reada_extents; | 108 | struct radix_tree_root reada_extents; |
109 | 109 | ||
110 | |||
111 | /* disk I/O failure stats. For detailed description refer to | 110 | /* disk I/O failure stats. For detailed description refer to |
112 | * enum btrfs_dev_stat_values in ioctl.h */ | 111 | * enum btrfs_dev_stat_values in ioctl.h */ |
113 | int dev_stats_valid; | 112 | int dev_stats_valid; |