NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
To: Tarun Sahu <tsahu@linux.ibm.com>, nvdimm@lists.linux.dev
Cc: dan.j.williams@intel.com, vishal.l.verma@intel.com,
	aneesh.kumar@linux.ibm.com, vaibhav@linux.ibm.com
Subject: Re: [PATCH 2/2] ndctl/namespace:Implement write-infoblock for sector mode namespaces
Date: Mon, 25 Apr 2022 18:07:35 +0530	[thread overview]
Message-ID: <d1aec1cf-86c5-ad64-3d29-cdce12a923ba@linux.ibm.com> (raw)
In-Reply-To: <20220413035252.161527-3-tsahu@linux.ibm.com>



On 4/13/22 09:22, Tarun Sahu wrote:
> Following to the previous patch in this series,
> once the namespace info has been collected in ns_info,
> while writing to the infoblock for sector mode, it can be
> written with original infoblock values except the ones that
> have been provided by parameter arguments to write-infoblock command.

<snip>

>   }
>   
> +static int write_btt_sb(const int fd, unsigned long long size, struct ns_info *ns_info)
> +{
> +	int rc = 0;
> +	uuid_t uuid, parent_uuid;
> +
> +	// updating the original values which are asked to change,
> +	// rest will be unchanged
> +	if (param.uuid) {
> +		rc = uuid_parse(param.uuid, uuid);
> +		if (rc) {
> +			pr_verbose("Failed to parse UUID");

Use error("Failed ... instead

> +			return rc;
> +		}
> +		memcpy(((struct btt_sb *)(ns_info->ns_sb_buf + ns_info->offset))->uuid,
> +				uuid, sizeof(uuid_t));
> +	}
> +	if (param.parent_uuid) {
> +		rc = uuid_parse(param.parent_uuid, parent_uuid);
> +		if (rc) {
> +			pr_verbose("Failed to parse UUID");

Same here

> +			return rc;
> +		}
> +		memcpy(((struct btt_sb *)(ns_info->ns_sb_buf + ns_info->offset))->parent_uuid,
> +				parent_uuid, sizeof(uuid_t));
> +	}
> +
> +	if (pwrite(fd, ns_info->ns_sb_buf + ns_info->offset, sizeof(struct btt_sb),
> +			       ns_info->offset) < 0) {
> +		pr_verbose("Unable to write the info block: %s\n",
> +				strerror(errno));

Same here
> +		rc = -errno;
> +	}
> +
> +	if (pwrite(fd, ns_info->ns_sb_buf + ns_info->offset, sizeof(struct btt_sb),
> +				size - sizeof(struct btt_sb)) < 0) {
> +		pr_verbose("Unable to write the info block: %s\n",
> +			strerror(errno));

Same here

Thanks,
Shivaprasad

      reply	other threads:[~2022-04-25 12:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13  3:52 [PATCH 0/2] ndctl/namespace:Fix and improve write-infoblock Tarun Sahu
2022-04-13  3:52 ` [PATCH 1/2] ndctl/namespace:Fix multiple issues with write-infoblock Tarun Sahu
2022-04-25 12:37   ` Shivaprasad G Bhat
2022-04-13  3:52 ` [PATCH 2/2] ndctl/namespace:Implement write-infoblock for sector mode namespaces Tarun Sahu
2022-04-25 12:37   ` Shivaprasad G Bhat [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=d1aec1cf-86c5-ad64-3d29-cdce12a923ba@linux.ibm.com \
    --to=sbhat@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=tsahu@linux.ibm.com \
    --cc=vaibhav@linux.ibm.com \
    --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