Skip to contentSkip to conversation

Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

PATCH Zhao Lei 2 participants 2 messages Sep 6, 2016 – Sep 7, 2016 1 message not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhao Lei

author
#1 lore raw

Hi, Sean Fu

Quoted 28 lines

-----Original Message-----
From: Sean Fu [mailto:[email protected]]
Sent: Tuesday, September 06, 2016 11:51 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Sean Fu <[email protected]>
Subject: [PATCH v2] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

The input argument root is already set with "fs_info->chunk_root". "chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info)" in caller "open_ctree".
"root->fs_info = fs_info” in "btrfs_alloc_root".

---
Changes in v2:
- Renaming root to chunk_root to make it clear.

 fs/btrfs/volumes.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/volumes.c +0 -0
index 366b335..eb3d04a 100644

fs/btrfs/volumes.c out_short_read: · line 6594

Quoted 5 lines
fs/btrfs/volumes.c +1 -1
@@ -6591,7 +6591,7 @@ out_short_read:
 	return -EIO;
 }
 
-int btrfs_read_chunk_tree(struct btrfs_root *root)
+int btrfs_read_chunk_tree(struct btrfs_root *chunk_root)

Maybe you also need to modify function body to make it pass compile, and the header file also need to be modified.

BTW, Qu Wenruo give us a better way in reply, we
can use fs_info directly.

Thanks
Zhaolei

Quoted 15 lines
fs/btrfs/volumes.c +0 -3
 {
 	struct btrfs_path *path;
 	struct extent_buffer *leaf;
@@ -6600,8 +6600,6 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
 	int ret;
 	int slot;
 
-	root = root->fs_info->chunk_root;
-
 	path = btrfs_alloc_path();
 	if (!path)
 		return -ENOMEM;
--

2.6.2

#2 lore raw
Quoted 33 lines · Zhao Lei

Hi, Sean Fu

Quoted 31 lines

-----Original Message-----
From: Sean Fu [mailto:[email protected]]
Sent: Tuesday, September 06, 2016 11:51 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Sean Fu <[email protected]>
Subject: [PATCH v2] Btrfs: remove unnecessary code of chunk_root assignment in btrfs_read_chunk_tree.

The input argument root is already set with "fs_info->chunk_root". "chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info)" in caller "open_ctree".
"root->fs_info = fs_info” in "btrfs_alloc_root".

---
Changes in v2:
- Renaming root to chunk_root to make it clear.

 fs/btrfs/volumes.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/volumes.c +0 -0
index 366b335..eb3d04a 100644
@@ -6591,7 +6591,7 @@ out_short_read:
 	return -EIO;
 }
 
Quoted 5 lines

fs/btrfs/volumes.c out_short_read: · line 6594

Quoted 2 lines
fs/btrfs/volumes.c +1 -1
-int btrfs_read_chunk_tree(struct btrfs_root *root)
+int btrfs_read_chunk_tree(struct btrfs_root *chunk_root)

Maybe you also need to modify function body to make it pass compile, and the header file also need to be modified.

Sorry for my mistake. I have released v3 for it.

Quoted 3 lines

BTW, Qu Wenruo give us a better way in reply, we
can use fs_info directly.

Sorry, I don't know why we should use fs_info directly. I have asked Qu for more detail.
Thanks for your review.

Quoted 23 lines

Thanks
Zhaolei

Quoted 15 lines
fs/btrfs/volumes.c +0 -3
 {
 	struct btrfs_path *path;
 	struct extent_buffer *leaf;
@@ -6600,8 +6600,6 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
 	int ret;
 	int slot;
 
-	root = root->fs_info->chunk_root;
-
 	path = btrfs_alloc_path();
 	if (!path)
 		return -ENOMEM;
--

2.6.2