From 553a9cbdd8a392d1aa071eeb9c00b49555f60162 Mon Sep 17 00:00:00 2001 From: Croxx Date: Fri, 20 Sep 2024 15:59:28 +0800 Subject: [PATCH] chore: warn if DirectFileDevice is used in a fs (#730) Signed-off-by: MrCroxx --- foyer-storage/src/device/direct_file.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/foyer-storage/src/device/direct_file.rs b/foyer-storage/src/device/direct_file.rs index 6b66c020..6b8170f3 100644 --- a/foyer-storage/src/device/direct_file.rs +++ b/foyer-storage/src/device/direct_file.rs @@ -199,6 +199,12 @@ impl Dev for DirectFileDevice { let file = opts.open(&options.path)?; if file.metadata().unwrap().is_file() { + tracing::warn!( + "{}\n{}\n{}", + "It seems a `DirectFileDevice` is used within a normal file system, which is inefficient.", + "Please use `DirectFileDevice` directly on a raw block device.", + "Or use `DirectFsDevice` within a normal file system.", + ); file.set_len(options.capacity as _)?; }