Lines Matching refs:snap

215 	struct dm_snapshot *snap;  member
453 static int __find_snapshots_sharing_cow(struct dm_snapshot *snap, in __find_snapshots_sharing_cow() argument
463 o = __lookup_origin(snap->origin->bdev); in __find_snapshots_sharing_cow()
470 if (!bdev_equal(s->cow->bdev, snap->cow->bdev)) in __find_snapshots_sharing_cow()
494 static int __validate_exception_handover(struct dm_snapshot *snap) in __validate_exception_handover() argument
500 if ((__find_snapshots_sharing_cow(snap, &snap_src, &snap_dest, in __validate_exception_handover()
503 snap->ti->error = "Snapshot cow pairing for exception table handover failed"; in __validate_exception_handover()
517 if (!dm_target_is_snapshot_merge(snap->ti)) in __validate_exception_handover()
524 snap->ti->error = "A snapshot is already merging."; in __validate_exception_handover()
530 snap->ti->error = "Snapshot exception store does not support snapshot-merge."; in __validate_exception_handover()
556 static int register_snapshot(struct dm_snapshot *snap) in register_snapshot() argument
559 struct block_device *bdev = snap->origin->bdev; in register_snapshot()
568 r = __validate_exception_handover(snap); in register_snapshot()
588 __insert_snapshot(o, snap); in register_snapshot()
755 pe->snap = s; in alloc_pending_exception()
762 struct dm_snapshot *s = pe->snap; in free_pending_exception()
852 struct dm_snapshot *snap; in __minimum_chunk_size() local
856 list_for_each_entry(snap, &o->snapshots, list) in __minimum_chunk_size()
858 snap->store->chunk_size); in __minimum_chunk_size()
1450 snap_dest->store->snap = snap_dest; in __handover_exceptions()
1451 snap_src->store->snap = snap_src; in __handover_exceptions()
1642 struct dm_snapshot *s = pe->snap; in pending_complete()
1728 struct dm_snapshot *s = pe->snap; in complete_exception()
1742 struct dm_snapshot *s = pe->snap; in copy_callback()
1791 struct dm_snapshot *s = pe->snap; in start_copy()
1821 struct dm_snapshot *s = pe->snap; in start_full_bio()
2314 struct dm_snapshot *snap = ti->private; in snapshot_status() local
2320 down_write(&snap->lock); in snapshot_status()
2322 if (!snap->valid) in snapshot_status()
2324 else if (snap->merge_failed) in snapshot_status()
2326 else if (snap->snapshot_overflowed) in snapshot_status()
2329 if (snap->store->type->usage) { in snapshot_status()
2332 snap->store->type->usage(snap->store, in snapshot_status()
2344 up_write(&snap->lock); in snapshot_status()
2354 DMEMIT("%s %s", snap->origin->name, snap->cow->name); in snapshot_status()
2355 sz += snap->store->type->status(snap->store, type, result + sz, in snapshot_status()
2357 num_features = snap->discard_zeroes_cow + snap->discard_passdown_origin; in snapshot_status()
2360 if (snap->discard_zeroes_cow) in snapshot_status()
2362 if (snap->discard_passdown_origin) in snapshot_status()
2369 DMEMIT(",snap_origin_name=%s", snap->origin->name); in snapshot_status()
2370 DMEMIT(",snap_cow_name=%s", snap->cow->name); in snapshot_status()
2371 DMEMIT(",snap_valid=%c", snap->valid ? 'y' : 'n'); in snapshot_status()
2372 DMEMIT(",snap_merge_failed=%c", snap->merge_failed ? 'y' : 'n'); in snapshot_status()
2373 DMEMIT(",snapshot_overflowed=%c", snap->snapshot_overflowed ? 'y' : 'n'); in snapshot_status()
2382 struct dm_snapshot *snap = ti->private; in snapshot_iterate_devices() local
2385 r = fn(ti, snap->origin, 0, ti->len, data); in snapshot_iterate_devices()
2388 r = fn(ti, snap->cow, 0, get_dev_size(snap->cow->bdev), data); in snapshot_iterate_devices()
2395 struct dm_snapshot *snap = ti->private; in snapshot_io_hints() local
2397 if (snap->discard_zeroes_cow) { in snapshot_io_hints()
2402 (void) __find_snapshots_sharing_cow(snap, &snap_src, &snap_dest, NULL); in snapshot_io_hints()
2404 snap = snap_src; in snapshot_io_hints()
2407 limits->discard_granularity = snap->store->chunk_size; in snapshot_io_hints()
2408 limits->max_hw_discard_sectors = snap->store->chunk_size; in snapshot_io_hints()
2433 struct dm_snapshot *snap; in __origin_write() local
2442 list_for_each_entry(snap, snapshots, list) { in __origin_write()
2447 if (dm_target_is_snapshot_merge(snap->ti)) in __origin_write()
2451 if (sector >= dm_table_get_size(snap->ti->table)) in __origin_write()
2458 chunk = sector_to_chunk(snap->store, sector); in __origin_write()
2459 dm_exception_table_lock_init(snap, chunk, &lock); in __origin_write()
2461 down_read(&snap->lock); in __origin_write()
2465 if (!snap->valid || !snap->active) in __origin_write()
2468 pe = __lookup_pending_exception(snap, chunk); in __origin_write()
2475 e = dm_lookup_exception(&snap->complete, chunk); in __origin_write()
2480 pe = alloc_pending_exception(snap); in __origin_write()
2483 pe2 = __lookup_pending_exception(snap, chunk); in __origin_write()
2486 e = dm_lookup_exception(&snap->complete, chunk); in __origin_write()
2492 pe = __insert_pending_exception(snap, pe, chunk); in __origin_write()
2495 up_read(&snap->lock); in __origin_write()
2497 invalidate_snapshot(snap, -ENOMEM); in __origin_write()
2530 up_read(&snap->lock); in __origin_write()