All of lore.kernel.org
 help / color / mirror / Atom feed
From: jes.sorensen@gmail.com
To: Zhilong Liu <zlliu@suse.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH 2/4] mdadm/util:integrate fstat operations into one utility function
Date: Wed, 05 Apr 2017 11:43:44 -0400	[thread overview]
Message-ID: <wrfj4ly2eu6n.fsf@gmail.com> (raw)
In-Reply-To: <20170401125145.14440-3-zlliu@suse.com> (Zhilong Liu's message of "Sat, 1 Apr 2017 20:51:43 +0800")

Zhilong Liu <zlliu@suse.com> writes:
> mdadm/util: there are dupilicate codes about fstat checking the
> block device, move the operations into one utility function and
> make it concise.
>
> Signed-off-by: Zhilong Liu <zlliu@suse.com>
> ---
>  Assemble.c    | 10 ++--------
>  Create.c      |  5 +----
>  Grow.c        |  4 +---
>  Incremental.c | 13 +------------
>  bitmap.c      | 12 ++++--------
>  mdadm.h       |  1 +
>  super-intel.c | 10 ++--------
>  util.c        | 15 +++++++++++++++
>  8 files changed, 27 insertions(+), 43 deletions(-)
>
> diff --git a/Assemble.c b/Assemble.c
> index c6571e6..47c6685 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -204,14 +204,8 @@ static int select_devices(struct mddev_dev *devlist,
>  				pr_err("cannot open device %s: %s\n",
>  				       devname, strerror(errno));
>  			tmpdev->used = 2;
> -		} else if (fstat(dfd, &stb)< 0) {
> -			/* Impossible! */
> -			pr_err("fstat failed for %s: %s\n",
> -			       devname, strerror(errno));
> -			tmpdev->used = 2;
> -		} else if ((stb.st_mode & S_IFMT) != S_IFBLK) {
> -			pr_err("%s is not a block device.\n",
> -			       devname);
> +		} else if (check_blkdev_via_fstat(dfd, devname) &&
> +			   fstat(dfd, &stb)) {
>  			tmpdev->used = 2;
>  		} else if (must_be_container(dfd)) {
>  			if (st) {

Same complaint as prior patch, do not run fstat() twice!!!!

Jes

  reply	other threads:[~2017-04-05 15:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01 12:51 [PATCH 0/4] integrated stat and fstat into utility functions Zhilong Liu
2017-04-01 12:51 ` [PATCH 1/4] mdadm/util:integrate stat operations into one utility Zhilong Liu
2017-04-05 15:42   ` jes.sorensen
2017-04-14 10:14     ` Liu Zhilong
2017-04-14 15:20       ` Jes Sorensen
2017-04-17  7:08         ` Liu Zhilong
2017-04-17  7:18           ` Zhilong Liu
2017-04-20 16:42           ` Jes Sorensen
2017-04-01 12:51 ` [PATCH 2/4] mdadm/util:integrate fstat operations into one utility function Zhilong Liu
2017-04-05 15:43   ` jes.sorensen [this message]
2017-04-01 12:51 ` [PATCH 3/4] mdadm/Create:declaring an existing struct within same function Zhilong Liu
2017-04-05 15:47   ` jes.sorensen
2017-04-01 12:51 ` [PATCH 4/4] mdadm/Monitor:check the block device when use waitclean parameter Zhilong Liu
2017-04-14 12:31 ` [PATCH 0/4] integrated stat and fstat into utility functions Paul Menzel
2017-04-17  2:23   ` Zhilong Liu

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=wrfj4ly2eu6n.fsf@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=zlliu@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.