Linux-Block Archive on lore.kernel.org
 help / Atom feed
* [PATCH] null_blk: add zoned config support information
@ 2019-01-04 15:42 John Pittman
  2019-01-04 15:59 ` Laurence Oberman
  2019-01-04 16:46 ` Bart Van Assche
  0 siblings, 2 replies; 8+ messages in thread
From: John Pittman @ 2019-01-04 15:42 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, John Pittman

If the kernel is built without CONFIG_BLK_DEV_ZONED, a modprobe
of the null_blk driver with zoned=1 fails with 'Invalid argument'.
This can be confusing to users, prompting a search as to why the
parameter is invalid. To assist in that search, add a bit more
information to the failure, additionally adding to the documentation
that CONFIG_BLK_DEV_ZONED is needed for zoned=1.

Signed-off-by: John Pittman <jpittman@redhat.com>
---
 Documentation/block/null_blk.txt | 3 ++-
 drivers/block/null_blk.h         | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/block/null_blk.txt b/Documentation/block/null_blk.txt
index ea2dafe49ae8..4cad1024fff7 100644
--- a/Documentation/block/null_blk.txt
+++ b/Documentation/block/null_blk.txt
@@ -88,7 +88,8 @@ shared_tags=[0/1]: Default: 0
 
 zoned=[0/1]: Default: 0
   0: Block device is exposed as a random-access block device.
-  1: Block device is exposed as a host-managed zoned block device.
+  1: Block device is exposed as a host-managed zoned block device. Requires
+     CONFIG_BLK_DEV_ZONED.
 
 zone_size=[MB]: Default: 256
   Per zone size when exposed as a zoned block device. Must be a power of two.
diff --git a/drivers/block/null_blk.h b/drivers/block/null_blk.h
index b3df2793e7cd..cab4808f14bd 100644
--- a/drivers/block/null_blk.h
+++ b/drivers/block/null_blk.h
@@ -97,6 +97,7 @@ void null_zone_reset(struct nullb_cmd *cmd, sector_t sector);
 #else
 static inline int null_zone_init(struct nullb_device *dev)
 {
+	pr_info("CONFIG_BLK_DEV_ZONED not enabled\n");
 	return -EINVAL;
 }
 static inline void null_zone_exit(struct nullb_device *dev) {}
-- 
2.17.2


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

* Re: [PATCH] null_blk: add zoned config support information
  2019-01-04 15:42 [PATCH] null_blk: add zoned config support information John Pittman
@ 2019-01-04 15:59 ` Laurence Oberman
  2019-01-04 16:46 ` Bart Van Assche
  1 sibling, 0 replies; 8+ messages in thread
From: Laurence Oberman @ 2019-01-04 15:59 UTC (permalink / raw)
  To: John Pittman, axboe; +Cc: linux-block

On Fri, 2019-01-04 at 10:42 -0500, John Pittman wrote:
> If the kernel is built without CONFIG_BLK_DEV_ZONED, a modprobe
> of the null_blk driver with zoned=1 fails with 'Invalid argument'.
> This can be confusing to users, prompting a search as to why the
> parameter is invalid. To assist in that search, add a bit more
> information to the failure, additionally adding to the documentation
> that CONFIG_BLK_DEV_ZONED is needed for zoned=1.
> 
> Signed-off-by: John Pittman <jpittman@redhat.com>
> ---
>  Documentation/block/null_blk.txt | 3 ++-
>  drivers/block/null_blk.h         | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/block/null_blk.txt
> b/Documentation/block/null_blk.txt
> index ea2dafe49ae8..4cad1024fff7 100644
> --- a/Documentation/block/null_blk.txt
> +++ b/Documentation/block/null_blk.txt
> @@ -88,7 +88,8 @@ shared_tags=[0/1]: Default: 0
>  
>  zoned=[0/1]: Default: 0
>    0: Block device is exposed as a random-access block device.
> -  1: Block device is exposed as a host-managed zoned block device.
> +  1: Block device is exposed as a host-managed zoned block device.
> Requires
> +     CONFIG_BLK_DEV_ZONED.
>  
>  zone_size=[MB]: Default: 256
>    Per zone size when exposed as a zoned block device. Must be a
> power of two.
> diff --git a/drivers/block/null_blk.h b/drivers/block/null_blk.h
> index b3df2793e7cd..cab4808f14bd 100644
> --- a/drivers/block/null_blk.h
> +++ b/drivers/block/null_blk.h
> @@ -97,6 +97,7 @@ void null_zone_reset(struct nullb_cmd *cmd,
> sector_t sector);
>  #else
>  static inline int null_zone_init(struct nullb_device *dev)
>  {
> +	pr_info("CONFIG_BLK_DEV_ZONED not enabled\n");
>  	return -EINVAL;
>  }
>  static inline void null_zone_exit(struct nullb_device *dev) {}

Looks good to me, useful change in my opinion.

Reviewed-by: Laurence Oberman <loberman@redhat.com>

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

