* [PATCH 0/5] Five small zoned block device patches @ 2018-06-15 21:55 Bart Van Assche 2018-06-15 21:55 ` [PATCH 1/5] block: Remove a superfluous cast from blkdev_report_zones() Bart Van Assche ` (5 more replies) 0 siblings, 6 replies; 9+ messages in thread From: Bart Van Assche @ 2018-06-15 21:55 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, Bart Van Assche Hello Jens, In this patch series there are five patches with small improvements for the zoned block device code. Please consider these patches for the upstream kernel. Thanks, Bart. Bart Van Assche (5): block: Remove a superfluous cast from blkdev_report_zones() include/uapi/linux/blkzoned.h: Remove a superfluous __packed directive block: Remove bdev_nr_zones() block: Inline blk_queue_nr_zones() block: Make struct request_queue smaller for CONFIG_BLK_DEV_ZONED=n block/Kconfig | 4 ++++ block/Makefile | 1 + block/blk-mq-debugfs-zoned.c | 24 ++++++++++++++++++++++++ block/blk-mq-debugfs.c | 15 --------------- block/blk-mq-debugfs.h | 9 +++++++++ block/blk-zoned.c | 2 +- include/linux/blkdev.h | 20 ++++++-------------- include/uapi/linux/blkzoned.h | 2 +- 8 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 block/blk-mq-debugfs-zoned.c -- 2.17.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/5] block: Remove a superfluous cast from blkdev_report_zones() 2018-06-15 21:55 [PATCH 0/5] Five small zoned block device patches Bart Van Assche @ 2018-06-15 21:55 ` Bart Van Assche 2018-06-15 21:55 ` [PATCH 2/5] include/uapi/linux/blkzoned.h: Remove a superfluous __packed directive Bart Van Assche ` (4 subsequent siblings) 5 siblings, 0 replies; 9+ messages in thread From: Bart Van Assche @ 2018-06-15 21:55 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Matias Bjorling No cast is necessary when assigning a non-void pointer to a void pointer. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Cc: Matias Bjorling <mb@lightnvm.io> Cc: Christoph Hellwig <hch@lst.de> --- block/blk-zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 3d08dc84db16..92e6108487c4 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -200,7 +200,7 @@ int blkdev_report_zones(struct block_device *bdev, /* Get header in the first page */ ofst = 0; if (!nr_rep) { - hdr = (struct blk_zone_report_hdr *) addr; + hdr = addr; nr_rep = hdr->nr_zones; ofst = sizeof(struct blk_zone_report_hdr); } -- 2.17.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/5] include/uapi/linux/blkzoned.h: Remove a superfluous __packed directive 2018-06-15 21:55 [PATCH 0/5] Five small zoned block device patches Bart Van Assche 2018-06-15 21:55 ` [PATCH 1/5] block: Remove a superfluous cast from blkdev_report_zones() Bart Van Assche @ 2018-06-15 21:55 ` Bart Van Assche 2018-06-15 21:55 ` [PATCH 3/5] block: Remove bdev_nr_zones() Bart Van Assche ` (3 subsequent siblings) 5 siblings, 0 replies; 9+ messages in thread From: Bart Van Assche @ 2018-06-15 21:55 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Matias Bjorling Using the __packed directive for a structure that does not need it is wrong because it makes gcc generate suboptimal code on some architectures. Hence remove the __packed directive from the blk_zone_report structure definition. See also http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Cc: Matias Bjorling <mb@lightnvm.io> Cc: Christoph Hellwig <hch@lst.de> --- include/uapi/linux/blkzoned.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h index e3c70fe6bf0f..ff5a5db8906a 100644 --- a/include/uapi/linux/blkzoned.h +++ b/include/uapi/linux/blkzoned.h @@ -117,7 +117,7 @@ struct blk_zone_report { __u32 nr_zones; __u8 reserved[4]; struct blk_zone zones[0]; -} __packed; +}; /** * struct blk_zone_range - BLKRESETZONE ioctl request -- 2.17.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5] block: Remove bdev_nr_zones() 2018-06-15 21:55 [PATCH 0/5] Five small zoned block device patches Bart Van Assche 2018-06-15 21:55 ` [PATCH 1/5] block: Remove a superfluous cast from blkdev_report_zones() Bart Van Assche 2018-06-15 21:55 ` [PATCH 2/5] include/uapi/linux/blkzoned.h: Remove a superfluous __packed directive Bart Van Assche @ 2018-06-15 21:55 ` Bart Van Assche 2018-06-15 21:55 ` [PATCH 4/5] block: Inline blk_queue_nr_zones() Bart Van Assche ` (2 subsequent siblings) 5 siblings, 0 replies; 9+ messages in thread From: Bart Van Assche @ 2018-06-15 21:55 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Matias Bjorling Remove this function since it has no callers. This function was introduced in commit 6cc77e9cb080 ("block: introduce zoned block devices zone write locking"). Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Matias Bjorling <mb@lightnvm.io> --- include/linux/blkdev.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index a8b98eadebb2..05cd0c8e5735 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1648,15 +1648,6 @@ static inline unsigned int bdev_zone_sectors(struct block_device *bdev) return 0; } -static inline unsigned int bdev_nr_zones(struct block_device *bdev) -{ - struct request_queue *q = bdev_get_queue(bdev); - - if (q) - return blk_queue_nr_zones(q); - return 0; -} - static inline int queue_dma_alignment(struct request_queue *q) { return q ? q->dma_alignment : 511; -- 2.17.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/5] block: Inline blk_queue_nr_zones() 2018-06-15 21:55 [PATCH 0/5] Five small zoned block device patches Bart Van Assche ` (2 preceding siblings ...) 2018-06-15 21:55 ` [PATCH 3/5] block: Remove bdev_nr_zones() Bart Van Assche @ 2018-06-15 21:55 ` Bart Van Assche 2018-06-15 21:55 ` [PATCH 5/5] block: Make struct request_queue smaller for CONFIG_BLK_DEV_ZONED=n Bart Van Assche 2018-06-16 18:27 ` [PATCH 0/5] Five small zoned block device patches Jens Axboe 5 siblings, 0 replies; 9+ messages in thread From: Bart Van Assche @ 2018-06-15 21:55 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Matias Bjorling Since the implementation of blk_queue_nr_zones() is trivial and since it only has a single caller, inline this function. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Cc: Matias Bjorling <mb@lightnvm.io> Cc: Christoph Hellwig <hch@lst.de> --- block/blk-mq-debugfs.c | 2 +- include/linux/blkdev.h | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 67aa2d4e2e89..b92ef4c3038e 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -214,7 +214,7 @@ static int queue_zone_wlock_show(void *data, struct seq_file *m) if (!q->seq_zones_wlock) return 0; - for (i = 0; i < blk_queue_nr_zones(q); i++) + for (i = 0; i < q->nr_zones; i++) if (test_bit(i, q->seq_zones_wlock)) seq_printf(m, "%u\n", i); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 05cd0c8e5735..96640bcd5e78 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -800,11 +800,6 @@ static inline unsigned int blk_queue_zone_sectors(struct request_queue *q) return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; } -static inline unsigned int blk_queue_nr_zones(struct request_queue *q) -{ - return q->nr_zones; -} - static inline unsigned int blk_queue_zone_no(struct request_queue *q, sector_t sector) { -- 2.17.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/5] block: Make struct request_queue smaller for CONFIG_BLK_DEV_ZONED=n 2018-06-15 21:55 [PATCH 0/5] Five small zoned block device patches Bart Van Assche ` (3 preceding siblings ...) 2018-06-15 21:55 ` [PATCH 4/5] block: Inline blk_queue_nr_zones() Bart Van Assche @ 2018-06-15 21:55 ` Bart Van Assche 2018-06-16 18:27 ` [PATCH 0/5] Five small zoned block device patches Jens Axboe 5 siblings, 0 replies; 9+ messages in thread From: Bart Van Assche @ 2018-06-15 21:55 UTC (permalink / raw) To: Jens Axboe Cc: linux-block, Christoph Hellwig, Bart Van Assche, Matias Bjorling Exclude zoned block device members from struct request_queue for CONFIG_BLK_DEV_ZONED == n. Avoid breaking the build by only building the code that uses these struct request_queue members if CONFIG_BLK_DEV_ZONED != n. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Cc: Matias Bjorling <mb@lightnvm.io> Cc: Christoph Hellwig <hch@lst.de> --- block/Kconfig | 4 ++++ block/Makefile | 1 + block/blk-mq-debugfs-zoned.c | 24 ++++++++++++++++++++++++ block/blk-mq-debugfs.c | 15 --------------- block/blk-mq-debugfs.h | 9 +++++++++ include/linux/blkdev.h | 6 ++++++ 6 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 block/blk-mq-debugfs-zoned.c diff --git a/block/Kconfig b/block/Kconfig index 28ec55752b68..0514f0b61226 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -177,6 +177,10 @@ config BLK_DEBUG_FS Unless you are building a kernel for a tiny system, you should say Y here. +config BLK_DEBUG_FS_ZONED + bool + default BLK_DEBUG_FS && BLK_DEV_ZONED + config BLK_SED_OPAL bool "Logic for interfacing with Opal enabled SEDs" ---help--- diff --git a/block/Makefile b/block/Makefile index 6a56303b9925..a8f94cdb75c3 100644 --- a/block/Makefile +++ b/block/Makefile @@ -34,4 +34,5 @@ obj-$(CONFIG_BLK_MQ_RDMA) += blk-mq-rdma.o obj-$(CONFIG_BLK_DEV_ZONED) += blk-zoned.o obj-$(CONFIG_BLK_WBT) += blk-wbt.o obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o +obj-$(CONFIG_BLK_DEBUG_FS_ZONED)+= blk-mq-debugfs-zoned.o obj-$(CONFIG_BLK_SED_OPAL) += sed-opal.o diff --git a/block/blk-mq-debugfs-zoned.c b/block/blk-mq-debugfs-zoned.c new file mode 100644 index 000000000000..fb2c82c351e4 --- /dev/null +++ b/block/blk-mq-debugfs-zoned.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2017 Western Digital Corporation or its affiliates. + * + * This file is released under the GPL. + */ + +#include <linux/blkdev.h> +#include "blk-mq-debugfs.h" + +int queue_zone_wlock_show(void *data, struct seq_file *m) +{ + struct request_queue *q = data; + unsigned int i; + + if (!q->seq_zones_wlock) + return 0; + + for (i = 0; i < q->nr_zones; i++) + if (test_bit(i, q->seq_zones_wlock)) + seq_printf(m, "%u\n", i); + + return 0; +} diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index b92ef4c3038e..9907e6610656 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -206,21 +206,6 @@ static ssize_t queue_write_hint_store(void *data, const char __user *buf, return count; } -static int queue_zone_wlock_show(void *data, struct seq_file *m) -{ - struct request_queue *q = data; - unsigned int i; - - if (!q->seq_zones_wlock) - return 0; - - for (i = 0; i < q->nr_zones; i++) - if (test_bit(i, q->seq_zones_wlock)) - seq_printf(m, "%u\n", i); - - return 0; -} - static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = { { "poll_stat", 0400, queue_poll_stat_show }, { "requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops }, diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h index b3342d8dc934..d287638b2c6a 100644 --- a/block/blk-mq-debugfs.h +++ b/block/blk-mq-debugfs.h @@ -81,4 +81,13 @@ static inline void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hc } #endif +#ifdef CONFIG_BLK_DEBUG_FS_ZONED +int queue_zone_wlock_show(void *data, struct seq_file *m); +#else +static inline int queue_zone_wlock_show(void *data, struct seq_file *m) +{ + return 0; +} +#endif + #endif diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 96640bcd5e78..f7c8dcd3127c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -589,6 +589,7 @@ struct request_queue { struct queue_limits limits; +#ifdef CONFIG_BLK_DEV_ZONED /* * Zoned block device information for request dispatch control. * nr_zones is the total number of zones of the device. This is always @@ -609,6 +610,7 @@ struct request_queue { unsigned int nr_zones; unsigned long *seq_zones_bitmap; unsigned long *seq_zones_wlock; +#endif /* CONFIG_BLK_DEV_ZONED */ /* * sg stuff @@ -800,6 +802,7 @@ static inline unsigned int blk_queue_zone_sectors(struct request_queue *q) return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; } +#ifdef CONFIG_BLK_DEV_ZONED static inline unsigned int blk_queue_zone_no(struct request_queue *q, sector_t sector) { @@ -815,6 +818,7 @@ static inline bool blk_queue_zone_is_seq(struct request_queue *q, return false; return test_bit(blk_queue_zone_no(q, sector), q->seq_zones_bitmap); } +#endif /* CONFIG_BLK_DEV_ZONED */ static inline bool rq_is_sync(struct request *rq) { @@ -1073,6 +1077,7 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq) return blk_rq_cur_bytes(rq) >> SECTOR_SHIFT; } +#ifdef CONFIG_BLK_DEV_ZONED static inline unsigned int blk_rq_zone_no(struct request *rq) { return blk_queue_zone_no(rq->q, blk_rq_pos(rq)); @@ -1082,6 +1087,7 @@ static inline unsigned int blk_rq_zone_is_seq(struct request *rq) { return blk_queue_zone_is_seq(rq->q, blk_rq_pos(rq)); } +#endif /* CONFIG_BLK_DEV_ZONED */ /* * Some commands like WRITE SAME have a payload or data transfer size which -- 2.17.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] Five small zoned block device patches 2018-06-15 21:55 [PATCH 0/5] Five small zoned block device patches Bart Van Assche ` (4 preceding siblings ...) 2018-06-15 21:55 ` [PATCH 5/5] block: Make struct request_queue smaller for CONFIG_BLK_DEV_ZONED=n Bart Van Assche @ 2018-06-16 18:27 ` Jens Axboe 2018-06-16 20:58 ` Bart Van Assche 5 siblings, 1 reply; 9+ messages in thread From: Jens Axboe @ 2018-06-16 18:27 UTC (permalink / raw) To: Bart Van Assche; +Cc: linux-block, Christoph Hellwig On 6/15/18 3:55 PM, Bart Van Assche wrote: > Hello Jens, > > In this patch series there are five patches with small improvements for the > zoned block device code. Please consider these patches for the upstream kernel. Looks fine to me. Are you thinking 4.18 or 4.19? -- Jens Axboe ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] Five small zoned block device patches 2018-06-16 18:27 ` [PATCH 0/5] Five small zoned block device patches Jens Axboe @ 2018-06-16 20:58 ` Bart Van Assche 2018-06-16 21:00 ` Jens Axboe 0 siblings, 1 reply; 9+ messages in thread From: Bart Van Assche @ 2018-06-16 20:58 UTC (permalink / raw) To: axboe; +Cc: hch, linux-block T24gU2F0LCAyMDE4LTA2LTE2IGF0IDEyOjI3IC0wNjAwLCBKZW5zIEF4Ym9lIHdyb3RlOg0KPiBP biA2LzE1LzE4IDM6NTUgUE0sIEJhcnQgVmFuIEFzc2NoZSB3cm90ZToNCj4gPiBIZWxsbyBKZW5z LA0KPiA+IA0KPiA+IEluIHRoaXMgcGF0Y2ggc2VyaWVzIHRoZXJlIGFyZSBmaXZlIHBhdGNoZXMg d2l0aCBzbWFsbCBpbXByb3ZlbWVudHMgZm9yIHRoZQ0KPiA+IHpvbmVkIGJsb2NrIGRldmljZSBj b2RlLiBQbGVhc2UgY29uc2lkZXIgdGhlc2UgcGF0Y2hlcyBmb3IgdGhlIHVwc3RyZWFtIGtlcm5l bC4NCj4gDQo+IExvb2tzIGZpbmUgdG8gbWUuIEFyZSB5b3UgdGhpbmtpbmcgNC4xOCBvciA0LjE5 Pw0KDQpIZWxsbyBKZW5zLA0KDQpJJ20gZmluZSB3aXRoIGVpdGhlciBrZXJuZWwgdmVyc2lvbi4g VGhlc2UgcGF0Y2hlcyBkbyBub3QgY2hhbmdlIGFueQ0KZnVuY3Rpb25hbGl0eSBzbyBxdWV1aW5n IHRoZXNlIHBhdGNoZXMgaXMgbm90IHVyZ2VudC4gSG93ZXZlciwgdGhlIHNvb25lcg0KdGhlc2Ug Z2V0IHVwc3RyZWFtIHRoZSBsb3dlciB0aGUgY2hhbmdlIHRoYXQgYW55IGJ1ZyBmaXhlcyB0aGF0 IHRvdWNoIHRoZQ0Kc2FtZSBjb2RlIGNvbmZsaWN0IHdpdGggdGhpcyBwYXRjaCBzZXJpZXMgLi4u DQoNClRoYW5rcywNCg0KQmFydC4NCg0KDQoNCg== ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] Five small zoned block device patches 2018-06-16 20:58 ` Bart Van Assche @ 2018-06-16 21:00 ` Jens Axboe 0 siblings, 0 replies; 9+ messages in thread From: Jens Axboe @ 2018-06-16 21:00 UTC (permalink / raw) To: Bart Van Assche; +Cc: hch, linux-block On 6/16/18 2:58 PM, Bart Van Assche wrote: > On Sat, 2018-06-16 at 12:27 -0600, Jens Axboe wrote: >> On 6/15/18 3:55 PM, Bart Van Assche wrote: >>> Hello Jens, >>> >>> In this patch series there are five patches with small improvements for the >>> zoned block device code. Please consider these patches for the upstream kernel. >> >> Looks fine to me. Are you thinking 4.18 or 4.19? > > Hello Jens, > > I'm fine with either kernel version. These patches do not change any > functionality so queuing these patches is not urgent. However, the sooner > these get upstream the lower the change that any bug fixes that touch the > same code conflict with this patch series ... I like them all as cleanups, but as cleanups I think we should queue them up for 4.19. I'll do that. -- Jens Axboe ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-06-16 21:00 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-06-15 21:55 [PATCH 0/5] Five small zoned block device patches Bart Van Assche 2018-06-15 21:55 ` [PATCH 1/5] block: Remove a superfluous cast from blkdev_report_zones() Bart Van Assche 2018-06-15 21:55 ` [PATCH 2/5] include/uapi/linux/blkzoned.h: Remove a superfluous __packed directive Bart Van Assche 2018-06-15 21:55 ` [PATCH 3/5] block: Remove bdev_nr_zones() Bart Van Assche 2018-06-15 21:55 ` [PATCH 4/5] block: Inline blk_queue_nr_zones() Bart Van Assche 2018-06-15 21:55 ` [PATCH 5/5] block: Make struct request_queue smaller for CONFIG_BLK_DEV_ZONED=n Bart Van Assche 2018-06-16 18:27 ` [PATCH 0/5] Five small zoned block device patches Jens Axboe 2018-06-16 20:58 ` Bart Van Assche 2018-06-16 21:00 ` Jens Axboe
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.