Re: [PATCH 2/4] mdadm/util:integrate fstat operations into one utility function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Zhilong Liu <zlliu@xxxxxxxx> 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@xxxxxxxx>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux