Lines Matching refs:snap
214 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 " in __validate_exception_handover()
513 if (!dm_target_is_snapshot_merge(snap->ti)) in __validate_exception_handover()
520 snap->ti->error = "A snapshot is already merging."; in __validate_exception_handover()
526 snap->ti->error = "Snapshot exception store does not " in __validate_exception_handover()
553 static int register_snapshot(struct dm_snapshot *snap) in register_snapshot() argument
556 struct block_device *bdev = snap->origin->bdev; in register_snapshot()
565 r = __validate_exception_handover(snap); in register_snapshot()
585 __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()
1473 snap_dest->store->snap = snap_dest; in __handover_exceptions()
1474 snap_src->store->snap = snap_src; in __handover_exceptions()
1666 struct dm_snapshot *s = pe->snap; in pending_complete()
1752 struct dm_snapshot *s = pe->snap; in complete_exception()
1766 struct dm_snapshot *s = pe->snap; in copy_callback()
1815 struct dm_snapshot *s = pe->snap; in start_copy()
1845 struct dm_snapshot *s = pe->snap; in start_full_bio()
2340 struct dm_snapshot *snap = ti->private; in snapshot_status() local
2346 down_write(&snap->lock); in snapshot_status()
2348 if (!snap->valid) in snapshot_status()
2350 else if (snap->merge_failed) in snapshot_status()
2352 else if (snap->snapshot_overflowed) in snapshot_status()
2355 if (snap->store->type->usage) { in snapshot_status()
2358 snap->store->type->usage(snap->store, in snapshot_status()
2371 up_write(&snap->lock); in snapshot_status()
2381 DMEMIT("%s %s", snap->origin->name, snap->cow->name); in snapshot_status()
2382 sz += snap->store->type->status(snap->store, type, result + sz, in snapshot_status()
2384 num_features = snap->discard_zeroes_cow + snap->discard_passdown_origin; in snapshot_status()
2387 if (snap->discard_zeroes_cow) in snapshot_status()
2389 if (snap->discard_passdown_origin) in snapshot_status()
2396 DMEMIT(",snap_origin_name=%s", snap->origin->name); in snapshot_status()
2397 DMEMIT(",snap_cow_name=%s", snap->cow->name); in snapshot_status()
2398 DMEMIT(",snap_valid=%c", snap->valid ? 'y' : 'n'); in snapshot_status()
2399 DMEMIT(",snap_merge_failed=%c", snap->merge_failed ? 'y' : 'n'); in snapshot_status()
2400 DMEMIT(",snapshot_overflowed=%c", snap->snapshot_overflowed ? 'y' : 'n'); in snapshot_status()
2409 struct dm_snapshot *snap = ti->private; in snapshot_iterate_devices() local
2412 r = fn(ti, snap->origin, 0, ti->len, data); in snapshot_iterate_devices()
2415 r = fn(ti, snap->cow, 0, get_dev_size(snap->cow->bdev), data); in snapshot_iterate_devices()
2422 struct dm_snapshot *snap = ti->private; in snapshot_io_hints() local
2424 if (snap->discard_zeroes_cow) { in snapshot_io_hints()
2429 (void) __find_snapshots_sharing_cow(snap, &snap_src, &snap_dest, NULL); in snapshot_io_hints()
2431 snap = snap_src; in snapshot_io_hints()
2434 limits->discard_granularity = snap->store->chunk_size; in snapshot_io_hints()
2435 limits->max_discard_sectors = snap->store->chunk_size; in snapshot_io_hints()
2459 struct dm_snapshot *snap; in __origin_write() local
2468 list_for_each_entry (snap, snapshots, list) { in __origin_write()
2473 if (dm_target_is_snapshot_merge(snap->ti)) in __origin_write()
2477 if (sector >= dm_table_get_size(snap->ti->table)) in __origin_write()
2484 chunk = sector_to_chunk(snap->store, sector); in __origin_write()
2485 dm_exception_table_lock_init(snap, chunk, &lock); in __origin_write()
2487 down_read(&snap->lock); in __origin_write()
2491 if (!snap->valid || !snap->active) in __origin_write()
2494 pe = __lookup_pending_exception(snap, chunk); in __origin_write()
2501 e = dm_lookup_exception(&snap->complete, chunk); in __origin_write()
2506 pe = alloc_pending_exception(snap); in __origin_write()
2509 pe2 = __lookup_pending_exception(snap, chunk); in __origin_write()
2512 e = dm_lookup_exception(&snap->complete, chunk); in __origin_write()
2518 pe = __insert_pending_exception(snap, pe, chunk); in __origin_write()
2521 up_read(&snap->lock); in __origin_write()
2523 invalidate_snapshot(snap, -ENOMEM); in __origin_write()
2556 up_read(&snap->lock); in __origin_write()