Re: [PATCH RFC 3/3] btrfs: use latest_bdev in btrfs_show_devname
From: Anand Jain <hidden>
Date: 2021-08-20 09:13:54
On 20/08/2021 15:31, Su Yue wrote:
On Fri 20 Aug 2021 at 02:18, Anand Jain [off-list ref] wrote:quoted
latest_bdev is updated according to the changes to the device list. That means we could use the latest_bdev to show the device name in /proc/self/mounts. So this patch makes that change. Signed-off-by: Anand Jain <redacted> --- RFC because 1. latest_bdev might not be the lowest devid but, we showed the lowest devid in /proc/self/mount.
quoted
2. The device's path is not shown now but, previously we did. So does these break ABI? Maybe yes for 2 howabout for 1 above?
In v2 I am fix the path part. By replacing latest_bdev to latest_dev which means it shall hold the pointer to btrfs_device instead of just to its bdev.
Mabybe a naive question but I have no time to dive into btrfs code recently. If a device which has highest devid was replaced, will the new device be the fs_devices->latest_bdev instead of the existing older one?
It is handled by btrfs_assign_next_active_device(). If the replace source device is also the latest_dev then after replace it shall point to the replace target device. So the new device path is seen in /proc/self/mounts. Which is fine and normal to expect. Similarly btrfs_assign_next_active_device() is called during remove device as well. There is a bug that we didn't update the latest_bdev when we sprout I am fixing this as well in v2. Thanks.