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()
748 pe->snap = s; in alloc_pending_exception()
755 struct dm_snapshot *s = pe->snap; in free_pending_exception()
857 struct dm_snapshot *snap; in __minimum_chunk_size() local
861 list_for_each_entry(snap, &o->snapshots, list) in __minimum_chunk_size()
863 snap->store->chunk_size); in __minimum_chunk_size()
1455 snap_dest->store->snap = snap_dest; in __handover_exceptions()
1456 snap_src->store->snap = snap_src; in __handover_exceptions()
1647 struct dm_snapshot *s = pe->snap; in pending_complete()
1733 struct dm_snapshot *s = pe->snap; in complete_exception()
1747 struct dm_snapshot *s = pe->snap; in copy_callback()
1796 struct dm_snapshot *s = pe->snap; in start_copy()
1826 struct dm_snapshot *s = pe->snap; in start_full_bio()
2319 struct dm_snapshot *snap = ti->private; in snapshot_status() local
2325 down_write(&snap->lock); in snapshot_status()
2327 if (!snap->valid) in snapshot_status()
2329 else if (snap->merge_failed) in snapshot_status()
2331 else if (snap->snapshot_overflowed) in snapshot_status()
2334 if (snap->store->type->usage) { in snapshot_status()
2337 snap->store->type->usage(snap->store, in snapshot_status()
2349 up_write(&snap->lock); in snapshot_status()
2359 DMEMIT("%s %s", snap->origin->name, snap->cow->name); in snapshot_status()
2360 sz += snap->store->type->status(snap->store, type, result + sz, in snapshot_status()
2362 num_features = snap->discard_zeroes_cow + snap->discard_passdown_origin; in snapshot_status()
2365 if (snap->discard_zeroes_cow) in snapshot_status()
2367 if (snap->discard_passdown_origin) in snapshot_status()
2374 DMEMIT(",snap_origin_name=%s", snap->origin->name); in snapshot_status()
2375 DMEMIT(",snap_cow_name=%s", snap->cow->name); in snapshot_status()
2376 DMEMIT(",snap_valid=%c", snap->valid ? 'y' : 'n'); in snapshot_status()
2377 DMEMIT(",snap_merge_failed=%c", snap->merge_failed ? 'y' : 'n'); in snapshot_status()
2378 DMEMIT(",snapshot_overflowed=%c", snap->snapshot_overflowed ? 'y' : 'n'); in snapshot_status()
2387 struct dm_snapshot *snap = ti->private; in snapshot_iterate_devices() local
2390 r = fn(ti, snap->origin, 0, ti->len, data); in snapshot_iterate_devices()
2393 r = fn(ti, snap->cow, 0, get_dev_size(snap->cow->bdev), data); in snapshot_iterate_devices()
2400 struct dm_snapshot *snap = ti->private; in snapshot_io_hints() local
2402 if (snap->discard_zeroes_cow) { in snapshot_io_hints()
2407 (void) __find_snapshots_sharing_cow(snap, &snap_src, &snap_dest, NULL); in snapshot_io_hints()
2409 snap = snap_src; in snapshot_io_hints()
2412 limits->discard_granularity = snap->store->chunk_size; in snapshot_io_hints()
2413 limits->max_discard_sectors = snap->store->chunk_size; in snapshot_io_hints()
2438 struct dm_snapshot *snap; in __origin_write() local
2447 list_for_each_entry(snap, snapshots, list) { in __origin_write()
2452 if (dm_target_is_snapshot_merge(snap->ti)) in __origin_write()
2456 if (sector >= dm_table_get_size(snap->ti->table)) in __origin_write()
2463 chunk = sector_to_chunk(snap->store, sector); in __origin_write()
2464 dm_exception_table_lock_init(snap, chunk, &lock); in __origin_write()
2466 down_read(&snap->lock); in __origin_write()
2470 if (!snap->valid || !snap->active) in __origin_write()
2473 pe = __lookup_pending_exception(snap, chunk); in __origin_write()
2480 e = dm_lookup_exception(&snap->complete, chunk); in __origin_write()
2485 pe = alloc_pending_exception(snap); in __origin_write()
2488 pe2 = __lookup_pending_exception(snap, chunk); in __origin_write()
2491 e = dm_lookup_exception(&snap->complete, chunk); in __origin_write()
2497 pe = __insert_pending_exception(snap, pe, chunk); in __origin_write()
2500 up_read(&snap->lock); in __origin_write()
2502 invalidate_snapshot(snap, -ENOMEM); in __origin_write()
2535 up_read(&snap->lock); in __origin_write()