Skip to content

Commit b316c4a

Browse files
committed
feat(snapshot): snapshot tree query optimization
Signed-off-by: Hrudaya <hrudayaranjan.sahoo@datacore.com>
1 parent 5d698d7 commit b316c4a

File tree

6 files changed

+220
-157
lines changed

6 files changed

+220
-157
lines changed

io-engine/src/core/snapshot.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ pub trait SnapshotOps {
235235
fn list_snapshot_by_snapshot_uuid(&self) -> Vec<VolumeSnapshotDescriptor>;
236236

237237
/// List All Snapshot.
238-
fn list_all_snapshots() -> Vec<VolumeSnapshotDescriptor>;
238+
fn list_all_snapshots(
239+
parent_lvol: Option<&Lvol>,
240+
) -> Vec<VolumeSnapshotDescriptor>;
239241

240242
/// Create snapshot clone.
241243
async fn create_clone(
@@ -350,13 +352,17 @@ pub trait SnapshotOps {
350352
total_ancestor_snap_size: u64,
351353
) -> Option<u64>;
352354

353-
/// When snapshot is destroyed, reset the parent lvol usage cache and its
354-
/// successor snapshot and clone usage cache.
355-
fn reset_snapshot_parent_successor_usage_cache(&self);
355+
/// When snapshot is destroyed, if snapshot parent exist, reset cache of
356+
/// linked snapshot and clone tree based on snapshot parent.
357+
fn reset_snapshot_tree_usage_cache_with_parent_uuid(&self);
356358

357-
/// When snapshot is destroyed, reset cache of successor snapshots and
358-
/// clones based on snapshot parent uuid.
359-
fn reset_successor_lvol_usage_cache(&self, snapshot_parent_uuid: String);
359+
/// When snapshot is destroyed, if snapshot parent not exist, reset cache of
360+
/// linked snapshot and clone tree based on wildcard search through complete
361+
/// bdev by matching parent uuid got from snapshot attribute.
362+
fn reset_snapshot_tree_usage_cache_with_wildcard(
363+
&self,
364+
snapshot_parent_uuid: String,
365+
);
360366
}
361367

362368
/// Traits gives the Snapshots Related Parameters.

io-engine/src/grpc/v1/replica.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ impl From<LvolSpaceUsage> for ReplicaSpaceUsage {
111111
impl From<Lvol> for Replica {
112112
fn from(l: Lvol) -> Self {
113113
let usage = l.usage();
114-
let source_uuid =
115-
Lvol::get_blob_xattr(&l, CloneXattrs::SourceUuid.name());
114+
let source_uuid = Lvol::get_blob_xattr(
115+
l.blob_checked(),
116+
CloneXattrs::SourceUuid.name(),
117+
);
116118
Self {
117119
name: l.name(),
118120
uuid: l.uuid(),

io-engine/src/grpc/v1/snapshot.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ impl SnapshotRpc for SnapshotService {
510510
} else {
511511
// if source_uuid is not input, list all snapshot
512512
// present in system
513-
snapshots = Lvol::list_all_snapshots()
513+
snapshots = Lvol::list_all_snapshots(None)
514514
.into_iter()
515515
.map(SnapshotInfo::from)
516516
.collect();

0 commit comments

Comments
 (0)