diff mbox series

[v2] block: soft limit zone-append sectors as well

Message ID 628d87042f902553d0f27028801f857393ae225b.1602074038.git.johannes.thumshirn@wdc.com (mailing list archive)
State New
Headers show
Series [v2] block: soft limit zone-append sectors as well | expand

Commit Message

Johannes Thumshirn Oct. 7, 2020, 12:35 p.m. UTC
Martin rightfully noted that for normal filesystem IO we have soft limits
in place, to prevent them from getting too big and not lead to
unpredictable latencies. For zone append we only have the hardware limit
in place.

Cap the max sectors we submit via zone-append to the maximal number of
sectors if the second limit is lower.

Link: https://lore.kernel.org/linux-btrfs/yq1k0w8g3rw.fsf@ca-mkp.ca.oracle.com
Reported-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
Changes to v1:
- Commit the compile error fix *doh*
- Add reviews

 include/linux/blkdev.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jens Axboe Oct. 7, 2020, 2:22 p.m. UTC | #1
On 10/7/20 6:35 AM, Johannes Thumshirn wrote:
> Martin rightfully noted that for normal filesystem IO we have soft limits
> in place, to prevent them from getting too big and not lead to
> unpredictable latencies. For zone append we only have the hardware limit
> in place.
> 
> Cap the max sectors we submit via zone-append to the maximal number of
> sectors if the second limit is lower.

Applied, thanks.
Johannes Thumshirn Oct. 7, 2020, 2:23 p.m. UTC | #2
On 07/10/2020 16:22, Jens Axboe wrote:
> On 10/7/20 6:35 AM, Johannes Thumshirn wrote:
>> Martin rightfully noted that for normal filesystem IO we have soft limits
>> in place, to prevent them from getting too big and not lead to
>> unpredictable latencies. For zone append we only have the hardware limit
>> in place.
>>
>> Cap the max sectors we submit via zone-append to the maximal number of
>> sectors if the second limit is lower.
> 
> Applied, thanks.
> 

Thanks :)
diff mbox series

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index cf80e61b4c5e..ed52fbf1fa31 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1406,7 +1406,10 @@  static inline unsigned int queue_max_segment_size(const struct request_queue *q)
 
 static inline unsigned int queue_max_zone_append_sectors(const struct request_queue *q)
 {
-	return q->limits.max_zone_append_sectors;
+
+	const struct queue_limits *l = &q->limits;
+
+	return min(l->max_zone_append_sectors, l->max_sectors);
 }
 
 static inline unsigned queue_logical_block_size(const struct request_queue *q)