Re: [PATCH] Add blkzonecmd and blkreport ZAC/ZBC drives

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

 



Shaun,

On 1/19/17 18:02, Shaun Tancheff wrote:
> +++ b/sys-utils/blkreset.c
> @@ -0,0 +1,192 @@
> +/*
[...]
> +
> +	if (ioctl(fd, BLKGETSIZE64, &blksize))
> +		err(EXIT_FAILURE, _("%s: BLKGETSIZE64 ioctl failed"), path);
> +
> +	blksectors = blksize << 9;

blksize being in bytes here, it looks like the shift is in the wrong
direction here... i.e.

blksectors = blksize >> 9;

> +
> +	/* check offset alignment to the chunk size */
> +	if (zsector & (zsize - 1))
> +		errx(EXIT_FAILURE, _("%s: zone %" PRIu64 " is not aligned "
> +			 "to zone size %" PRIu64), path, zsector, zsize);
> +	if (zsector > blksectors)
> +		errx(EXIT_FAILURE, _("%s: zone %" PRIu64 " is too large "
> +			 "for device %" PRIu64), path, zsector, blksectors);
> +
> +	zlen = zcount * zsize;
> +	if (zsector + zlen > blksectors)
> +		zlen = blksectors - zsector;
> +
> +	za.sector = zsector;
> +	za.nr_sectors = zlen;
> +	rc = ioctl(fd, BLKRESETZONE, &za);
> +	if (rc == -1)
> +		err(EXIT_FAILURE, _("%s: BLKRESETZONE ioctl failed"), path);
> +
> +	close(fd);
> +	return EXIT_SUCCESS;
> +}
> 

Best regards.

-- 
Damien Le Moal, Ph.D.
Sr Manager, System Software Research Group,
Western Digital
Damien.LeMoal@xxxxxxxx
Tel: (+81) 0466-98-3593 (Ext. 51-3593)
1 kirihara-cho, Fujisawa, Kanagawa, 252-0888 Japan
www.wdc.com, www.hgst.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux