From patchwork Fri Oct 12 10:08:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 10638325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E491517E1 for ; Fri, 12 Oct 2018 10:09:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4EA02B841 for ; Fri, 12 Oct 2018 10:09:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C96CF2B849; Fri, 12 Oct 2018 10:09:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 731DC2B841 for ; Fri, 12 Oct 2018 10:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728401AbeJLRkk (ORCPT ); Fri, 12 Oct 2018 13:40:40 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:63720 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728346AbeJLRkk (ORCPT ); Fri, 12 Oct 2018 13:40:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1539338941; x=1570874941; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0CZSZL+4PFBGQ1xNCz8ADG+uqwRquvh7JU6dI/HLrQk=; b=Sp9HEhVQ0BZ/7QXUBteHIVtYqGyXVFVafIa4I9H41d1/vvK3jRhRKux+ s1afpCj6pBWeMDkpnv23bx9wDRmvXAVrmLyHESoAyG065rtGfLjEiO04M bg+x64txAV+w6ESDhtGAE6KFr1y2MO6so8Hau6U2amVdytWjHI99FjvVv 7CMiGkT8Guua9kkGOJnI/v0+FsGfFtGOR7iNsCkoVOIpEMfuPxvSRlM5E RoYF0wd4Y/Nqm69Ck5XVUOBMAOHF0XQRxHEjGqASyFTplLZz9aUeOYRW4 II7l4yLJUzcW93jwo7u+QRmIoGkyO8pIsMk7W8DVRvgnYTBtoNLumF6/A Q==; X-IronPort-AV: E=Sophos;i="5.54,371,1534780800"; d="scan'208";a="96419694" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 12 Oct 2018 18:09:01 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 12 Oct 2018 02:54:20 -0700 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 12 Oct 2018 03:09:00 -0700 From: Damien Le Moal To: linux-block@vger.kernel.org, Jens Axboe , linux-scsi@vger.kernel.org, "Martin K . Petersen" , dm-devel@redhat.com, Mike Snitzer Cc: Christoph Hellwig , Matias Bjorling Subject: [PATCH v4 06/11] block: Introduce BLKGETZONESZ ioctl Date: Fri, 12 Oct 2018 19:08:45 +0900 Message-Id: <20181012100850.23316-7-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181012100850.23316-1-damien.lemoal@wdc.com> References: <20181012100850.23316-1-damien.lemoal@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Get a zoned block device zone size in number of 512 B sectors. The zone size is always 0 for regular block devices. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- block/ioctl.c | 2 ++ include/uapi/linux/blkzoned.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/block/ioctl.c b/block/ioctl.c index 3884d810efd2..f6d2c6f1f050 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -532,6 +532,8 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, return blkdev_report_zones_ioctl(bdev, mode, cmd, arg); case BLKRESETZONE: return blkdev_reset_zones_ioctl(bdev, mode, cmd, arg); + case BLKGETZONESZ: + return put_uint(arg, bdev_zone_sectors(bdev)); case HDIO_GETGEO: return blkdev_getgeo(bdev, argp); case BLKRAGET: diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h index ff5a5db8906a..281ac605f752 100644 --- a/include/uapi/linux/blkzoned.h +++ b/include/uapi/linux/blkzoned.h @@ -137,8 +137,10 @@ struct blk_zone_range { * sector specified in the report request structure. * @BLKRESETZONE: Reset the write pointer of the zones in the specified * sector range. The sector range must be zone aligned. + * @BLKGETZONESZ: Get the device zone size in number of 512 B sectors. */ #define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report) #define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range) +#define BLKGETZONESZ _IOW(0x12, 132, __u32) #endif /* _UAPI_BLKZONED_H */