diff mbox

[4/8] Add strdup in btrfs_add_to_fsid() to track the device path.

Message ID 1418847252-14184-5-git-send-email-kreijack@inwind.it (mailing list archive)
State New, archived
Headers show

Commit Message

Goffredo Baroncelli Dec. 17, 2014, 8:14 p.m. UTC
When creating a new btrfs_device, copy the path to track it.
This path is then used by mkfs.btrfs to list all devices.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
---
 utils.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Satoru Takeuchi Dec. 25, 2014, 1:29 a.m. UTC | #1
On 2014/12/18 5:14, Goffredo Baroncelli wrote:
> When creating a new btrfs_device, copy the path to track it.
> This path is then used by mkfs.btrfs to list all devices.
> 
> Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>

Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

> ---
>   utils.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/utils.c b/utils.c
> index dcb4f74..3f50e4d 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -647,6 +647,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
>   	device->bytes_used = 0;
>   	device->total_ios = 0;
>   	device->dev_root = root->fs_info->dev_root;
> +	device->name = strdup(path);
>   
>   	ret = btrfs_add_device(trans, root, device);
>   	BUG_ON(ret);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils.c b/utils.c
index dcb4f74..3f50e4d 100644
--- a/utils.c
+++ b/utils.c
@@ -647,6 +647,7 @@  int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
 	device->bytes_used = 0;
 	device->total_ios = 0;
 	device->dev_root = root->fs_info->dev_root;
+	device->name = strdup(path);
 
 	ret = btrfs_add_device(trans, root, device);
 	BUG_ON(ret);