From: Denis V. Lunev Date: Mon, 11 May 2026 21:55:24 +0000 (+0200) Subject: virStorageSource: note that capacity/allocation/physical are stale caches X-Git-Tag: v12.4.0-rc1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b32fbdfca38fe341a1c1e1697a2bed789e9dc6f;p=thirdparty%2Flibvirt.git virStorageSource: note that capacity/allocation/physical are stale caches These three fields are cached values that do not reflect reality unless the caller refreshes them. 'allocation' is in addition ultra-unreliable: any guest write into a previously unallocated part of a sparse image invalidates it, even right after a refresh. Document this on the struct so new callers do not trust the values. Signed-off-by: Denis V. Lunev Reviewed-by: Peter Krempa --- diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index 5ddcebb282..fa71a9ef39 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -326,6 +326,8 @@ struct _virStorageSource { virStoragePerms *perms; virStorageTimestamps *timestamps; + + /* Cached, unreliable. Refresh before use. */ unsigned long long capacity; /* in bytes, 0 if unknown */ unsigned long long allocation; /* in bytes, 0 if unknown */ unsigned long long physical; /* in bytes, 0 if unknown */