|
Jeff Moyer |
2c91dc |
From e563e6a7c55e65c554e07db6215f8bcb2d411d3b Mon Sep 17 00:00:00 2001
|
|
Jeff Moyer |
2c91dc |
From: Vishal Verma <vishal.l.verma@intel.com>
|
|
Jeff Moyer |
2c91dc |
Date: Tue, 30 Mar 2021 20:50:37 -0600
|
|
Jeff Moyer |
2c91dc |
Subject: [PATCH 015/217] libdaxctl: add an API to check if a device is active
|
|
Jeff Moyer |
2c91dc |
|
|
Jeff Moyer |
2c91dc |
Add an API to check whether a daxctl device is active in system-ram
|
|
Jeff Moyer |
2c91dc |
mode. This would be used from libndctl during
|
|
Jeff Moyer |
2c91dc |
ndctl_namespace_disable_safe(), so that we don't disable/destroy an
|
|
Jeff Moyer |
2c91dc |
underlying namespace while the memory is active and online.
|
|
Jeff Moyer |
2c91dc |
|
|
Jeff Moyer |
2c91dc |
Reported-by: Chunye Xu <chunye.xu@intel.com>
|
|
Jeff Moyer |
2c91dc |
Cc: Dan Williams <dan.j.williams@intel.com>
|
|
Jeff Moyer |
2c91dc |
Cc: Dave Hansen <dave.hansen@linux.intel.com>
|
|
Jeff Moyer |
2c91dc |
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
Jeff Moyer |
2c91dc |
---
|
|
Jeff Moyer |
2c91dc |
daxctl/lib/libdaxctl.c | 10 ++++++++++
|
|
Jeff Moyer |
2c91dc |
daxctl/lib/libdaxctl.sym | 1 +
|
|
Jeff Moyer |
2c91dc |
daxctl/libdaxctl.h | 1 +
|
|
Jeff Moyer |
2c91dc |
3 files changed, 12 insertions(+)
|
|
Jeff Moyer |
2c91dc |
|
|
Jeff Moyer |
2c91dc |
diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
|
|
Jeff Moyer |
2c91dc |
index 879f7e6..860bd9c 100644
|
|
Jeff Moyer |
2c91dc |
--- a/daxctl/lib/libdaxctl.c
|
|
Jeff Moyer |
2c91dc |
+++ b/daxctl/lib/libdaxctl.c
|
|
Jeff Moyer |
2c91dc |
@@ -1665,3 +1665,13 @@ DAXCTL_EXPORT int daxctl_dev_will_auto_online_memory(struct daxctl_dev *dev)
|
|
Jeff Moyer |
2c91dc |
/* match both "online" and "online_movable" */
|
|
Jeff Moyer |
2c91dc |
return !strncmp(buf, "online", 6);
|
|
Jeff Moyer |
2c91dc |
}
|
|
Jeff Moyer |
2c91dc |
+
|
|
Jeff Moyer |
2c91dc |
+DAXCTL_EXPORT int daxctl_dev_has_online_memory(struct daxctl_dev *dev)
|
|
Jeff Moyer |
2c91dc |
+{
|
|
Jeff Moyer |
2c91dc |
+ struct daxctl_memory *mem = daxctl_dev_get_memory(dev);
|
|
Jeff Moyer |
2c91dc |
+
|
|
Jeff Moyer |
2c91dc |
+ if (mem)
|
|
Jeff Moyer |
2c91dc |
+ return daxctl_memory_is_online(mem);
|
|
Jeff Moyer |
2c91dc |
+ else
|
|
Jeff Moyer |
2c91dc |
+ return 0;
|
|
Jeff Moyer |
2c91dc |
+}
|
|
Jeff Moyer |
2c91dc |
diff --git a/daxctl/lib/libdaxctl.sym b/daxctl/lib/libdaxctl.sym
|
|
Jeff Moyer |
2c91dc |
index 892e393..a13e93d 100644
|
|
Jeff Moyer |
2c91dc |
--- a/daxctl/lib/libdaxctl.sym
|
|
Jeff Moyer |
2c91dc |
+++ b/daxctl/lib/libdaxctl.sym
|
|
Jeff Moyer |
2c91dc |
@@ -95,4 +95,5 @@ global:
|
|
Jeff Moyer |
2c91dc |
LIBDAXCTL_9 {
|
|
Jeff Moyer |
2c91dc |
global:
|
|
Jeff Moyer |
2c91dc |
daxctl_dev_will_auto_online_memory;
|
|
Jeff Moyer |
2c91dc |
+ daxctl_dev_has_online_memory;
|
|
Jeff Moyer |
2c91dc |
} LIBDAXCTL_8;
|
|
Jeff Moyer |
2c91dc |
diff --git a/daxctl/libdaxctl.h b/daxctl/libdaxctl.h
|
|
Jeff Moyer |
2c91dc |
index 30ab51a..683ae9c 100644
|
|
Jeff Moyer |
2c91dc |
--- a/daxctl/libdaxctl.h
|
|
Jeff Moyer |
2c91dc |
+++ b/daxctl/libdaxctl.h
|
|
Jeff Moyer |
2c91dc |
@@ -72,6 +72,7 @@ int daxctl_dev_enable_devdax(struct daxctl_dev *dev);
|
|
Jeff Moyer |
2c91dc |
int daxctl_dev_enable_ram(struct daxctl_dev *dev);
|
|
Jeff Moyer |
2c91dc |
int daxctl_dev_get_target_node(struct daxctl_dev *dev);
|
|
Jeff Moyer |
2c91dc |
int daxctl_dev_will_auto_online_memory(struct daxctl_dev *dev);
|
|
Jeff Moyer |
2c91dc |
+int daxctl_dev_has_online_memory(struct daxctl_dev *dev);
|
|
Jeff Moyer |
2c91dc |
|
|
Jeff Moyer |
2c91dc |
struct daxctl_memory;
|
|
Jeff Moyer |
2c91dc |
struct daxctl_memory *daxctl_dev_get_memory(struct daxctl_dev *dev);
|
|
Jeff Moyer |
2c91dc |
--
|
|
Jeff Moyer |
2c91dc |
2.27.0
|
|
Jeff Moyer |
2c91dc |
|