Lines Matching refs:device
1736 struct btrfs_device *device; in btrfs_sysfs_remove_fs_devices() local
1739 list_for_each_entry(device, &fs_devices->devices, dev_list) in btrfs_sysfs_remove_fs_devices()
1740 btrfs_sysfs_remove_device(device); in btrfs_sysfs_remove_fs_devices()
1743 list_for_each_entry(device, &seed->devices, dev_list) in btrfs_sysfs_remove_fs_devices()
1744 btrfs_sysfs_remove_device(device); in btrfs_sysfs_remove_fs_devices()
1996 void btrfs_sysfs_remove_device(struct btrfs_device *device) in btrfs_sysfs_remove_device() argument
2004 devices_kobj = device->fs_info->fs_devices->devices_kobj; in btrfs_sysfs_remove_device()
2007 if (device->bdev) in btrfs_sysfs_remove_device()
2008 sysfs_remove_link(devices_kobj, bdev_kobj(device->bdev)->name); in btrfs_sysfs_remove_device()
2010 if (device->devid_kobj.state_initialized) { in btrfs_sysfs_remove_device()
2011 kobject_del(&device->devid_kobj); in btrfs_sysfs_remove_device()
2012 kobject_put(&device->devid_kobj); in btrfs_sysfs_remove_device()
2013 wait_for_completion(&device->kobj_unregister); in btrfs_sysfs_remove_device()
2022 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_devinfo_in_fs_metadata_show() local
2025 val = !!test_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &device->dev_state); in btrfs_devinfo_in_fs_metadata_show()
2035 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_devinfo_missing_show() local
2038 val = !!test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state); in btrfs_devinfo_missing_show()
2049 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_devinfo_replace_target_show() local
2052 val = !!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state); in btrfs_devinfo_replace_target_show()
2062 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_devinfo_scrub_speed_max_show() local
2065 return sysfs_emit(buf, "%llu\n", READ_ONCE(device->scrub_speed_max)); in btrfs_devinfo_scrub_speed_max_show()
2072 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_devinfo_scrub_speed_max_store() local
2082 WRITE_ONCE(device->scrub_speed_max, limit); in btrfs_devinfo_scrub_speed_max_store()
2092 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_devinfo_writeable_show() local
2095 val = !!test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state); in btrfs_devinfo_writeable_show()
2104 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_devinfo_fsid_show() local
2107 return sysfs_emit(buf, "%pU\n", device->fs_devices->fsid); in btrfs_devinfo_fsid_show()
2114 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_devinfo_error_stats_show() local
2117 if (!device->dev_stats_valid) in btrfs_devinfo_error_stats_show()
2131 btrfs_dev_stat_read(device, BTRFS_DEV_STAT_WRITE_ERRS), in btrfs_devinfo_error_stats_show()
2132 btrfs_dev_stat_read(device, BTRFS_DEV_STAT_READ_ERRS), in btrfs_devinfo_error_stats_show()
2133 btrfs_dev_stat_read(device, BTRFS_DEV_STAT_FLUSH_ERRS), in btrfs_devinfo_error_stats_show()
2134 btrfs_dev_stat_read(device, BTRFS_DEV_STAT_CORRUPTION_ERRS), in btrfs_devinfo_error_stats_show()
2135 btrfs_dev_stat_read(device, BTRFS_DEV_STAT_GENERATION_ERRS)); in btrfs_devinfo_error_stats_show()
2158 struct btrfs_device *device = container_of(kobj, struct btrfs_device, in btrfs_release_devid_kobj() local
2161 memset(&device->devid_kobj, 0, sizeof(struct kobject)); in btrfs_release_devid_kobj()
2162 complete(&device->kobj_unregister); in btrfs_release_devid_kobj()
2171 int btrfs_sysfs_add_device(struct btrfs_device *device) in btrfs_sysfs_add_device() argument
2182 devices_kobj = device->fs_info->fs_devices->devices_kobj; in btrfs_sysfs_add_device()
2183 devinfo_kobj = device->fs_info->fs_devices->devinfo_kobj; in btrfs_sysfs_add_device()
2189 if (device->bdev) { in btrfs_sysfs_add_device()
2190 struct kobject *disk_kobj = bdev_kobj(device->bdev); in btrfs_sysfs_add_device()
2194 btrfs_warn(device->fs_info, in btrfs_sysfs_add_device()
2196 device->devid, ret); in btrfs_sysfs_add_device()
2201 init_completion(&device->kobj_unregister); in btrfs_sysfs_add_device()
2202 ret = kobject_init_and_add(&device->devid_kobj, &devid_ktype, in btrfs_sysfs_add_device()
2203 devinfo_kobj, "%llu", device->devid); in btrfs_sysfs_add_device()
2205 kobject_put(&device->devid_kobj); in btrfs_sysfs_add_device()
2206 btrfs_warn(device->fs_info, in btrfs_sysfs_add_device()
2208 device->devid, ret); in btrfs_sysfs_add_device()
2219 struct btrfs_device *device; in btrfs_sysfs_add_fs_devices() local
2222 list_for_each_entry(device, &fs_devices->devices, dev_list) { in btrfs_sysfs_add_fs_devices()
2223 ret = btrfs_sysfs_add_device(device); in btrfs_sysfs_add_fs_devices()
2229 list_for_each_entry(device, &seed->devices, dev_list) { in btrfs_sysfs_add_fs_devices()
2230 ret = btrfs_sysfs_add_device(device); in btrfs_sysfs_add_fs_devices()
2269 void btrfs_sysfs_update_devid(struct btrfs_device *device) in btrfs_sysfs_update_devid() argument
2273 snprintf(tmp, sizeof(tmp), "%llu", device->devid); in btrfs_sysfs_update_devid()
2275 if (kobject_rename(&device->devid_kobj, tmp)) in btrfs_sysfs_update_devid()
2276 btrfs_warn(device->fs_devices->fs_info, in btrfs_sysfs_update_devid()
2278 device->devid); in btrfs_sysfs_update_devid()