From: Joao Martins <joao.m.martins@oracle.com>
To: linux-nvdimm@lists.01.org
Cc: Dan Williams <dan.j.williams@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>
Subject: [PATCH ndctl v1 3/8] daxctl: add align support in reconfigure-device
Date: Thu, 16 Jul 2020 19:47:02 +0100 [thread overview]
Message-ID: <20200716184707.23018-4-joao.m.martins@oracle.com> (raw)
In-Reply-To: <20200716184707.23018-1-joao.m.martins@oracle.com>
Add an alignment option to reconfigure-device and use the newly added
libdaxctl API to set the alignment of the device prior to setting size.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
daxctl/device.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/daxctl/device.c b/daxctl/device.c
index 05293d6c38ee..9d82ea12aca2 100644
--- a/daxctl/device.c
+++ b/daxctl/device.c
@@ -22,6 +22,7 @@ static struct {
const char *mode;
const char *region;
const char *size;
+ const char *align;
bool no_online;
bool no_movable;
bool force;
@@ -36,6 +37,7 @@ enum dev_mode {
};
static enum dev_mode reconfig_mode = DAXCTL_DEV_MODE_UNKNOWN;
+static long long align = -1;
static long long size = -1;
static unsigned long flags;
@@ -68,7 +70,8 @@ OPT_BOOLEAN('f', "force", ¶m.force, \
"attempt to offline memory sections before reconfiguration")
#define CREATE_OPTIONS() \
-OPT_STRING('s', "size", ¶m.size, "size", "size to switch the device to")
+OPT_STRING('s', "size", ¶m.size, "size", "size to switch the device to"), \
+OPT_STRING('a', "align", ¶m.align, "align", "alignment to switch the device to")
#define DESTROY_OPTIONS() \
OPT_BOOLEAN('f', "force", ¶m.force, \
@@ -185,8 +188,10 @@ static const char *parse_device_options(int argc, const char **argv,
/* Handle action-specific options */
switch (action) {
case ACTION_RECONFIG:
- if (!param.size && !param.mode) {
- fprintf(stderr, "error: a 'mode' or 'size' option is required\n");
+ if (!param.size &&
+ !param.align &&
+ !param.mode) {
+ fprintf(stderr, "error: a 'align', 'mode' or 'size' option is required\n");
usage_with_options(u, reconfig_options);
rc = -EINVAL;
}
@@ -204,6 +209,8 @@ static const char *parse_device_options(int argc, const char **argv,
rc = -EINVAL;
}
}
+ if (param.align)
+ align = __parse_size64(param.align, &units);
break;
case ACTION_CREATE:
if (param.size)
@@ -558,6 +565,12 @@ static int do_reconfig(struct daxctl_dev *dev, enum dev_mode mode,
struct json_object *jdev;
int rc = 0;
+ if (align > 0) {
+ rc = daxctl_dev_set_align(dev, align);
+ if (rc < 0)
+ return rc;
+ }
+
if (size >= 0) {
rc = dev_resize(dev, size);
return rc;
--
1.8.3.1
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
next prev parent reply other threads:[~2020-07-16 18:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 18:46 [PATCH ndctl v1 0/8] daxctl: Add device align and range mapping allocation Joao Martins
2020-07-16 18:47 ` [PATCH ndctl v1 1/8] daxctl: add daxctl_dev_{get,set}_align() Joao Martins
2020-07-16 18:47 ` [PATCH ndctl v1 2/8] util/json: Print device align Joao Martins
2020-07-16 18:47 ` Joao Martins [this message]
2020-07-16 18:47 ` [PATCH ndctl v1 4/8] daxctl: add align support in create-device Joao Martins
2020-07-16 18:47 ` [PATCH ndctl v1 5/8] libdaxctl: add mapping iterator APIs Joao Martins
2020-07-16 18:47 ` [PATCH ndctl v1 6/8] daxctl: include mappings when listing Joao Martins
2020-07-16 18:47 ` [PATCH ndctl v1 7/8] libdaxctl: add daxctl_dev_set_mapping() Joao Martins
2020-07-16 18:47 ` [PATCH ndctl v1 8/8] daxctl: Allow restore devices from JSON metadata Joao Martins
2020-12-16 11:39 ` [PATCH ndctl v1 0/8] daxctl: Add device align and range mapping allocation Joao Martins
2020-12-16 18:42 ` Verma, Vishal L
2020-12-16 21:49 ` Joao Martins
2020-12-16 22:31 ` Dan Williams
2020-12-16 22:53 ` Joao Martins
2020-12-16 23:42 ` Dan Williams
2020-12-17 11:23 ` Joao Martins
2020-12-17 20:18 ` Verma, Vishal L
2020-12-16 19:13 ` Dan Williams
2020-12-16 21:35 ` Joao Martins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200716184707.23018-4-joao.m.martins@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=dan.j.williams@intel.com \
--cc=linux-nvdimm@lists.01.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).