lkml.org 
[lkml]   [2016]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCHv2]brd: set max_discard_sectors properly
Hi,

blkdiscard fails on brd with IO error on 4.4.5, and latest mainline
looks the same.
nbd and zram has same defect, I can send fix later, if you are Ok with this fix.
From a5db7d1acdb54b7f188eb916f711733e34da5b5f Mon Sep 17 00:00:00 2001
From: Jack Wang <jinpu.wang@profitbricks.com>
Date: Fri, 15 Apr 2016 16:05:16 +0200
Subject: [PATCH] brd: set max_discard_sectors properly

blkdiscard -v /dev/ram0 fails with IO errors, the reason seems to be,
it set max_discard_sectors to UINT_MAX, which seems to wrong, need to
convert to sectors.

After this change blkdiscard works.

Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
---
drivers/block/brd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index a5880f4..a5e3c0f 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -503,7 +503,7 @@ static struct brd_device *brd_alloc(int i)
blk_queue_physical_block_size(brd->brd_queue, PAGE_SIZE);

brd->brd_queue->limits.discard_granularity = PAGE_SIZE;
- blk_queue_max_discard_sectors(brd->brd_queue, UINT_MAX);
+ blk_queue_max_discard_sectors(brd->brd_queue, UINT_MAX >> 9);
brd->brd_queue->limits.discard_zeroes_data = 1;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, brd->brd_queue);

--
1.9.1
\
 
 \ /
  Last update: 2016-04-15 16:41    [W:0.051 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site