Lines Matching refs:snapshot
62 struct devlink_snapshot *snapshot;
64 list_for_each_entry(snapshot, ®ion->snapshot_list, list)
65 if (snapshot->id == id)
66 return snapshot;
73 struct devlink_snapshot *snapshot)
82 err = nla_put_u32(msg, DEVLINK_ATTR_REGION_SNAPSHOT_ID, snapshot->id);
98 struct devlink_snapshot *snapshot;
107 list_for_each_entry(snapshot, ®ion->snapshot_list, list) {
108 err = devlink_nl_region_snapshot_id_put(msg, devlink, snapshot);
173 struct devlink_snapshot *snapshot,
207 if (snapshot) {
209 snapshot->id);
230 struct devlink_snapshot *snapshot,
240 msg = devlink_nl_region_notify_build(region, snapshot, cmd, 0, 0);
267 * @id: the snapshot id
269 * Track when a new snapshot begins using an id. Load the count for the
270 * given id from the snapshot xarray, increment it, and store it back.
272 * Called when a new snapshot is created with the given id.
310 * @id: the snapshot id
312 * Track when a snapshot is deleted and stops using an id. Load the count
313 * for the given id from the snapshot xarray, decrement it, and store it
319 * Called when a snapshot using the given id is deleted, and when the
350 * __devlink_snapshot_id_insert - Insert a specific snapshot ID
352 * @id: the snapshot id
354 * Mark the given snapshot id as used by inserting a zero value into the
355 * snapshot xarray.
362 * Returns zero on success, or an error code if the snapshot id could not
381 * __devlink_region_snapshot_id_get - get snapshot ID
383 * @id: storage to return snapshot id
385 * Allocates a new snapshot id. Returns zero on success, or a negative
390 * users of the snapshot id.
394 * snapshot by using devlink_region_snapshot_id_put.
403 * __devlink_region_snapshot_create - create a new snapshot
404 * This will add a new snapshot of a region. The snapshot
410 * Must be called only while holding the region snapshot lock.
412 * @region: devlink region of the snapshot
413 * @data: snapshot data
414 * @snapshot_id: snapshot id to be created
421 struct devlink_snapshot *snapshot;
426 /* check if region can hold one more snapshot */
433 snapshot = kzalloc(sizeof(*snapshot), GFP_KERNEL);
434 if (!snapshot)
441 snapshot->id = snapshot_id;
442 snapshot->region = region;
443 snapshot->data = data;
445 list_add_tail(&snapshot->list, ®ion->snapshot_list);
449 devlink_nl_region_notify(region, snapshot, DEVLINK_CMD_REGION_NEW);
453 kfree(snapshot);
458 struct devlink_snapshot *snapshot)
464 devlink_nl_region_notify(region, snapshot, DEVLINK_CMD_REGION_DEL);
466 list_del(&snapshot->list);
467 region->ops->destructor(snapshot->data);
468 __devlink_snapshot_id_decrement(devlink, snapshot->id);
469 kfree(snapshot);
594 struct devlink_snapshot *snapshot;
625 snapshot = devlink_region_snapshot_get_by_id(region, snapshot_id);
626 if (!snapshot) {
631 devlink_region_snapshot_del(region, snapshot);
639 struct devlink_snapshot *snapshot;
674 if (!region->ops->snapshot) {
675 NL_SET_ERR_MSG(info->extack, "The requested region does not support taking an immediate snapshot");
692 NL_SET_ERR_MSG(info->extack, "The requested snapshot id is already in use");
703 NL_SET_ERR_MSG(info->extack, "Failed to allocate a new snapshot id");
709 err = region->port_ops->snapshot(port, region->port_ops,
712 err = region->ops->snapshot(devlink, region->ops,
724 snapshot = devlink_region_snapshot_get_by_id(region,
726 if (WARN_ON(!snapshot)) {
731 msg = devlink_nl_region_notify_build(region, snapshot,
755 devlink_region_snapshot_del(region, snapshot);
839 struct devlink_snapshot *snapshot = cb_priv;
841 memcpy(chunk, &snapshot->data[curr_offset], chunk_size);
923 NL_SET_ERR_MSG(cb->extack, "No snapshot id provided");
940 struct devlink_snapshot *snapshot;
944 NL_SET_ERR_MSG_ATTR(cb->extack, snapshot_attr, "Direct region read does not use snapshot");
950 snapshot = devlink_region_snapshot_get_by_id(region, snapshot_id);
951 if (!snapshot) {
952 NL_SET_ERR_MSG_ATTR(cb->extack, snapshot_attr, "Requested snapshot does not exist");
957 region_cb_priv = snapshot;
1166 struct devlink_snapshot *snapshot, *ts;
1172 list_for_each_entry_safe(snapshot, ts, ®ion->snapshot_list, list)
1173 devlink_region_snapshot_del(region, snapshot);
1202 * devlink_region_snapshot_id_get - get snapshot ID
1204 * This callback should be called when adding a new snapshot,
1223 * devlink_region_snapshot_id_put - put snapshot ID reference
1239 * devlink_region_snapshot_create - create a new snapshot
1240 * This will add a new snapshot of a region. The snapshot
1246 * @region: devlink region of the snapshot
1247 * @data: snapshot data
1248 * @snapshot_id: snapshot id to be created