From patchwork Fri Oct 12 02:30:08 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: 10637749 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 923CF157A for ; Fri, 12 Oct 2018 02:30:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 804D42C252 for ; Fri, 12 Oct 2018 02:30:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74F542C25E; Fri, 12 Oct 2018 02:30:25 +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 26C782C252 for ; Fri, 12 Oct 2018 02:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727061AbeJLKAa (ORCPT ); Fri, 12 Oct 2018 06:00:30 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:6549 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbeJLKAa (ORCPT ); Fri, 12 Oct 2018 06:00:30 -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=1539311437; x=1570847437; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=qE5fd/NISE6lDiRO0hckNYX1tvXZArPBQZ9N61xHDYQ=; b=DHusAJ9JidkVCVcFKuBrFfNRV86r2S3Ub/0pFcKPp70E3ZEeEUUBIIgs K8jnhcko/5D1iK50k3uLIFhqrbVcv0FjXHu+GADCUMaz3eMTzRTYJDeHP Ab65iZOfvdWciMnmVACwoodVT/irThExFBx0rc8ZyCzcuWzE0snvEQfM4 iyXk1b1ut3JOso6HmmdyUjthTEaQyn3vT+up83bQbhsN3V1uiln1FsLLR kDCUq0WWg5kC/w4Ti7zf7lwTb7KCiNVjY4DNlylzSn1fG5DpWgN9gMcVB rtzHiRD+vR3I28qdOxoU+9I1DB72SbYpa5gdv7c4vXnINsdfxgQu+3x39 Q==; X-IronPort-AV: E=Sophos;i="5.54,370,1534780800"; d="scan'208";a="189468223" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 12 Oct 2018 10:30:37 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 11 Oct 2018 19:15:43 -0700 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Oct 2018 19:30:23 -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 v3 07/11] block: Introduce BLKGETNRZONES ioctl Date: Fri, 12 Oct 2018 11:30:08 +0900 Message-Id: <20181012023012.29923-8-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181012023012.29923-1-damien.lemoal@wdc.com> References: <20181012023012.29923-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 total number of zones. The device can be a partition of the whole device. The number of zones 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 | 1 + 2 files changed, 3 insertions(+) diff --git a/block/ioctl.c b/block/ioctl.c index f6d2c6f1f050..4825c78a6baa 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -534,6 +534,8 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, return blkdev_reset_zones_ioctl(bdev, mode, cmd, arg); case BLKGETZONESZ: return put_uint(arg, bdev_zone_sectors(bdev)); + case BLKGETNRZONES: + return put_uint(arg, blkdev_nr_zones(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 281ac605f752..8f08ff9bdea0 100644 --- a/include/uapi/linux/blkzoned.h +++ b/include/uapi/linux/blkzoned.h @@ -142,5 +142,6 @@ struct blk_zone_range { #define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report) #define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range) #define BLKGETZONESZ _IOW(0x12, 132, __u32) +#define BLKGETNRZONES _IOW(0x12, 133, __u32) #endif /* _UAPI_BLKZONED_H */