On 2/6/19 11:33 PM, David Sterba wrote:
On Fri, Jan 04, 2019 at 01:31:51PM +0800, Anand Jain wrote:
Adds cli and ioctl to forget a scanned device or forget all stale
devices in the kernel.
Anand Jain (2):
btrfs: refactor btrfs_free_stale_devices() to get return value
btrfs: introduce feature to forget a btrfs device
The 2nd patch has been added to misc-next too, I've updated the
changelog a bit.
Thanks.
The usecase here is quite small so I don't think we've
missed something crucial on the kernel side.
The userspace part can
provide some convenience shortcuts like --forget-all
The --forget is already equivalent to --forget-all. For example..
# btrfs dev scan /dev/sdb
Scanning for Btrfs filesystems in '/dev/sdb'
# btrfs dev scan --forget /dev/sdb
# btrfs dev scan
Scanning for Btrfs filesystems
# btrfs dev scan --forget
# echo $?
0
# btrfs dev scan --forget /dev/sdb
ERROR: Can't forget '/dev/sdb': No such file or directory
# echo $?
1
#
> or specifying by
> filesystem id where the translation would happen internally, but the
> ioctl would cover that. Thanks.
Looks like that seeks the complete enhancement to scan cli.
IMO we could add..
#btrfs dev scan --show
For which looks like we need to enhance existing ioctl
BTRFS_IOC_FS_INFO and BTRFS_IOC_DEV_INFO so that it works
through btrfs-control.
Which means 'btrfs fi show' can also show the scanned devices from
the kernel, probably we should just add flags to the output to indicate
if the fsid-device is mounted.
OR a wrapper around the sysfs fs-dev tree implementation will suffice
as well.
further, (fsid translation happens internally)
#btrfs dev scan <fsid>
#btrfs dev scan --forget <fsid>
In general, agree use case is limited.
Thanks, Anand