From: Igor Konopko <igor.j.konopko@intel.com>
To: Matias Bjorling <mb@lightnvm.io>
Cc: "Hans Holmberg" <hans@owltronix.com>,
"Javier González" <javier@javigon.com>,
"Hans Holmberg" <hans.holmberg@cnexlabs.com>,
linux-block@vger.kernel.org
Subject: Re: [PATCH 17/18] lightnvm: allow to use full device path
Date: Thu, 21 Mar 2019 14:18:47 +0100 [thread overview]
Message-ID: <001207b7-5b26-2079-b5bf-c8b7de9312e5@intel.com> (raw)
In-Reply-To: <CANr-nt1HbjfxQLvmUrsA9shLmn4_VNOF42JoMV7afvjAtwftFg@mail.gmail.com>
Matias,
any opinion from your side, whether you would like to do such a changes
in userspace tool or in lightnvm core? I can go both ways.
Thanks
Igor
On 18.03.2019 15:41, Hans Holmberg wrote:
> On Mon, Mar 18, 2019 at 2:18 PM Igor Konopko <igor.j.konopko@intel.com> wrote:
>>
>>
>>
>> On 18.03.2019 11:28, Hans Holmberg wrote:
>>> On Thu, Mar 14, 2019 at 5:11 PM Igor Konopko <igor.j.konopko@intel.com> wrote:
>>>>
>>>> This patch adds the possibility to provide full device path (like
>>>> /dev/nvme0n1) when specifying device on top of which pblk instance
>>>> should be created/removed.
>>>>
>>>> This makes creation of targets from nvme-cli (or other ioctl based
>>>> tools) more unified with other commands in comparison with current
>>>> situation where almost all commands uses full device path with except
>>>> of lightnvm creation/removal parameter which uses just 'nvme0n1'
>>>> naming convention. After this changes both approach will be valid.
>>>>
>>>> Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
>>>> ---
>>>> drivers/lightnvm/core.c | 23 ++++++++++++++++++-----
>>>> 1 file changed, 18 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
>>>> index c01f83b..838c3d8 100644
>>>> --- a/drivers/lightnvm/core.c
>>>> +++ b/drivers/lightnvm/core.c
>>>> @@ -1195,6 +1195,21 @@ void nvm_unregister(struct nvm_dev *dev)
>>>> }
>>>> EXPORT_SYMBOL(nvm_unregister);
>>>>
>>>> +#define PREFIX_STR "/dev/"
>>>> +static void nvm_normalize_path(char *path)
>>>> +{
>>>> + path[DISK_NAME_LEN - 1] = '\0';
>>>> + if (!memcmp(PREFIX_STR, path,
>>>> + sizeof(char) * strlen(PREFIX_STR))) {
>>>> + /*
>>>> + * User provide name in '/dev/nvme0n1' format,
>>>> + * so we need to skip '/dev/' for comparison
>>>> + */
>>>> + memmove(path, path + sizeof(char) * strlen(PREFIX_STR),
>>>> + (DISK_NAME_LEN - strlen(PREFIX_STR)) * sizeof(char));
>>>> + }
>>>> +}
>>>> +
>>>
>>> I don't like this. Why add string parsing to the kernel? Can't this
>>> feature be added to the nvme tool?
>>
>> Since during target creation/removal in kernel, we already operate on
>> strings multiple times (strcmp calls for target types, nvme device,
>> target names) my idea was to keep this in the same layer too.
>
> Oh, pardon the terse and rather grumpy review. Let me elaborate:
>
> String parsing is best avoided when possible, and i don't think it's
> worth increasing the kernel code size and changing the behavior of the
> IOCTL when its fully doable to do this in userspace.
>
> Thanks,
> Hans
>
>>
>>>
>>>> static int __nvm_configure_create(struct nvm_ioctl_create *create)
>>>> {
>>>> struct nvm_dev *dev;
>>>> @@ -1304,9 +1319,9 @@ static long nvm_ioctl_dev_create(struct file *file, void __user *arg)
>>>> return -EINVAL;
>>>> }
>>>>
>>>> - create.dev[DISK_NAME_LEN - 1] = '\0';
>>>> + nvm_normalize_path(create.dev);
>>>> + nvm_normalize_path(create.tgtname);
>>>> create.tgttype[NVM_TTYPE_NAME_MAX - 1] = '\0';
>>>> - create.tgtname[DISK_NAME_LEN - 1] = '\0';
>>>>
>>>> if (create.flags != 0) {
>>>> __u32 flags = create.flags;
>>>> @@ -1333,7 +1348,7 @@ static long nvm_ioctl_dev_remove(struct file *file, void __user *arg)
>>>> if (copy_from_user(&remove, arg, sizeof(struct nvm_ioctl_remove)))
>>>> return -EFAULT;
>>>>
>>>> - remove.tgtname[DISK_NAME_LEN - 1] = '\0';
>>>> + nvm_normalize_path(remove.tgtname);
>>>>
>>>> if (remove.flags != 0) {
>>>> pr_err("nvm: no flags supported\n");
>>>> @@ -1373,8 +1388,6 @@ static long nvm_ioctl_dev_factory(struct file *file, void __user *arg)
>>>> if (copy_from_user(&fact, arg, sizeof(struct nvm_ioctl_dev_factory)))
>>>> return -EFAULT;
>>>>
>>>> - fact.dev[DISK_NAME_LEN - 1] = '\0';
>>>> -
>>>> if (fact.flags & ~(NVM_FACTORY_NR_BITS - 1))
>>>> return -EINVAL;
>>>>
>>>> --
>>>> 2.9.5
>>>>
next prev parent reply other threads:[~2019-03-21 13:18 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-14 16:04 [PATCH 00/18] lightnvm: next set of improvements for 5.2 Igor Konopko
2019-03-14 16:04 ` [PATCH 01/18] lightnvm: pblk: fix warning in pblk_l2p_init() Igor Konopko
2019-03-16 22:29 ` Javier González
2019-03-18 16:25 ` Matias Bjørling
2019-03-14 16:04 ` [PATCH 02/18] lightnvm: pblk: warn when there are opened chunks Igor Konopko
2019-03-16 22:36 ` Javier González
2019-03-17 19:39 ` Matias Bjørling
2019-03-14 16:04 ` [PATCH 03/18] lightnvm: pblk: simplify partial read path Igor Konopko
2019-03-14 21:35 ` Heiner Litz
2019-03-15 9:52 ` Igor Konopko
2019-03-16 22:28 ` Javier González
2019-03-18 12:44 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 04/18] lightnvm: pblk: OOB recovery for closed chunks fix Igor Konopko
2019-03-16 22:43 ` Javier González
2019-03-17 19:24 ` Matias Bjørling
2019-03-18 12:50 ` Igor Konopko
2019-03-18 19:25 ` Javier González
2019-03-14 16:04 ` [PATCH 05/18] lightnvm: pblk: propagate errors when reading meta Igor Konopko
2019-03-16 22:48 ` Javier González
2019-03-18 11:54 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 06/18] lightnvm: pblk: recover only written metadata Igor Konopko
2019-03-16 23:46 ` Javier González
2019-03-18 12:54 ` Igor Konopko
2019-03-18 15:04 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 07/18] lightnvm: pblk: wait for inflight IOs in recovery Igor Konopko
2019-03-17 19:33 ` Matias Bjørling
2019-03-18 12:58 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 08/18] lightnvm: pblk: fix spin_unlock order Igor Konopko
2019-03-16 23:49 ` Javier González
2019-03-18 11:55 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 09/18] lightnvm: pblk: kick writer on write recovery path Igor Konopko
2019-03-16 23:54 ` Javier González
2019-03-18 11:58 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 10/18] lightnvm: pblk: ensure that emeta is written Igor Konopko
2019-03-17 19:44 ` Matias Bjørling
2019-03-18 13:02 ` Igor Konopko
2019-03-18 18:26 ` Javier González
2019-03-21 13:34 ` Igor Konopko
2019-03-18 7:46 ` Javier González
2019-03-14 16:04 ` [PATCH 11/18] lightnvm: pblk: fix update line wp in OOB recovery Igor Konopko
2019-03-18 6:56 ` Javier González
2019-03-18 13:06 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 12/18] lightnvm: pblk: do not read OOB from emeta region Igor Konopko
2019-03-17 19:56 ` Matias Bjørling
2019-03-18 13:05 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 13/18] lightnvm: pblk: store multiple copies of smeta Igor Konopko
2019-03-18 7:33 ` Javier González
2019-03-18 13:12 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 14/18] lightnvm: pblk: GC error handling Igor Konopko
2019-03-18 7:39 ` Javier González
2019-03-18 12:14 ` Hans Holmberg
2019-03-18 13:22 ` Igor Konopko
2019-03-18 14:14 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 15/18] lightnvm: pblk: fix in case of lack of lines Igor Konopko
2019-03-18 7:42 ` Javier González
2019-03-18 13:28 ` Igor Konopko
2019-03-18 19:21 ` Javier González
2019-03-21 13:21 ` Igor Konopko
2019-03-22 12:17 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 16/18] lightnvm: pblk: use nvm_rq_to_ppa_list() Igor Konopko
2019-03-18 7:48 ` Javier González
2019-03-14 16:04 ` [PATCH 17/18] lightnvm: allow to use full device path Igor Konopko
2019-03-18 7:49 ` Javier González
2019-03-18 10:28 ` Hans Holmberg
2019-03-18 13:18 ` Igor Konopko
2019-03-18 14:41 ` Hans Holmberg
2019-03-21 13:18 ` Igor Konopko [this message]
2019-03-25 11:40 ` Matias Bjørling
2019-03-14 16:04 ` [PATCH 18/18] lightnvm: track inflight target creations Igor Konopko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=001207b7-5b26-2079-b5bf-c8b7de9312e5@intel.com \
--to=igor.j.konopko@intel.com \
--cc=hans.holmberg@cnexlabs.com \
--cc=hans@owltronix.com \
--cc=javier@javigon.com \
--cc=linux-block@vger.kernel.org \
--cc=mb@lightnvm.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).