From patchwork Thu Oct 6 01:04:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 9363595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9EA8E6075E for ; Thu, 6 Oct 2016 01:07:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 907A228D71 for ; Thu, 6 Oct 2016 01:07:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84D5328DA9; Thu, 6 Oct 2016 01:07:07 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 DBDF228D71 for ; Thu, 6 Oct 2016 01:07:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754806AbcJFBHE (ORCPT ); Wed, 5 Oct 2016 21:07:04 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:64242 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754092AbcJFBHA (ORCPT ); Wed, 5 Oct 2016 21:07:00 -0400 X-IronPort-AV: E=Sophos;i="5.31,451,1473091200"; d="scan'208";a="20799468" Received: from mail-sn1nam02lp0016.outbound.protection.outlook.com (HELO NAM02-SN1-obe.outbound.protection.outlook.com) ([216.32.180.16]) by ob1.hgst.iphmx.com with ESMTP; 06 Oct 2016 09:05:22 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-hgst-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XNxg5veRyxGOv4G2EhcK8CXCxH7h5IiiniGQ06o4Mhw=; b=VYZaUb9m8PHvGVYMVZAo8QC/Ub1xMdnNG67fqY9YL/jjOYdmyDOVHIbF8RKqtUqR7tiZtv4ZUyQJnFSKGERQDqVFcuOKJD2/FUSUBNCypAGkHkvMsZ/zFK9ijA9YIHvBibS3zF9w57XwlixRaCr/5XtaN9krXaTnSxwkpVEKZYU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Damien.LeMoal@hgst.com; Received: from washi.fujisawa.hgst.com (199.255.47.8) by SN1PR04MB1983.namprd04.prod.outlook.com (10.166.69.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Thu, 6 Oct 2016 01:05:19 +0000 From: Damien Le Moal To: Jens Axboe CC: , , Christoph Hellwig , "Martin K . Petersen" , Hannes Reinecke , Shaun Tancheff , Damien Le Moal , Shaun Tancheff Subject: [PATCH v7 7/7] blk-zoned: implement ioctls Date: Thu, 6 Oct 2016 10:04:52 +0900 Message-ID: <1475715892-18856-8-git-send-email-damien.lemoal@hgst.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475715892-18856-1-git-send-email-damien.lemoal@hgst.com> References: <1475715892-18856-1-git-send-email-damien.lemoal@hgst.com> MIME-Version: 1.0 X-Originating-IP: [199.255.47.8] X-ClientProxiedBy: SN1PR17CA0065.namprd17.prod.outlook.com (10.163.3.161) To SN1PR04MB1983.namprd04.prod.outlook.com (10.166.69.143) X-MS-Office365-Filtering-Correlation-Id: 74181b5e-f742-4ddb-27e6-08d3ed84d845 X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 2:lMuk9eFRURYUraGEwo/HyLT1qqNwZxCVR3baWyHCQnhogaKz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LPxgcZyOCtzUp13NzqsWSKTk/daSH3Y9zi0ILTnggG5w9W0WdRDukRSepNMZjf2yFXhbJatrlzLmx1iY1qjegwxkdDOpaFoyjRLDNhM4XUHOfeMMObMTI42O+Yjokxk/MK9klO1R6nYtDjSru7X3q+lw0OIODIPkiYZpoxnDzBVh05l7z2V+0Au+jlORfARKrmSNH3jnJ2WDUlR6gA6La3DIo99xfYfyFKqMBNtlo8L12seomzQ+YpDp+sNSLVwcNs/njDy8ZU5jJskWpqVWl/kU9/o5aXJdONiCLFB7F8es7jZKtvwRK8Jfd0BxUaBalPqCxMFBnDZxkVsZsAQCS0LBmGYy/bMuFk96HbgnnkLZ8sJfXKT5pi5Dvk74GPEEYXIei/MCtEYM0RAJAbjrobIPkBYWEZUXHL0Bt2IPMTv22GEaelb6GgMTmx8HjmIbjreD1ZzpIKpYhigqI7eW04zj52u X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(79135771888625)(146099531331640); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:SN1PR04MB1983; BCL:0; PCL:0; RULEID:; SRVR:SN1PR04MB1983; X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 4:AiXt+EqYp3bncYBCdbAR/cB9yHA5fF2Ds/4xbsiFg8ZNcJiW2LlphiI/03N7VILhF5AZtrqpablnivtwtRETlqlhNjE/OCsnhiKsLq5iVw5h7gIeFewSCoO2EIPrLCp4scdKq1jibx4CFr+WUlESTrcc+IzL7fHxMsDnnfyt74JQw2BT8tjOUMcuyMFl1oAksS4kn60Fjfy+UQMucoK0/Kc1JyY68srBJSXX7XXc7TFhzTTi1e8ZQx+k4VGPtxWr015hxWU1ycpbHP50Bi83GBCaRdIiKArhCFtfI2WGO/ruIpWe1DvCS6cQTmiQGOFL3NFJ46/HUJ7d0T4U6u4i2OzcAlHIXy3m4oIU0wWrH5xQ6/peyjF0CV1eQjPRdEz1Fky5egAshQsPIDLitYJHuELDCPRv8gcdF/9YnYJR6SjQaLVEjjdZ8w6DCduJt9eC2FGyb8nP+GQi/1TEzmfkCS5WYhWvvsJ/jSsp7lQQnJ4= X-Forefront-PRVS: 00872B689F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(92566002)(2950100002)(19580395003)(19580405001)(6916009)(97736004)(305945005)(6666003)(7736002)(7846002)(6116002)(3846002)(586003)(229853001)(189998001)(66066001)(5660300001)(33646002)(110136003)(47776003)(575784001)(86362001)(48376002)(2906002)(76176999)(68736007)(4326007)(5003940100001)(50466002)(42186005)(105586002)(106356001)(77096005)(36756003)(81156014)(81166006)(101416001)(50226002)(50986999)(8676002)(7099028); DIR:OUT; SFP:1102; SCL:1; SRVR:SN1PR04MB1983; H:washi.fujisawa.hgst.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: hgst.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR04MB1983; 23:3uRfhv0KDVHaRCdhvcAfaCcKZoKKaHVAQ0BGw+z8j?= =?us-ascii?Q?XlNmEMgj0NJZNzv8aMi36aBvP4WvUOnj2Fz4A1Pp9gbmt2lgfQDBcY+9A6cb?= =?us-ascii?Q?Ji7IEFKgc0UH2Rwo9fjkyH+UTctP2CwDHCACbxl6qPhtyhHrmKAtXUQaLcHG?= =?us-ascii?Q?/FnQ0s/sr6JEy1wVRvffl32xBjs9TztgDmwBP4f6yMwkLNuCMSUsEqNZO+Dl?= =?us-ascii?Q?bMFwGZqGn6f2ANi58nJDd/7iMeahLkpItpiPHFmGBeMvQFHu+6mTerJJy/Ko?= =?us-ascii?Q?LSX6/Q+oUcUEQCQfy8cWQCS9UF/6vsSlnB8a4NOPcYFwkJRTSvRQPeGdWqJP?= =?us-ascii?Q?r7lTP+WwSHT2wSUQ6lF4PyRfHIjIk7tAMkUaZwJ9swqo7g2M+cXKfrUq/77n?= =?us-ascii?Q?bsGvQqGz3tc2s4yuzon7qC4MFfPIPUUlAL+1bTKdbXyAIDxjoFPs10IjbePZ?= =?us-ascii?Q?TUuRg4mMStZdX1GHcl+a0f6Nhdzu9CaxvRrQZ+/Hp4+SU3DbnWwmsNKa/ZLu?= =?us-ascii?Q?Pl91tfU3pVRbK0RRrXplyybpA6fPMFwo+cAGLAcrH3KcyTJBs9rI2MaUIxnl?= =?us-ascii?Q?ayi/ndd+hveQsdMMsKgWdrIUCD3GgNFRiP5fNY2zZySqEMK4JjZwweZ4DxNq?= =?us-ascii?Q?JNdIcBFG+dom284yNy/DsZXRCqXTQrOVotrors+cMjYd8KbelPqOzVw8sT5r?= =?us-ascii?Q?LyXmIfIO/CKsotuM53vwhVrAYi6vF/ZXGjz88pbFcKuDwtTOyij+yPL1YMSA?= =?us-ascii?Q?5dweWDn9kg2YPsICfNZhfs9YWS9I6aw3QedAJBOgokFhOS72QubMtMB80do3?= =?us-ascii?Q?UnGV1sS8MtT8R6kaXCtKP5WNs3Zvqoi7plHh+tpoO52PRxYAPLYEKlqHRR8r?= =?us-ascii?Q?Rxy+qglbBmWfODhDY114LRB8ShqpWJR/0FHwDX1NJ1rLZS3kTY2GdUzHZgTa?= =?us-ascii?Q?z1NTMB+CqdDkUe7otcd7uoYEx7qbt79Atcl5QTZDUNFHlEW4aaDmfUbtMsD/?= =?us-ascii?Q?milozKF2M2V090ZQVO31ePlhksSnPXkHEIftQBptjkxiqYZa1LAvxHatgesL?= =?us-ascii?Q?5sKzACkdyfRulsBqmkfTl+SNXFnsJ0KkiK4NBJKtYVH17w58MzCthD6tn0Lz?= =?us-ascii?Q?fP4bbBONTM=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 6:W2SnL36mucQ7i+4WIZxSBCvdMhIA/W27fec3BzQfp21rvNEW5fd2s5E5D+dO9rYTsyEWXOIL5S+oDanGzdH5yx1tGWrp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JuP942VAugpzafRwix6LrLm1qk277bWOgVp4XtTzTe5RvbTHob07SOJ86it1zdwmJ6hXwYo/Ki8tvyo+xdpeI9Ay X-OriginatorOrg: hgst.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2016 01:05:19.4336 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR04MB1983 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 From: Shaun Tancheff Adds the new BLKREPORTZONE and BLKRESETZONE ioctls for respectively obtaining the zone configuration of a zoned block device and resetting the write pointer of sequential zones of a zoned block device. The BLKREPORTZONE ioctl maps directly to a single call of the function blkdev_report_zones. The zone information result is passed as an array of struct blk_zone identical to the structure used internally for processing the REQ_OP_ZONE_REPORT operation. The BLKRESETZONE ioctl maps to a single call of the blkdev_reset_zones function. Signed-off-by: Shaun Tancheff Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Hannes Reinecke --- block/blk-zoned.c | 93 +++++++++++++++++++++++++++++++++++++++++++ block/ioctl.c | 4 ++ include/linux/blkdev.h | 21 ++++++++++ include/uapi/linux/blkzoned.h | 40 +++++++++++++++++++ include/uapi/linux/fs.h | 4 ++ 5 files changed, 162 insertions(+) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 1603573..667f95d 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -255,3 +255,96 @@ int blkdev_reset_zones(struct block_device *bdev, return 0; } EXPORT_SYMBOL_GPL(blkdev_reset_zones); + +/** + * BLKREPORTZONE ioctl processing. + * Called from blkdev_ioctl. + */ +int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) +{ + void __user *argp = (void __user *)arg; + struct request_queue *q; + struct blk_zone_report rep; + struct blk_zone *zones; + int ret; + + if (!argp) + return -EINVAL; + + q = bdev_get_queue(bdev); + if (!q) + return -ENXIO; + + if (!blk_queue_is_zoned(q)) + return -ENOTTY; + + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + + if (copy_from_user(&rep, argp, sizeof(struct blk_zone_report))) + return -EFAULT; + + if (!rep.nr_zones) + return -EINVAL; + + zones = kcalloc(rep.nr_zones, sizeof(struct blk_zone), GFP_KERNEL); + if (!zones) + return -ENOMEM; + + ret = blkdev_report_zones(bdev, rep.sector, + zones, &rep.nr_zones, + GFP_KERNEL); + if (ret) + goto out; + + if (copy_to_user(argp, &rep, sizeof(struct blk_zone_report))) { + ret = -EFAULT; + goto out; + } + + if (rep.nr_zones) { + if (copy_to_user(argp + sizeof(struct blk_zone_report), zones, + sizeof(struct blk_zone) * rep.nr_zones)) + ret = -EFAULT; + } + + out: + kfree(zones); + + return ret; +} + +/** + * BLKRESETZONE ioctl processing. + * Called from blkdev_ioctl. + */ +int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) +{ + void __user *argp = (void __user *)arg; + struct request_queue *q; + struct blk_zone_range zrange; + + if (!argp) + return -EINVAL; + + q = bdev_get_queue(bdev); + if (!q) + return -ENXIO; + + if (!blk_queue_is_zoned(q)) + return -ENOTTY; + + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + + if (!(mode & FMODE_WRITE)) + return -EBADF; + + if (copy_from_user(&zrange, argp, sizeof(struct blk_zone_range))) + return -EFAULT; + + return blkdev_reset_zones(bdev, zrange.sector, zrange.nr_sectors, + GFP_KERNEL); +} diff --git a/block/ioctl.c b/block/ioctl.c index ed2397f..448f78a 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -513,6 +513,10 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, BLKDEV_DISCARD_SECURE); case BLKZEROOUT: return blk_ioctl_zeroout(bdev, mode, arg); + case BLKREPORTZONE: + return blkdev_report_zones_ioctl(bdev, mode, cmd, arg); + case BLKRESETZONE: + return blkdev_reset_zones_ioctl(bdev, mode, cmd, arg); case HDIO_GETGEO: return blkdev_getgeo(bdev, argp); case BLKRAGET: diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 252043f..90097dd 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -316,6 +316,27 @@ extern int blkdev_report_zones(struct block_device *bdev, extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors, sector_t nr_sectors, gfp_t gfp_mask); +extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg); +extern int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg); + +#else /* CONFIG_BLK_DEV_ZONED */ + +static inline int blkdev_report_zones_ioctl(struct block_device *bdev, + fmode_t mode, unsigned int cmd, + unsigned long arg) +{ + return -ENOTTY; +} + +static inline int blkdev_reset_zones_ioctl(struct block_device *bdev, + fmode_t mode, unsigned int cmd, + unsigned long arg) +{ + return -ENOTTY; +} + #endif /* CONFIG_BLK_DEV_ZONED */ struct request_queue { diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h index a381721..40d1d7b 100644 --- a/include/uapi/linux/blkzoned.h +++ b/include/uapi/linux/blkzoned.h @@ -16,6 +16,7 @@ #define _UAPI_BLKZONED_H #include +#include /** * enum blk_zone_type - Types of zones allowed in a zoned device. @@ -100,4 +101,43 @@ struct blk_zone { __u8 reserved[36]; }; +/** + * struct blk_zone_report - BLKREPORTZONE ioctl request/reply + * + * @sector: starting sector of report + * @nr_zones: IN maximum / OUT actual + * @reserved: padding to 16 byte alignment + * @zones: Space to hold @nr_zones @zones entries on reply. + * + * The array of at most @nr_zones must follow this structure in memory. + */ +struct blk_zone_report { + __u64 sector; + __u32 nr_zones; + __u8 reserved[4]; + struct blk_zone zones[0]; +} __packed; + +/** + * struct blk_zone_range - BLKRESETZONE ioctl request + * @sector: starting sector of the first zone to issue reset write pointer + * @nr_sectors: Total number of sectors of 1 or more zones to reset + */ +struct blk_zone_range { + __u64 sector; + __u64 nr_sectors; +}; + +/** + * Zoned block device ioctl's: + * + * @BLKREPORTZONE: Get zone information. Takes a zone report as argument. + * The zone report will start from the zone containing the + * 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. + */ +#define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report) +#define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range) + #endif /* _UAPI_BLKZONED_H */ diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 3b00f7c..e0fc7f0 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -222,6 +222,10 @@ struct fsxattr { #define BLKSECDISCARD _IO(0x12,125) #define BLKROTATIONAL _IO(0x12,126) #define BLKZEROOUT _IO(0x12,127) +/* + * A jump here: 130-131 are reserved for zoned block devices + * (see uapi/linux/blkzoned.h) + */ #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */