From: Santosh Sivaraj <santosh@fossix.org>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Linux NVDIMM <linux-nvdimm@lists.01.org>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
Harish Sriram <harish@linux.ibm.com>
Subject: Re: [PATCH ndctl] infoblock: Set the default alignment to the platform alignment
Date: Wed, 08 Jul 2020 12:03:09 +0530 [thread overview]
Message-ID: <87r1tmy0re.fsf@santosiv.in.ibm.com> (raw)
In-Reply-To: <20200707211258.GD961523@iweiny-DESK2.sc.intel.com>
Ira Weiny <ira.weiny@intel.com> writes:
> On Tue, Jul 07, 2020 at 06:26:41AM +0530, Santosh Sivaraj wrote:
>> The default alignment for write-infoblock command is set to 2M. Change
>> that to use the platform's supported alignment or PAGE_SIZE. The first
>> supported alignment is taken as the default.
>>
>> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
>> ---
>
> [snip]
>
>> @@ -1992,12 +2001,36 @@ static int namespace_rw_infoblock(struct ndctl_namespace *ndns,
>> const char *save;
>> const char *cmd = write ? "write-infoblock" : "read-infoblock";
>> const char *devname = ndctl_namespace_get_devname(ndns);
>> + unsigned long long align;
>>
>> if (ndctl_namespace_is_active(ndns)) {
>> pr_verbose("%s: %s enabled, must be disabled\n", cmd, devname);
>> return -EBUSY;
>> }
>>
>> + if (write) {
>> + if (!param.align) {
>> + align = ndctl_get_default_alignment(ndns);
>> +
>> + if (asprintf((char **)¶m.align, "%llu", align) < 0) {
>
> If we are looping through namespaces doesn't param.align need to be localized
> to this function as well?
Thanks for reviewing!
Right, I missed the "all" case. I will get that fixed this in v2.
Thanks,
Santosh
>
> Ira
>
>> + rc = -EINVAL;
>> + goto out;
>> + }
>> + }
>> +
>> + if (param.size) {
>> + unsigned long long size = parse_size64(param.size);
>> + align = parse_size64(param.align);
>> +
>> + if (align < ULLONG_MAX && !IS_ALIGNED(size, align)) {
>> + error("--size=%s not aligned to %s\n", param.size,
>> + param.align);
>> + rc = -EINVAL;
>> + goto out;
>> + }
>> + }
>> + }
>> +
>> ndctl_namespace_set_raw_mode(ndns, 1);
>> rc = ndctl_namespace_enable(ndns);
>> if (rc < 0) {
>> @@ -2060,6 +2093,9 @@ static int do_xaction_namespace(const char *namespace,
>> }
>>
>> if (action == ACTION_WRITE_INFOBLOCK && !namespace) {
>> + if (!param.align)
>> + param.align = "2M";
>> +
>> rc = file_write_infoblock(param.outfile);
>> if (rc >= 0)
>> (*processed)++;
>> --
>> 2.26.2
>> _______________________________________________
>> Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
>> To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
prev parent reply other threads:[~2020-07-08 6:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 0:56 [PATCH ndctl] infoblock: Set the default alignment to the platform alignment Santosh Sivaraj
2020-07-07 21:12 ` Ira Weiny
2020-07-08 6:33 ` Santosh Sivaraj [this message]
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=87r1tmy0re.fsf@santosiv.in.ibm.com \
--to=santosh@fossix.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=harish@linux.ibm.com \
--cc=ira.weiny@intel.com \
--cc=linux-nvdimm@lists.01.org \
/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