Lines Matching refs:snap
210 struct dm_snapshot *snap; member
448 static int __find_snapshots_sharing_cow(struct dm_snapshot *snap, in __find_snapshots_sharing_cow() argument
458 o = __lookup_origin(snap->origin->bdev); in __find_snapshots_sharing_cow()
465 if (!bdev_equal(s->cow->bdev, snap->cow->bdev)) in __find_snapshots_sharing_cow()
489 static int __validate_exception_handover(struct dm_snapshot *snap) in __validate_exception_handover() argument
495 if ((__find_snapshots_sharing_cow(snap, &snap_src, &snap_dest, in __validate_exception_handover()
498 snap->ti->error = "Snapshot cow pairing for exception table handover failed"; in __validate_exception_handover()
512 if (!dm_target_is_snapshot_merge(snap->ti)) in __validate_exception_handover()
519 snap->ti->error = "A snapshot is already merging."; in __validate_exception_handover()
525 snap->ti->error = "Snapshot exception store does not support snapshot-merge."; in __validate_exception_handover()
551 static int register_snapshot(struct dm_snapshot *snap) in register_snapshot() argument
554 struct block_device *bdev = snap->origin->bdev; in register_snapshot()
563 r = __validate_exception_handover(snap); in register_snapshot()
583 __insert_snapshot(o, snap); in register_snapshot()
746 pe->snap = s; in alloc_pending_exception()
753 struct dm_snapshot *s = pe->snap; in free_pending_exception()
855 struct dm_snapshot *snap; in __minimum_chunk_size() local
859 list_for_each_entry(snap, &o->snapshots, list) in __minimum_chunk_size()
861 snap->store->chunk_size); in __minimum_chunk_size()
1453 snap_dest->store->snap = snap_dest; in __handover_exceptions()
1454 snap_src->store->snap = snap_src; in __handover_exceptions()
1645 struct dm_snapshot *s = pe->snap; in pending_complete()
1731 struct dm_snapshot *s = pe->snap; in complete_exception()
1745 struct dm_snapshot *s = pe->snap; in copy_callback()
1794 struct dm_snapshot *s = pe->snap; in start_copy()
1824 struct dm_snapshot *s = pe->snap; in start_full_bio()
2317 struct dm_snapshot *snap = ti->private; in snapshot_status() local
2323 down_write(&snap->lock); in snapshot_status()
2325 if (!snap->valid) in snapshot_status()
2327 else if (snap->merge_failed) in snapshot_status()
2329 else if (snap->snapshot_overflowed) in snapshot_status()
2332 if (snap->store->type->usage) { in snapshot_status()
2335 snap->store->type->usage(snap->store, in snapshot_status()
2347 up_write(&snap->lock); in snapshot_status()
2357 DMEMIT("%s %s", snap->origin->name, snap->cow->name); in snapshot_status()
2358 sz += snap->store->type->status(snap->store, type, result + sz, in snapshot_status()
2360 num_features = snap->discard_zeroes_cow + snap->discard_passdown_origin; in snapshot_status()
2363 if (snap->discard_zeroes_cow) in snapshot_status()
2365 if (snap->discard_passdown_origin) in snapshot_status()
2372 DMEMIT(",snap_origin_name=%s", snap->origin->name); in snapshot_status()
2373 DMEMIT(",snap_cow_name=%s", snap->cow->name); in snapshot_status()
2374 DMEMIT(",snap_valid=%c", snap->valid ? 'y' : 'n'); in snapshot_status()
2375 DMEMIT(",snap_merge_failed=%c", snap->merge_failed ? 'y' : 'n'); in snapshot_status()
2376 DMEMIT(",snapshot_overflowed=%c", snap->snapshot_overflowed ? 'y' : 'n'); in snapshot_status()
2385 struct dm_snapshot *snap = ti->private; in snapshot_iterate_devices() local
2388 r = fn(ti, snap->origin, 0, ti->len, data); in snapshot_iterate_devices()
2391 r = fn(ti, snap->cow, 0, get_dev_size(snap->cow->bdev), data); in snapshot_iterate_devices()
2398 struct dm_snapshot *snap = ti->private; in snapshot_io_hints() local
2400 if (snap->discard_zeroes_cow) { in snapshot_io_hints()
2405 (void) __find_snapshots_sharing_cow(snap, &snap_src, &snap_dest, NULL); in snapshot_io_hints()
2407 snap = snap_src; in snapshot_io_hints()
2410 limits->discard_granularity = snap->store->chunk_size; in snapshot_io_hints()
2411 limits->max_discard_sectors = snap->store->chunk_size; in snapshot_io_hints()
2436 struct dm_snapshot *snap; in __origin_write() local
2445 list_for_each_entry(snap, snapshots, list) { in __origin_write()
2450 if (dm_target_is_snapshot_merge(snap->ti)) in __origin_write()
2454 if (sector >= dm_table_get_size(snap->ti->table)) in __origin_write()
2461 chunk = sector_to_chunk(snap->store, sector); in __origin_write()
2462 dm_exception_table_lock_init(snap, chunk, &lock); in __origin_write()
2464 down_read(&snap->lock); in __origin_write()
2468 if (!snap->valid || !snap->active) in __origin_write()
2471 pe = __lookup_pending_exception(snap, chunk); in __origin_write()
2478 e = dm_lookup_exception(&snap->complete, chunk); in __origin_write()
2483 pe = alloc_pending_exception(snap); in __origin_write()
2486 pe2 = __lookup_pending_exception(snap, chunk); in __origin_write()
2489 e = dm_lookup_exception(&snap->complete, chunk); in __origin_write()
2495 pe = __insert_pending_exception(snap, pe, chunk); in __origin_write()
2498 up_read(&snap->lock); in __origin_write()
2500 invalidate_snapshot(snap, -ENOMEM); in __origin_write()
2533 up_read(&snap->lock); in __origin_write()