Ira Weiny <[email protected]> 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 <[email protected]>
>> ---
>
> [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 -- [email protected]
>> To unsubscribe send an email to [email protected]
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]