* Re: [PATCH] null_blk: add zoned config support information
  2019-01-04 15:42 [PATCH] null_blk: add zoned config support information John Pittman
  2019-01-04 15:59 ` Laurence Oberman
@ 2019-01-04 16:46 ` Bart Van Assche
  2019-01-04 16:58   ` Laurence Oberman
  2019-01-04 20:37   ` John Pittman
  1 sibling, 2 replies; 8+ messages in thread
From: Bart Van Assche @ 2019-01-04 16:46 UTC (permalink / raw)
  To: John Pittman, axboe; +Cc: linux-block

On Fri, 2019-01-04 at 10:42 -0500, John Pittman wrote:
+AD4  static inline int null+AF8-zone+AF8-init(struct nullb+AF8-device +ACo-dev)
+AD4  +AHs
+AD4 +-	pr+AF8-info(+ACI-CONFIG+AF8-BLK+AF8-DEV+AF8-ZONED not enabled+AFw-n+ACI)+ADs
+AD4  	return -EINVAL+ADs
+AD4  +AH0

Have you considered to use pr+AF8-err() instead of pr+AF8-info()?

Thanks,

Bart.

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

* Re: [PATCH] null_blk: add zoned config support information
  2019-01-04 16:46 ` Bart Van Assche
@ 2019-01-04 16:58   ` Laurence Oberman
  2019-01-04 20:37   ` John Pittman
  1 sibling, 0 replies; 8+ messages in thread
From: Laurence Oberman @ 2019-01-04 16:58 UTC (permalink / raw)
  To: Bart Van Assche, John Pittman, axboe; +Cc: linux-block

On Fri, 2019-01-04 at 08:46 -0800, Bart Van Assche wrote:
> On Fri, 2019-01-04 at 10:42 -0500, John Pittman wrote:
> >  static inline int null_zone_init(struct nullb_device *dev)
> >  {
> > +	pr_info("CONFIG_BLK_DEV_ZONED not enabled\n");
> >  	return -EINVAL;
> >  }
> 
> Have you considered to use pr_err() instead of pr_info()?
> 
> Thanks,
> 
> Bart.
Bart, good point, Thank you
Laurence

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

* Re: [PATCH] null_blk: add zoned config support information
  2019-01-04 16:46 ` Bart Van Assche
  2019-01-04 16:58   ` Laurence Oberman
@ 2019-01-04 20:37   ` John Pittman
  2019-01-04 20:49     ` Bart Van Assche
  2019-01-06 19:23     ` Jens Axboe
  1 sibling, 2 replies; 8+ messages in thread
From: John Pittman @ 2019-01-04 20:37 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Jens Axboe, linux-block

Thanks Bart; I made the changes and sent them in as a v2, I'm sure you
already saw.  I have a quick, unrelated question if you have a moment.
In testing the null_blk driver, I found that trim commands sent by fio
were rejected due to lack of support.  Tracking down Shaohua's commit
306eb6b4a ("nullb: support discard"), he mentions that "discard makes
sense for memory backed disk".  Just to see what would happen, I
edited the source to make discard a configurable parameter at
modprobe, and after the edit & build, the trim commands submitted
fine.  Does this sort of change make sense?  I mean the ability to do
discard to null_blk without it being memory backed;  solely for
testing/benchmarking purposes.  I haven't found any good instructions
on creating a memory backed or discard enabled null_blk device from
the command line, so I assume a higher level driver would have to hook
in and enable these features manually.  Thanks for your time and any
information.
John

On Fri, Jan 4, 2019 at 11:47 AM Bart Van Assche <bvanassche@acm.org> wrote:
>
> On Fri, 2019-01-04 at 10:42 -0500, John Pittman wrote:
> >  static inline int null_zone_init(struct nullb_device *dev)
> >  {
> > +     pr_info("CONFIG_BLK_DEV_ZONED not enabled\n");
> >       return -EINVAL;
> >  }
>
> Have you considered to use pr_err() instead of pr_info()?
>
> Thanks,
>
> Bart.

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

* Re: [PATCH] null_blk: add zoned config support information
  2019-01-04 20:37   ` John Pittman
@ 2019-01-04 20:49     ` Bart Van Assche
  2019-01-04 21:07       ` John Pittman
  2019-01-06 19:23     ` Jens Axboe
  1 sibling, 1 reply; 8+ messages in thread
From: Bart Van Assche @ 2019-01-04 20:49 UTC (permalink / raw)
  To: John Pittman; +Cc: Jens Axboe, linux-block

On Fri, 2019-01-04 at 15:37 -0500, John Pittman wrote:
+AD4 Thanks Bart+ADs I made the changes and sent them in as a v2, I'm sure you
+AD4 already saw.  I have a quick, unrelated question if you have a moment.
+AD4 In testing the null+AF8-blk driver, I found that trim commands sent by fio
+AD4 were rejected due to lack of support.  Tracking down Shaohua's commit
+AD4 306eb6b4a (+ACI-nullb: support discard+ACI), he mentions that +ACI-discard makes
+AD4 sense for memory backed disk+ACI.  Just to see what would happen, I
+AD4 edited the source to make discard a configurable parameter at
+AD4 modprobe, and after the edit +ACY build, the trim commands submitted
+AD4 fine.  Does this sort of change make sense?  I mean the ability to do
+AD4 discard to null+AF8-blk without it being memory backed+ADs  solely for
+AD4 testing/benchmarking purposes.  I haven't found any good instructions
+AD4 on creating a memory backed or discard enabled null+AF8-blk device from
+AD4 the command line, so I assume a higher level driver would have to hook
+AD4 in and enable these features manually.  Thanks for your time and any
+AD4 information.

