diff mbox

null_blk: remove NULLB_DEV_FL_CONFIGURED on turning off nullb device

Message ID 1530817633-128360-1-git-send-email-bo.liu@linux.alibaba.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liu Bo July 5, 2018, 7:07 p.m. UTC
Currently mbps knob could only be set once before switching power knob to
on, after power knob has been set at least once, there is no way to set
mbps knob again due to -EBUSY.

As nullb is mainly used for testing, in order to make it flexible, this
removes the flag NULLB_DEV_FL_CONFIGURED so that mbps knob can be reset
when power knob is off, e.g.

echo 0 > /config/nullb/a/power
echo 40 > /config/nullb/a/mbps
echo 1 > /config/nullb/a/power

So does other knobs under /config/nullb/a.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
 drivers/block/null_blk.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jens Axboe July 6, 2018, 1:47 p.m. UTC | #1
On 7/5/18 1:07 PM, Liu Bo wrote:
> Currently mbps knob could only be set once before switching power knob to
> on, after power knob has been set at least once, there is no way to set
> mbps knob again due to -EBUSY.
> 
> As nullb is mainly used for testing, in order to make it flexible, this
> removes the flag NULLB_DEV_FL_CONFIGURED so that mbps knob can be reset
> when power knob is off, e.g.
> 
> echo 0 > /config/nullb/a/power
> echo 40 > /config/nullb/a/mbps
> echo 1 > /config/nullb/a/power
> 
> So does other knobs under /config/nullb/a.

Applied for 4.19, thanks.
diff mbox

Patch

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 2bdadd7f1454..ec0c49867996 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -390,6 +390,7 @@  static ssize_t nullb_device_power_store(struct config_item *item,
 		null_del_dev(dev->nullb);
 		mutex_unlock(&lock);
 		clear_bit(NULLB_DEV_FL_UP, &dev->flags);
+		clear_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);
 	}
 
 	return count;