Re: [PATCH 01/10] btrfs-progs: Add support for freespace tree in btrfs_read_fs_root

2018-10-03 Thread Su Yue




On 10/1/18 10:46 PM, Nikolay Borisov wrote:

For completeness sake add code to btrfs_read_fs_root so that it can
handle the freespace tree.

Signed-off-by: Nikolay Borisov 


Reviewed-by: Su Yue 

---
  disk-io.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/disk-io.c b/disk-io.c
index 2e6d56a36af9..14f0fd5c2f0c 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -668,6 +668,9 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info 
*fs_info,
if (location->objectid == BTRFS_QUOTA_TREE_OBJECTID)
return fs_info->quota_enabled ? fs_info->quota_root :
ERR_PTR(-ENOENT);
+   if (location->objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
+return fs_info->free_space_root ? fs_info->free_space_root :
+  ERR_PTR(-ENOENT);
  
  	BUG_ON(location->objectid == BTRFS_TREE_RELOC_OBJECTID ||

   location->offset != (u64)-1);






Re: [PATCH 01/10] btrfs-progs: Add support for freespace tree in btrfs_read_fs_root

2018-10-02 Thread Omar Sandoval
On Mon, Oct 01, 2018 at 05:46:12PM +0300, Nikolay Borisov wrote:
> For completeness sake add code to btrfs_read_fs_root so that it can
> handle the freespace tree.

Reviewed-by: Omar Sandoval 

> Signed-off-by: Nikolay Borisov 
> ---
>  disk-io.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/disk-io.c b/disk-io.c
> index 2e6d56a36af9..14f0fd5c2f0c 100644
> --- a/disk-io.c
> +++ b/disk-io.c
> @@ -668,6 +668,9 @@ struct btrfs_root *btrfs_read_fs_root(struct 
> btrfs_fs_info *fs_info,
>   if (location->objectid == BTRFS_QUOTA_TREE_OBJECTID)
>   return fs_info->quota_enabled ? fs_info->quota_root :
>   ERR_PTR(-ENOENT);
> + if (location->objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
> +return fs_info->free_space_root ? fs_info->free_space_root :
> +  ERR_PTR(-ENOENT);
>  
>   BUG_ON(location->objectid == BTRFS_TREE_RELOC_OBJECTID ||
>  location->offset != (u64)-1);
> -- 
> 2.7.4
> 


[PATCH 01/10] btrfs-progs: Add support for freespace tree in btrfs_read_fs_root

2018-10-01 Thread Nikolay Borisov
For completeness sake add code to btrfs_read_fs_root so that it can
handle the freespace tree.

Signed-off-by: Nikolay Borisov 
---
 disk-io.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/disk-io.c b/disk-io.c
index 2e6d56a36af9..14f0fd5c2f0c 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -668,6 +668,9 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info 
*fs_info,
if (location->objectid == BTRFS_QUOTA_TREE_OBJECTID)
return fs_info->quota_enabled ? fs_info->quota_root :
ERR_PTR(-ENOENT);
+   if (location->objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
+return fs_info->free_space_root ? fs_info->free_space_root :
+  ERR_PTR(-ENOENT);
 
BUG_ON(location->objectid == BTRFS_TREE_RELOC_OBJECTID ||
   location->offset != (u64)-1);
-- 
2.7.4