Hi John,

Jens as the block layer maintainer has the last word about this. Personally
I would welcome that functionality. Before discard functionality was removed
from the brd driver I used the brd driver to test the discard functionality
in storage target stacks. If discard functionality would be added to the
null+AF8-blk driver then that would make it possible to use that driver for
testing the discard functionality in e.g. LIO. See also commit f09a06a193d9
(+ACI-brd: remove discard support+ACI).

I'm not sure that we need a modprobe parameter to enable or disable trim
functionality in the null+AF8-blk driver. I'm fine with always enabling trim
functionality in that driver.

Bart.

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

* Re: [PATCH] null_blk: add zoned config support information
  2019-01-04 20:49     ` Bart Van Assche
@ 2019-01-04 21:07       ` John Pittman
  0 siblings, 0 replies; 8+ messages in thread
From: John Pittman @ 2019-01-04 21:07 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Jens Axboe, linux-block

Thanks Bart, I appreciate it.

On Fri, Jan 4, 2019 at 3:49 PM Bart Van Assche <bvanassche@acm.org> wrote:
>
> On Fri, 2019-01-04 at 15:37 -0500, John Pittman wrote:
> > Thanks Bart; I made the changes and sent them in as a v2, I'm sure you
> > already saw.  I have a quick, unrelated question if you have a moment.
> > In testing the null_blk driver, I found that trim commands sent by fio
> > were rejected due to lack of support.  Tracking down Shaohua's commit
> > 306eb6b4a ("nullb: support discard"), he mentions that "discard makes
> > sense for memory backed disk".  Just to see what would happen, I
> > edited the source to make discard a configurable parameter at
> > modprobe, and after the edit & build, the trim commands submitted
> > fine.  Does this sort of change make sense?  I mean the ability to do
> > discard to null_blk without it being memory backed;  solely for
> > testing/benchmarking purposes.  I haven't found any good instructions
> > on creating a memory backed or discard enabled null_blk device from
> > the command line, so I assume a higher level driver would have to hook
> > in and enable these features manually.  Thanks for your time and any
> > information.
>
> Hi John,
>
> Jens as the block layer maintainer has the last word about this. Personally
> I would welcome that functionality. Before discard functionality was removed
> from the brd driver I used the brd driver to test the discard functionality
> in storage target stacks. If discard functionality would be added to the
> null_blk driver then that would make it possible to use that driver for
> testing the discard functionality in e.g. LIO. See also commit f09a06a193d9
> ("brd: remove discard support").
>
> I'm not sure that we need a modprobe parameter to enable or disable trim
> functionality in the null_blk driver. I'm fine with always enabling trim
> functionality in that driver.
>
> Bart.

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

* Re: [PATCH] null_blk: add zoned config support information
  2019-01-04 20:37   ` John Pittman
  2019-01-04 20:49     ` Bart Van Assche
@ 2019-01-06 19:23     ` Jens Axboe
  1 sibling, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2019-01-06 19:23 UTC (permalink / raw)
  To: John Pittman, Bart Van Assche; +Cc: linux-block

On 1/4/19 1:37 PM, John Pittman wrote:
> Thanks Bart; I made the changes and sent them in as a v2, I'm sure you
> already saw.  I have a quick, unrelated question if you have a moment.
> In testing the null_blk driver, I found that trim commands sent by fio
> were rejected due to lack of support.  Tracking down Shaohua's commit
> 306eb6b4a ("nullb: support discard"), he mentions that "discard makes
> sense for memory backed disk".  Just to see what would happen, I
> edited the source to make discard a configurable parameter at
> modprobe, and after the edit & build, the trim commands submitted
> fine.  Does this sort of change make sense?  I mean the ability to do
> discard to null_blk without it being memory backed;  solely for
> testing/benchmarking purposes.  I haven't found any good instructions
> on creating a memory backed or discard enabled null_blk device from
> the command line, so I assume a higher level driver would have to hook
> in and enable these features manually.  Thanks for your time and any
> information.

I think that would be fine, no option needed. It's really no different
than reads/writes being completed without having a memory backing.

-- 
Jens Axboe


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

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04 15:42 [PATCH] null_blk: add zoned config support information John Pittman
2019-01-04 15:59 ` Laurence Oberman
2019-01-04 16:46 ` Bart Van Assche
2019-01-04 16:58   ` Laurence Oberman
2019-01-04 20:37   ` John Pittman
2019-01-04 20:49     ` Bart Van Assche
2019-01-04 21:07       ` John Pittman
2019-01-06 19:23     ` Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox