diff options
author | 2017-02-15 16:25:33 +0100 | |
---|---|---|
committer | 2017-02-15 08:27:21 -0700 | |
commit | 6732c7401035c8464fd4ab5ff2e1bf86e5fcd74c (patch) | |
tree | ae0e66667ced2d480defc9a0d87089d35f3799dc /drivers/lightnvm | |
parent | lightnvm: fix off-by-one error on target initialization (diff) | |
download | linux-6732c7401035c8464fd4ab5ff2e1bf86e5fcd74c.tar.gz linux-6732c7401035c8464fd4ab5ff2e1bf86e5fcd74c.tar.bz2 linux-6732c7401035c8464fd4ab5ff2e1bf86e5fcd74c.zip |
lightnvm: set default lun range when no luns are specified
The create target ioctl takes a lun begin and lun end parameter, which
defines the range of luns to initialize a target with. If the user does
not set the parameters, it default to only using lun 0. Instead,
defaults to use all luns in the OCSSD, as it is the usual behaviour
users want.
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r-- | drivers/lightnvm/core.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 6ce76c0a75e1..5262ba66a7a7 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -1102,6 +1102,11 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create) } s = &create->conf.s; + if (s->lun_begin == -1 && s->lun_end == -1) { + s->lun_begin = 0; + s->lun_end = dev->geo.nr_luns - 1; + } + if (s->lun_begin > s->lun_end || s->lun_end >= dev->geo.nr_luns) { pr_err("nvm: lun out of bound (%u:%u > %u)\n", s->lun_begin, s->lun_end, dev->geo.nr_luns - 1); |