提交 d5ee37bc 编写于 作者: M Miao Xie 提交者: Chris Mason

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: NMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 5f546063
...@@ -36,30 +36,31 @@ struct btrfs_device { ...@@ -36,30 +36,31 @@ struct btrfs_device {
struct list_head dev_list; struct list_head dev_list;
struct list_head dev_alloc_list; struct list_head dev_alloc_list;
struct btrfs_fs_devices *fs_devices; struct btrfs_fs_devices *fs_devices;
struct btrfs_root *dev_root; struct btrfs_root *dev_root;
struct rcu_string *name;
u64 generation;
spinlock_t io_lock ____cacheline_aligned;
int running_pending;
/* regular prio bios */ /* regular prio bios */
struct btrfs_pending_bios pending_bios; struct btrfs_pending_bios pending_bios;
/* WRITE_SYNC bios */ /* WRITE_SYNC bios */
struct btrfs_pending_bios pending_sync_bios; struct btrfs_pending_bios pending_sync_bios;
u64 generation; struct block_device *bdev;
int running_pending;
/* the mode sent to blkdev_get */
fmode_t mode;
int writeable; int writeable;
int in_fs_metadata; int in_fs_metadata;
int missing; int missing;
int can_discard; int can_discard;
int is_tgtdev_for_dev_replace; int is_tgtdev_for_dev_replace;
spinlock_t io_lock;
/* the mode sent to blkdev_get */
fmode_t mode;
struct block_device *bdev;
struct rcu_string *name;
/* the internal btrfs device id */ /* the internal btrfs device id */
u64 devid; u64 devid;
...@@ -83,7 +84,6 @@ struct btrfs_device { ...@@ -83,7 +84,6 @@ struct btrfs_device {
/* minimal io size for this device */ /* minimal io size for this device */
u32 sector_size; u32 sector_size;
/* physical drive uuid (or lvm uuid) */ /* physical drive uuid (or lvm uuid) */
u8 uuid[BTRFS_UUID_SIZE]; u8 uuid[BTRFS_UUID_SIZE];
...@@ -107,7 +107,6 @@ struct btrfs_device { ...@@ -107,7 +107,6 @@ struct btrfs_device {
struct radix_tree_root reada_zones; struct radix_tree_root reada_zones;
struct radix_tree_root reada_extents; struct radix_tree_root reada_extents;
/* disk I/O failure stats. For detailed description refer to /* disk I/O failure stats. For detailed description refer to
* enum btrfs_dev_stat_values in ioctl.h */ * enum btrfs_dev_stat_values in ioctl.h */
int dev_stats_valid; int dev_stats_valid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册