Re: [PATCH] btrfs: update devid after replace

David Sterba
2020-01-20T19:10:42Z

On Wed, Jan 15, 2020 at 04:22:50PM +0800, Anand Jain wrote:
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -1189,6 +1189,17 @@ int btrfs_sysfs_remove_devices_attr(struct btrfs_fs_devices *fs_devices,
> return 0;
> }
>
> +void btrfs_sysfs_update_devid(struct btrfs_device *device)
> +{
> + char tmp[64];

24 is enough

> +
> + snprintf(tmp, sizeof(tmp), "%llu", device->devid);
> +
> + if (kobject_rename(&device->devid_kobj, tmp))
> + btrfs_warn(device->fs_devices->fs_info,
> + "sysfs: failed to update devid");

And printing for which devid the rename failed should be here

> +}
> +

Once the tests finish I'll add it to misc-next so the patchset is
complete.