All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 05/10] Btrfs: make the device lock and its protected data in the same cacheline
Date: Thu, 24 Jul 2014 11:37:10 +0800	[thread overview]
Message-ID: <1406173035-29478-5-git-send-email-miaox@cn.fujitsu.com> (raw)
In-Reply-To: <1406173035-29478-1-git-send-email-miaox@cn.fujitsu.com>

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>
---
 fs/btrfs/volumes.h | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 2aaa00c..6fcc8ea 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -36,30 +36,31 @@ struct btrfs_device {
 	struct list_head dev_list;
 	struct list_head dev_alloc_list;
 	struct btrfs_fs_devices *fs_devices;
+
 	struct btrfs_root *dev_root;
 
+	struct rcu_string *name;
+
+	u64 generation;
+
+	spinlock_t io_lock ____cacheline_aligned;
+	int running_pending;
 	/* regular prio bios */
 	struct btrfs_pending_bios pending_bios;
 	/* WRITE_SYNC bios */
 	struct btrfs_pending_bios pending_sync_bios;
 
-	u64 generation;
-	int running_pending;
+	struct block_device *bdev;
+
+	/* the mode sent to blkdev_get */
+	fmode_t mode;
+
 	int writeable;
 	int in_fs_metadata;
 	int missing;
 	int can_discard;
 	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 */
 	u64 devid;
 
@@ -83,7 +84,6 @@ struct btrfs_device {
 	/* minimal io size for this device */
 	u32 sector_size;
 
-
 	/* physical drive uuid (or lvm uuid) */
 	u8 uuid[BTRFS_UUID_SIZE];
 
@@ -107,7 +107,6 @@ struct btrfs_device {
 	struct radix_tree_root reada_zones;
 	struct radix_tree_root reada_extents;
 
-
 	/* disk I/O failure stats. For detailed description refer to
 	 * enum btrfs_dev_stat_values in ioctl.h */
 	int dev_stats_valid;
-- 
1.9.3


  parent reply	other threads:[~2014-07-24  3:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24  3:37 [PATCH 01/10] Btrfs: Fix the problem that the replace destroys the seed filesystem Miao Xie
2014-07-24  3:37 ` [PATCH 02/10] Btrfs: don't write any data into a readonly device when scrub Miao Xie
2014-07-24 13:19   ` David Sterba
2014-07-25  9:39   ` Anand Jain
2014-07-24  3:37 ` [PATCH 03/10] Btrfs: fix wrong fsid check of scrub Miao Xie
2014-07-24 13:24   ` David Sterba
2014-09-03  6:58     ` [PATCH v2 " Miao Xie
2014-07-24  3:37 ` [PATCH 04/10] Btrfs: fix wrong generation check of super block on a seed device Miao Xie
2014-07-24 13:25   ` David Sterba
2014-07-24  3:37 ` Miao Xie [this message]
2014-07-24  3:37 ` [PATCH 06/10] Btrfs: Fix the problem that the dirty flag of dev stats is cleared Miao Xie
2014-07-24 13:45   ` David Sterba
2014-09-03  6:59     ` [PATCH v2 " Miao Xie
2014-07-24  3:37 ` [PATCH 07/10] Btrfs: update the comment of total_bytes and disk_total_bytes of btrfs_devie Miao Xie
2014-07-24  3:37 ` [PATCH 08/10] Btrfs: Fix wrong device size when we are resizing the device Miao Xie
2014-07-24  3:37 ` [PATCH 09/10] Btrfs: don't consider the missing device when allocating new chunks Miao Xie
2014-07-24  3:37 ` [PATCH 10/10] Btrfs: cleanup unused latest_devid and latest_trans in fs_devices Miao Xie
2014-07-24 13:13 ` [PATCH 01/10] Btrfs: Fix the problem that the replace destroys the seed filesystem David Sterba
2014-07-25  7:56 ` Anand Jain
2014-07-25 12:33 ` [PATCH] btrfs: replace seed device followed by unmount causes kernel WARNING Anand Jain
2014-07-30  7:42   ` Miao Xie
2014-07-31  8:45     ` Anand Jain
2014-08-11  9:46       ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406173035-29478-5-git-send-email-miaox@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.