Lines Matching refs:resource

234 		adm_ctx->resource = drbd_find_resource(adm_ctx->resource_name);  in drbd_adm_prepare()
241 if (!adm_ctx->resource && (flags & DRBD_ADM_NEED_RESOURCE)) { in drbd_adm_prepare()
249 if (adm_ctx->resource) { in drbd_adm_prepare()
269 if (adm_ctx->device && adm_ctx->resource && in drbd_adm_prepare()
270 adm_ctx->device->resource != adm_ctx->resource) { in drbd_adm_prepare()
272 adm_ctx->minor, adm_ctx->resource->name, in drbd_adm_prepare()
273 adm_ctx->device->resource->name); in drbd_adm_prepare()
282 adm_ctx->device->vnr, adm_ctx->device->resource->name); in drbd_adm_prepare()
288 if (!adm_ctx->resource) { in drbd_adm_prepare()
289 adm_ctx->resource = adm_ctx->device ? adm_ctx->device->resource in drbd_adm_prepare()
290 : adm_ctx->connection ? adm_ctx->connection->resource : NULL; in drbd_adm_prepare()
291 if (adm_ctx->resource) in drbd_adm_prepare()
292 kref_get(&adm_ctx->resource->kref); in drbd_adm_prepare()
314 if (adm_ctx->resource) { in drbd_adm_finish()
315 kref_put(&adm_ctx->resource->kref, drbd_destroy_resource); in drbd_adm_finish()
316 adm_ctx->resource = NULL; in drbd_adm_finish()
414 char *resource_name = connection->resource->name; in conn_khelper()
464 static bool resource_is_supended(struct drbd_resource *resource) in resource_is_supended() argument
466 return resource->susp || resource->susp_fen || resource->susp_nod; in resource_is_supended()
471 struct drbd_resource * const resource = connection->resource; in conn_try_outdate_peer() local
479 spin_lock_irq(&resource->req_lock); in conn_try_outdate_peer()
482 spin_unlock_irq(&resource->req_lock); in conn_try_outdate_peer()
487 spin_unlock_irq(&resource->req_lock); in conn_try_outdate_peer()
493 spin_lock_irq(&resource->req_lock); in conn_try_outdate_peer()
502 if (!resource_is_supended(resource)) in conn_try_outdate_peer()
511 spin_unlock_irq(&resource->req_lock); in conn_try_outdate_peer()
572 spin_lock_irq(&resource->req_lock); in conn_try_outdate_peer()
581 spin_unlock_irq(&resource->req_lock); in conn_try_outdate_peer()
632 for_each_connection(connection, device->resource) in drbd_set_role()
724 mutex_lock(&device->resource->conf_update); in drbd_set_role()
728 mutex_unlock(&device->resource->conf_update); in drbd_set_role()
790 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_set_role()
799 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_set_role()
1430 spin_lock_irq(&connection->resource->req_lock); in conn_reconfig_done()
1433 spin_unlock_irq(&connection->resource->req_lock); in conn_reconfig_done()
1453 spin_lock_irq(&device->resource->req_lock); in drbd_suspend_al()
1456 spin_unlock_irq(&device->resource->req_lock); in drbd_suspend_al()
1582 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_disk_opts()
1597 mutex_lock(&device->resource->conf_update); in drbd_adm_disk_opts()
1654 mutex_unlock(&device->resource->conf_update); in drbd_adm_disk_opts()
1667 drbd_bump_write_ordering(device->resource, NULL, WO_BDEV_FLUSH); in drbd_adm_disk_opts()
1689 mutex_unlock(&device->resource->conf_update); in drbd_adm_disk_opts()
1696 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_disk_opts()
1810 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_attach()
2043 drbd_bump_write_ordering(device->resource, device->ldev, WO_BDEV_FLUSH); in drbd_adm_attach()
2052 !(device->state.role == R_PRIMARY && device->resource->susp_nod)) in drbd_adm_attach()
2110 spin_lock_irq(&device->resource->req_lock); in drbd_adm_attach()
2162 spin_unlock_irq(&device->resource->req_lock); in drbd_adm_attach()
2180 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_attach()
2199 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_attach()
2243 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_detach()
2245 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_detach()
2437 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_net_opts()
2448 mutex_lock(&connection->resource->conf_update); in drbd_adm_net_opts()
2512 mutex_unlock(&connection->resource->conf_update); in drbd_adm_net_opts()
2528 mutex_unlock(&connection->resource->conf_update); in drbd_adm_net_opts()
2535 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_net_opts()
2570 struct drbd_resource *resource; in drbd_adm_connect() local
2591 for_each_resource(resource, &drbd_resources) { in drbd_adm_connect()
2592 for_each_connection(connection, resource) { in drbd_adm_connect()
2609 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_connect()
2610 connection = first_connection(adm_ctx.resource); in drbd_adm_connect()
2646 mutex_lock(&adm_ctx.resource->conf_update); in drbd_adm_connect()
2650 mutex_unlock(&adm_ctx.resource->conf_update); in drbd_adm_connect()
2682 mutex_unlock(&adm_ctx.resource->conf_update); in drbd_adm_connect()
2696 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_connect()
2705 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_connect()
2734 spin_lock_irq(&connection->resource->req_lock); in conn_try_disconnect()
2736 spin_unlock_irq(&connection->resource->req_lock); in conn_try_disconnect()
2803 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_disconnect()
2809 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_disconnect()
2850 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_resize()
2922 mutex_lock(&device->resource->conf_update); in drbd_adm_resize()
2927 mutex_unlock(&device->resource->conf_update); in drbd_adm_resize()
2957 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_resize()
2981 res_opts = adm_ctx.resource->res_opts; in drbd_adm_resource_opts()
2992 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_resource_opts()
2993 err = set_resource_options(adm_ctx.resource, &res_opts); in drbd_adm_resource_opts()
2999 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_resource_opts()
3024 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_invalidate()
3047 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_invalidate()
3066 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_simple_request_state()
3068 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_simple_request_state()
3101 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_invalidate_peer()
3127 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_invalidate_peer()
3145 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_pause_sync()
3148 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_pause_sync()
3166 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_resume_sync()
3176 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_resume_sync()
3199 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_resume_io()
3237 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_resume_io()
3249 struct drbd_resource *resource, in nla_put_drbd_cfg_context() argument
3260 if (nla_put_string(skb, T_ctx_resource_name, resource->name)) in nla_put_drbd_cfg_context()
3302 struct drbd_resource *resource; in drbd_adm_dump_resources() local
3309 for_each_resource_rcu(resource, &drbd_resources) in drbd_adm_dump_resources()
3310 if (resource == (struct drbd_resource *)cb->args[0]) in drbd_adm_dump_resources()
3315 resource = list_entry(&drbd_resources, in drbd_adm_dump_resources()
3319 list_for_each_entry_continue_rcu(resource, &drbd_resources, resources) { in drbd_adm_dump_resources()
3334 err = nla_put_drbd_cfg_context(skb, resource, NULL, NULL); in drbd_adm_dump_resources()
3337 err = res_opts_to_skb(skb, &resource->res_opts, !capable(CAP_SYS_ADMIN)); in drbd_adm_dump_resources()
3340 resource_to_info(&resource_info, resource); in drbd_adm_dump_resources()
3344 resource_statistics.res_stat_write_ordering = resource->write_ordering; in drbd_adm_dump_resources()
3348 cb->args[0] = (long)resource; in drbd_adm_dump_resources()
3396 struct drbd_resource *resource = in put_resource_in_arg0() local
3398 kref_put(&resource->kref, drbd_destroy_resource); in put_resource_in_arg0()
3413 struct drbd_resource *resource; in drbd_adm_dump_devices() local
3421 resource = (struct drbd_resource *)cb->args[0]; in drbd_adm_dump_devices()
3426 resource = drbd_find_resource(nla_data(resource_filter)); in drbd_adm_dump_devices()
3427 if (!resource) in drbd_adm_dump_devices()
3429 cb->args[0] = (long)resource; in drbd_adm_dump_devices()
3435 idr_to_search = resource ? &resource->devices : &drbd_devices; in drbd_adm_dump_devices()
3459 err = nla_put_drbd_cfg_context(skb, device->resource, NULL, device); in drbd_adm_dump_devices()
3502 struct drbd_resource *resource = NULL, *next_resource; in drbd_adm_dump_connections() local
3510 resource = (struct drbd_resource *)cb->args[0]; in drbd_adm_dump_connections()
3515 resource = drbd_find_resource(nla_data(resource_filter)); in drbd_adm_dump_connections()
3516 if (!resource) in drbd_adm_dump_connections()
3518 cb->args[0] = (long)resource; in drbd_adm_dump_connections()
3522 if (!resource) { in drbd_adm_dump_connections()
3525 resource = list_first_entry(&drbd_resources, struct drbd_resource, resources); in drbd_adm_dump_connections()
3526 kref_get(&resource->kref); in drbd_adm_dump_connections()
3527 cb->args[0] = (long)resource; in drbd_adm_dump_connections()
3533 mutex_lock(&resource->conf_update); in drbd_adm_dump_connections()
3536 for_each_connection_rcu(connection, resource) in drbd_adm_dump_connections()
3542 connection = list_entry(&resource->connections, struct drbd_connection, connections); in drbd_adm_dump_connections()
3545 list_for_each_entry_continue_rcu(connection, &resource->connections, connections) { in drbd_adm_dump_connections()
3555 if (next_resource == resource) in drbd_adm_dump_connections()
3564 mutex_unlock(&resource->conf_update); in drbd_adm_dump_connections()
3565 kref_put(&resource->kref, drbd_destroy_resource); in drbd_adm_dump_connections()
3566 resource = next_resource; in drbd_adm_dump_connections()
3567 kref_get(&resource->kref); in drbd_adm_dump_connections()
3568 cb->args[0] = (long)resource; in drbd_adm_dump_connections()
3586 err = nla_put_drbd_cfg_context(skb, resource, connection, NULL); in drbd_adm_dump_connections()
3610 if (resource) in drbd_adm_dump_connections()
3611 mutex_unlock(&resource->conf_update); in drbd_adm_dump_connections()
3664 struct drbd_resource *resource; in drbd_adm_dump_peer_devices() local
3671 resource = (struct drbd_resource *)cb->args[0]; in drbd_adm_dump_peer_devices()
3676 resource = drbd_find_resource(nla_data(resource_filter)); in drbd_adm_dump_peer_devices()
3677 if (!resource) in drbd_adm_dump_peer_devices()
3680 cb->args[0] = (long)resource; in drbd_adm_dump_peer_devices()
3685 idr_to_search = resource ? &resource->devices : &drbd_devices; in drbd_adm_dump_peer_devices()
3730 err = nla_put_drbd_cfg_context(skb, device->resource, peer_device->connection, device); in drbd_adm_dump_peer_devices()
3756 static struct drbd_connection *the_only_connection(struct drbd_resource *resource) in the_only_connection() argument
3758 struct list_head *connections = &resource->connections; in the_only_connection()
3762 return list_first_entry(&resource->connections, struct drbd_connection, connections); in the_only_connection()
3768 struct drbd_resource *resource = device->resource; in nla_put_status_info() local
3792 if (nla_put_drbd_cfg_context(skb, resource, the_only_connection(resource), device)) in nla_put_status_info()
3795 if (res_opts_to_skb(skb, &device->resource->res_opts, exclude_sensitive)) in nla_put_status_info()
3917 struct drbd_resource *resource = NULL; in get_one_status() local
3949 resource = pos; in get_one_status()
3953 resource = pos; in get_one_status()
3957 if (resource) { in get_one_status()
3959 device = idr_get_next(&resource->devices, &volume); in get_one_status()
3963 pos = list_entry_rcu(resource->resources.next, in get_one_status()
3973 resource = pos; in get_one_status()
3992 connection = the_only_connection(resource); in get_one_status()
3993 if (nla_put_drbd_cfg_context(skb, resource, connection, NULL)) in get_one_status()
4006 D_ASSERT(device, device->resource == resource); in get_one_status()
4024 cb->args[1] = (pos == resource) ? volume + 1 : 0; in get_one_status()
4046 struct drbd_resource *resource; in drbd_adm_get_status_all() local
4077 resource = drbd_find_resource(resource_name); in drbd_adm_get_status_all()
4078 if (!resource) in drbd_adm_get_status_all()
4081 kref_put(&resource->kref, drbd_destroy_resource); /* get_one_status() revalidates the resource */ in drbd_adm_get_status_all()
4085 cb->args[0] = (long)resource; in drbd_adm_get_status_all()
4087 cb->args[2] = (long)resource; in drbd_adm_get_status_all()
4147 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_start_ov()
4160 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_start_ov()
4193 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_new_c_uuid()
4226 spin_lock_irq(&device->resource->req_lock); in drbd_adm_new_c_uuid()
4229 spin_unlock_irq(&device->resource->req_lock); in drbd_adm_new_c_uuid()
4238 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_new_c_uuid()
4262 struct drbd_resource *resource) in resource_to_info() argument
4264 info->res_role = conn_highest_role(first_connection(resource)); in resource_to_info()
4265 info->res_susp = resource->susp; in resource_to_info()
4266 info->res_susp_nod = resource->susp_nod; in resource_to_info()
4267 info->res_susp_fen = resource->susp_fen; in resource_to_info()
4296 if (adm_ctx.resource) { in drbd_adm_new_resource()
4314 resource_to_info(&resource_info, connection->resource); in drbd_adm_new_resource()
4315 notify_resource_state(NULL, 0, connection->resource, in drbd_adm_new_resource()
4365 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_new_minor()
4397 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_new_minor()
4413 first_connection(device->resource); in adm_del_minor()
4451 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_del_minor()
4453 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_del_minor()
4459 static int adm_del_resource(struct drbd_resource *resource) in adm_del_resource() argument
4463 for_each_connection(connection, resource) { in adm_del_resource()
4467 if (!idr_is_empty(&resource->devices)) in adm_del_resource()
4474 notify_resource_state(NULL, 0, resource, NULL, NOTIFY_DESTROY); in adm_del_resource()
4478 list_del_rcu(&resource->resources); in adm_del_resource()
4482 list_for_each_entry(connection, &resource->connections, connections) in adm_del_resource()
4485 drbd_free_resource(resource); in adm_del_resource()
4492 struct drbd_resource *resource; in drbd_adm_down() local
4504 resource = adm_ctx.resource; in drbd_adm_down()
4505 mutex_lock(&resource->adm_mutex); in drbd_adm_down()
4507 for_each_connection(connection, resource) { in drbd_adm_down()
4526 idr_for_each_entry(&resource->devices, device, i) { in drbd_adm_down()
4535 idr_for_each_entry(&resource->devices, device, i) { in drbd_adm_down()
4544 retcode = adm_del_resource(resource); in drbd_adm_down()
4546 mutex_unlock(&resource->adm_mutex); in drbd_adm_down()
4555 struct drbd_resource *resource; in drbd_adm_del_resource() local
4563 resource = adm_ctx.resource; in drbd_adm_del_resource()
4565 mutex_lock(&resource->adm_mutex); in drbd_adm_del_resource()
4566 retcode = adm_del_resource(resource); in drbd_adm_del_resource()
4567 mutex_unlock(&resource->adm_mutex); in drbd_adm_del_resource()
4622 struct drbd_resource *resource, in notify_resource_state() argument
4646 if (nla_put_drbd_cfg_context(skb, resource, NULL, NULL) || in notify_resource_state()
4651 resource_statistics.res_stat_write_ordering = resource->write_ordering; in notify_resource_state()
4667 drbd_err(resource, "Error %d while broadcasting event. Event seq:%u\n", in notify_resource_state()
4697 if (nla_put_drbd_cfg_context(skb, device->resource, NULL, device) || in notify_device_state()
4746 if (nla_put_drbd_cfg_context(skb, connection->resource, connection, NULL) || in notify_connection_state()
4776 struct drbd_resource *resource = peer_device->device->resource; in notify_peer_device_state() local
4796 if (nla_put_drbd_cfg_context(skb, resource, peer_device->connection, peer_device->device) || in notify_peer_device_state()
4823 struct drbd_resource *resource = device ? device->resource : connection->resource; in notify_helper() local
4846 if (nla_put_drbd_cfg_context(skb, resource, connection, device) || in notify_helper()
4863 drbd_err(resource, "Error %d while broadcasting event. Event seq:%u\n", in notify_helper()
4927 notify_resource_state_change(skb, seq, state_change->resource, in get_initial_state()
4965 struct drbd_resource *resource; in drbd_adm_get_initial_state() local
4984 for_each_resource(resource, &drbd_resources) { in drbd_adm_get_initial_state()
4987 state_change = remember_old_state(resource, GFP_KERNEL); in drbd_adm_get_initial_state()