linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] brd: remove max_hw_sectors limit and warn on un-aligned buffer
@ 2019-12-04 11:31 Ming Lei
  2019-12-04 11:31 ` [PATCH 1/2] brd: remove max_hw_sectors queue limit Ming Lei
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ming Lei @ 2019-12-04 11:31 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Stephen Rust

Hi,

The 1st patch removes max_hw_sectors queue limit.

The 2nd one adds warning on un-aligned buffer.


Ming Lei (2):
  brd: remove max_hw_sectors queue limit
  brd: warn on un-aligned buffer

 drivers/block/brd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Cc: Stephen Rust <srust@blockbridge.com>

-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] brd: remove max_hw_sectors queue limit
  2019-12-04 11:31 [PATCH 0/2] brd: remove max_hw_sectors limit and warn on un-aligned buffer Ming Lei
@ 2019-12-04 11:31 ` Ming Lei
  2019-12-04 11:31 ` [PATCH 2/2] brd: warn on un-aligned buffer Ming Lei
  2019-12-04 16:04 ` [PATCH 0/2] brd: remove max_hw_sectors limit and " Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Ming Lei @ 2019-12-04 11:31 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei

Now we depend on blk_queue_split() to respect most of queue limit
(the only one exception could be dma alignment), however
blk_queue_split() isn't used for brd, so this limit isn't respected
since v4.3.

Also max_hw_sectors limit doesn't play a big role for brd, which is
added since brd is added to tree for unknown reason.

So remove it.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 drivers/block/brd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index c548a5a6c1a0..c2e5b2ad88bc 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -382,7 +382,6 @@ static struct brd_device *brd_alloc(int i)
 		goto out_free_dev;
 
 	blk_queue_make_request(brd->brd_queue, brd_make_request);
-	blk_queue_max_hw_sectors(brd->brd_queue, 1024);
 
 	/* This is so fdisk will align partitions on 4k, because of
 	 * direct_access API needing 4k alignment, returning a PFN
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] brd: warn on un-aligned buffer
  2019-12-04 11:31 [PATCH 0/2] brd: remove max_hw_sectors limit and warn on un-aligned buffer Ming Lei
  2019-12-04 11:31 ` [PATCH 1/2] brd: remove max_hw_sectors queue limit Ming Lei
@ 2019-12-04 11:31 ` Ming Lei
  2019-12-04 16:04 ` [PATCH 0/2] brd: remove max_hw_sectors limit and " Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Ming Lei @ 2019-12-04 11:31 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Stephen Rust

Queue dma alignment limit requires users(fs, target, ...) of block layer
to pass aligned buffer.

So far brd doesn't support un-aligned buffer, even though it is easy
to support it.

However, given brd is often used for debug purpose, and there are other
drivers which can't support un-aligned buffer too.

So add warning so that brd users know what to fix.

Reported-by: Stephen Rust <srust@blockbridge.com>
Cc: Stephen Rust <srust@blockbridge.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 drivers/block/brd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index c2e5b2ad88bc..a8730cc4db10 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -297,6 +297,10 @@ static blk_qc_t brd_make_request(struct request_queue *q, struct bio *bio)
 		unsigned int len = bvec.bv_len;
 		int err;
 
+		/* Don't support un-aligned buffer */
+		WARN_ON_ONCE((bvec.bv_offset & (SECTOR_SIZE - 1)) ||
+				(len & (SECTOR_SIZE - 1)));
+
 		err = brd_do_bvec(brd, bvec.bv_page, len, bvec.bv_offset,
 				  bio_op(bio), sector);
 		if (err)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] brd: remove max_hw_sectors limit and warn on un-aligned buffer
  2019-12-04 11:31 [PATCH 0/2] brd: remove max_hw_sectors limit and warn on un-aligned buffer Ming Lei
  2019-12-04 11:31 ` [PATCH 1/2] brd: remove max_hw_sectors queue limit Ming Lei
  2019-12-04 11:31 ` [PATCH 2/2] brd: warn on un-aligned buffer Ming Lei
@ 2019-12-04 16:04 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2019-12-04 16:04 UTC (permalink / raw)
  To: Ming Lei; +Cc: linux-block, Stephen Rust

On 12/4/19 4:31 AM, Ming Lei wrote:
> Hi,
> 
> The 1st patch removes max_hw_sectors queue limit.
> 
> The 2nd one adds warning on un-aligned buffer.
> 
> 
> Ming Lei (2):
>    brd: remove max_hw_sectors queue limit
>    brd: warn on un-aligned buffer
> 
>   drivers/block/brd.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> Cc: Stephen Rust <srust@blockbridge.com>

Applied, thanks Ming.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-04 16:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 11:31 [PATCH 0/2] brd: remove max_hw_sectors limit and warn on un-aligned buffer Ming Lei
2019-12-04 11:31 ` [PATCH 1/2] brd: remove max_hw_sectors queue limit Ming Lei
2019-12-04 11:31 ` [PATCH 2/2] brd: warn on un-aligned buffer Ming Lei
2019-12-04 16:04 ` [PATCH 0/2] brd: remove max_hw_sectors limit and " Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).