浏览代码

Btrfs: rename root_times_lock to root_item_lock

Originally root_times_lock was introduced as part of send/receive
code however newly developed patch to label the subvol reused
the same lock, so renaming it for a meaningful name.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Anand Jain 12 年之前
父节点
当前提交
5f3ab90a72
共有 5 个文件被更改,包括 16 次插入16 次删除
  1. 8 8
      fs/btrfs/ctree.c
  2. 1 1
      fs/btrfs/ctree.h
  3. 1 1
      fs/btrfs/disk-io.c
  4. 2 2
      fs/btrfs/root-tree.c
  5. 4 4
      fs/btrfs/send.c

+ 8 - 8
fs/btrfs/ctree.c

@@ -5114,13 +5114,13 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
 	right_path->search_commit_root = 1;
 	right_path->search_commit_root = 1;
 	right_path->skip_locking = 1;
 	right_path->skip_locking = 1;
 
 
-	spin_lock(&left_root->root_times_lock);
+	spin_lock(&left_root->root_item_lock);
 	left_start_ctransid = btrfs_root_ctransid(&left_root->root_item);
 	left_start_ctransid = btrfs_root_ctransid(&left_root->root_item);
-	spin_unlock(&left_root->root_times_lock);
+	spin_unlock(&left_root->root_item_lock);
 
 
-	spin_lock(&right_root->root_times_lock);
+	spin_lock(&right_root->root_item_lock);
 	right_start_ctransid = btrfs_root_ctransid(&right_root->root_item);
 	right_start_ctransid = btrfs_root_ctransid(&right_root->root_item);
-	spin_unlock(&right_root->root_times_lock);
+	spin_unlock(&right_root->root_item_lock);
 
 
 	trans = btrfs_join_transaction(left_root);
 	trans = btrfs_join_transaction(left_root);
 	if (IS_ERR(trans)) {
 	if (IS_ERR(trans)) {
@@ -5215,15 +5215,15 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
 				goto out;
 				goto out;
 			}
 			}
 
 
-			spin_lock(&left_root->root_times_lock);
+			spin_lock(&left_root->root_item_lock);
 			ctransid = btrfs_root_ctransid(&left_root->root_item);
 			ctransid = btrfs_root_ctransid(&left_root->root_item);
-			spin_unlock(&left_root->root_times_lock);
+			spin_unlock(&left_root->root_item_lock);
 			if (ctransid != left_start_ctransid)
 			if (ctransid != left_start_ctransid)
 				left_start_ctransid = 0;
 				left_start_ctransid = 0;
 
 
-			spin_lock(&right_root->root_times_lock);
+			spin_lock(&right_root->root_item_lock);
 			ctransid = btrfs_root_ctransid(&right_root->root_item);
 			ctransid = btrfs_root_ctransid(&right_root->root_item);
-			spin_unlock(&right_root->root_times_lock);
+			spin_unlock(&right_root->root_item_lock);
 			if (ctransid != right_start_ctransid)
 			if (ctransid != right_start_ctransid)
 				right_start_ctransid = 0;
 				right_start_ctransid = 0;
 
 

+ 1 - 1
fs/btrfs/ctree.h

@@ -1645,7 +1645,7 @@ struct btrfs_root {
 
 
 	int force_cow;
 	int force_cow;
 
 
-	spinlock_t root_times_lock;
+	spinlock_t root_item_lock;
 };
 };
 
 
 struct btrfs_ioctl_defrag_range_args {
 struct btrfs_ioctl_defrag_range_args {

+ 1 - 1
fs/btrfs/disk-io.c

@@ -1204,7 +1204,7 @@ static void __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
 	root->root_key.objectid = objectid;
 	root->root_key.objectid = objectid;
 	root->anon_dev = 0;
 	root->anon_dev = 0;
 
 
-	spin_lock_init(&root->root_times_lock);
+	spin_lock_init(&root->root_item_lock);
 }
 }
 
 
 static int __must_check find_and_setup_root(struct btrfs_root *tree_root,
 static int __must_check find_and_setup_root(struct btrfs_root *tree_root,

+ 2 - 2
fs/btrfs/root-tree.c

@@ -548,9 +548,9 @@ void btrfs_update_root_times(struct btrfs_trans_handle *trans,
 	struct btrfs_root_item *item = &root->root_item;
 	struct btrfs_root_item *item = &root->root_item;
 	struct timespec ct = CURRENT_TIME;
 	struct timespec ct = CURRENT_TIME;
 
 
-	spin_lock(&root->root_times_lock);
+	spin_lock(&root->root_item_lock);
 	item->ctransid = cpu_to_le64(trans->transid);
 	item->ctransid = cpu_to_le64(trans->transid);
 	item->ctime.sec = cpu_to_le64(ct.tv_sec);
 	item->ctime.sec = cpu_to_le64(ct.tv_sec);
 	item->ctime.nsec = cpu_to_le32(ct.tv_nsec);
 	item->ctime.nsec = cpu_to_le32(ct.tv_nsec);
-	spin_unlock(&root->root_times_lock);
+	spin_unlock(&root->root_item_lock);
 }
 }

+ 4 - 4
fs/btrfs/send.c

@@ -4397,9 +4397,9 @@ static int full_send_tree(struct send_ctx *sctx)
 	if (!path)
 	if (!path)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	spin_lock(&send_root->root_times_lock);
+	spin_lock(&send_root->root_item_lock);
 	start_ctransid = btrfs_root_ctransid(&send_root->root_item);
 	start_ctransid = btrfs_root_ctransid(&send_root->root_item);
-	spin_unlock(&send_root->root_times_lock);
+	spin_unlock(&send_root->root_item_lock);
 
 
 	key.objectid = BTRFS_FIRST_FREE_OBJECTID;
 	key.objectid = BTRFS_FIRST_FREE_OBJECTID;
 	key.type = BTRFS_INODE_ITEM_KEY;
 	key.type = BTRFS_INODE_ITEM_KEY;
@@ -4422,9 +4422,9 @@ join_trans:
 	 * Make sure the tree has not changed after re-joining. We detect this
 	 * Make sure the tree has not changed after re-joining. We detect this
 	 * by comparing start_ctransid and ctransid. They should always match.
 	 * by comparing start_ctransid and ctransid. They should always match.
 	 */
 	 */
-	spin_lock(&send_root->root_times_lock);
+	spin_lock(&send_root->root_item_lock);
 	ctransid = btrfs_root_ctransid(&send_root->root_item);
 	ctransid = btrfs_root_ctransid(&send_root->root_item);
-	spin_unlock(&send_root->root_times_lock);
+	spin_unlock(&send_root->root_item_lock);
 
 
 	if (ctransid != start_ctransid) {
 	if (ctransid != start_ctransid) {
 		WARN(1, KERN_WARNING "btrfs: the root that you're trying to "
 		WARN(1, KERN_WARNING "btrfs: the root that you're trying to "