Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: m.malygin@yadro.com
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH v3] nvmet: add revalidate ns sysfs attribute to handle device resize
Date: Mon, 7 Oct 2019 09:56:39 -0700	[thread overview]
Message-ID: <20191007165639.GA31190@infradead.org> (raw)
In-Reply-To: <20191007073940.19022-1-m.malygin@yadro.com>

> +static ssize_t nvmet_ns_revalidate_store(struct config_item *item,
> +		const char *page, size_t count)
> +{
> +	struct nvmet_ns *ns = to_nvmet_ns(item);
> +	int ret = 0;
> +
> +	ret = nvmet_ns_revalidate(ns);
> +
> +	return ret ? ret : count;

Nit: no need to initialize ret, and we can use a normal if here:

	ret = nvmet_ns_revalidate(ns);
	if (ret)
		return ret;
	return count;

> +int nvmet_bdev_ns_revalidate(struct nvmet_ns *ns)
> +{
> +	nvmet_bdev_ns_read_size(ns);
> +	return 0;
> +}

I think we can just remove this wrapper.

> +static int nvmet_file_ns_read_size(struct nvmet_ns *ns)
> +{
> +	int ret;
> +	struct kstat stat;
> +
> +	ret = vfs_getattr(&ns->file->f_path,
> +			&stat, STATX_SIZE, AT_STATX_FORCE_SYNC);

Nit: you can add more arguments to the first line:

	ret = vfs_getattr(&ns->file->f_path, &stat, STATX_SIZE,
			  AT_STATX_FORCE_SYNC);

> +int nvmet_file_ns_revalidate(struct nvmet_ns *ns)
> +{
> +	return nvmet_file_ns_read_size(ns);
> +}

And we can just remove this wrapper as well.

Or in fact rename the low-level functions to *_revalidate which
might be a little more obvious.  But either way I don't think we need
small wrappers.

Otherwise this looks good to me, thanks for doing the work!

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2019-10-07 16:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 23:19 [PATCH] nvmet: add revalidate ns sysfs attribute to handle device resize Mikhail Malygin
2019-09-27 17:24 ` Sagi Grimberg
2019-09-27 22:13   ` Christoph Hellwig
2019-09-27 22:34     ` Sagi Grimberg
2019-09-27 22:51       ` Christoph Hellwig
2019-09-30 15:16   ` Mikhail Malygin
2019-09-30 15:02 ` [PATCH v2] " m.malygin
2019-10-05  0:03   ` Sagi Grimberg
2019-10-06 10:12     ` Christoph Hellwig
2019-10-07  7:45       ` Mikhail Malygin
2019-10-07  7:39 ` [PATCH v3] " m.malygin
2019-10-07 16:56   ` Christoph Hellwig [this message]
2019-10-07 19:58     ` Mikhail Malygin
2019-10-07 19:57 ` [PATCH v4] " m.malygin
2019-10-08  2:30   ` Chaitanya Kulkarni
2019-10-08 12:30     ` Mikhail Malygin
2019-10-08  7:16   ` Christoph Hellwig
2019-10-08 12:29 ` [PATCH v5] " m.malygin
2019-10-08 17:27   ` Chaitanya Kulkarni

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=20191007165639.GA31190@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=m.malygin@yadro.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