[nvmewin] Patch with changes for Namespace Management

Foster, Carolyn D carolyn.d.foster at intel.com
Fri Feb 26 08:27:49 PST 2016


Hi all,
I am sending the updated patch incorporating feedback I received.  The changes are listed below, along with my comments about the feedback I did not address.  The password is intelnvme

Patch updates:

-          Server 2012 was failing to shut down because of mismatched calls to StorportDeviceBusy and StorportDeviceReady after delete or detach commands.

-          NVMeGetNamespaceStatusAndSlot(pDevExt, currentNSID, &lunId); moved inside the below condition.
   if (pNsMgmtDW10->SEL == NAMESPACE_MANAGEMENT_DELETE) { }

-          In function:  NVMeIoctlNamespaceMgmt - allocate memory for pNsCtrlsList and free the memory after command completion.

-          In the Namespace Detach/Delete path - removed unnecessary calls to StorportNotification

-          In functions NVMeCompletionNsAttachment and FormatNVMGetIdentify changed PRP preparation to size of Identify Namespace

-          In function NVMeSetFeaturesCompletion added check for SC==INVALID_NAMESPACE_OR_FORMAT

-          In function NVMeSetFeaturesCompletion For the case where NS Mgmt is not supported, nsStatus should be set to ATTACHED

-          In function NVMeSetFeaturesCompletion In the case where NS mgmt is not supported, nsStatus will be "INVALID"

Suggested feedback I did not incorporate:

-          I was not able to make any improvements to the driver handling for the zero attached namespace case.  If the feedback is that this must be implemented for this patch, I will need two more weeks.

-          pAE->DriverState.NumQueuesSet - I could not find any such field in the driver

-          Check should validate that the SCT is GENERIC_COMMAND_STATUS - I did not change this because I'd have to add a new else condition, and I could not commit to testing that kind of a change.

-          I didn't make any of the suggested changes to the LBA RANGE buffer size, because again, I could not commit to testing them

-          It is safe to set SEL field  to NAMESPACE_MANAGEMENT_DELETE  in the pNsMgmtCmd structure - as far as I can see when stepping through the code we set this, line 4102 in nvmeStd.c

Carolyn

From: nvmewin-bounces at lists.openfabrics.org [mailto:nvmewin-bounces at lists.openfabrics.org] On Behalf Of Foster, Carolyn D
Sent: Friday, January 15, 2016 4:57 PM
To: nvmewin at lists.openfabrics.org
Subject: [nvmewin] Patch with changes for Namespace Management

Hi all,
This patch includes changes to support Namespace Management updates from the NVMe specification 1.2.  This patch implements some fixes for handling non-continuous namespaces, adds handling for attached and detached namespaces, and implements new IOCTLs to create, delete, attach and detach namespaces.

I have made a detailed overview of the changes in the text file in the attached zip file, the contents are also copied here below.

Password is intelnvme


Please let me know if you have any questions.

Carolyn Foster



This patch includes changes to support Namespace management, including create, delete,
attach and detach namespace operations.  The new functionality in this patch was tested
using proprietary tools.  We tested on Server 2008 R2, Server 2012 R2 and Windows 8.1


******************
Design Assumptions
******************

1. The numbering of namespaces need not be consecutive.
2. The namespace ID can be any number between 1 and 2^32.
3. A namespace is considered "active" only when it is created and attached to this controller.
4. A detached namespace, or one that is just created but not yet attached is considered "inactive".
5. A non-existent, or deleted namespace is considered "invalid".
6. An active namespace will result in one (and only one) "Online" LUN.
7. Assuming single-host, and single-controller NVMe system.

*********************
Architecture Overview
*********************

There are four new IOCTLs for namespace management, Create, Delete, Attach and Detach.  An attached
namespace will result in a visible LUN to the Windows OS.  The LUN extension table has been updated
to have a Namespace status:

typedef enum _NS_STATUS
{
    INVALID = 0,    //Namespace ID does not exist (not known to controller).
    INACTIVE,       //Namespace is created, but not attached to controller.
    ATTACHED        //Namespace is created and attached to controller.
} NS_STATUS;

In order to properly build the LUN extension table during initialization, we made changes to identify
all namespaces, and to determine each namespace's status.  These changes include new states in the
Init State Machine NVMeRnningWaitOnListAttachedNs and NVMeRunningWaitOnListExistingNs.  The updated
state machine steps are as follows:

1. Send an Identify Namespace command with CNS set to 02h. This should return a list of all active (created and attached) namespaces.
2. Go through the list and update LUN extension entries accordingly, one entry for each namespace. Set all LUN status to online.
3. Send an Identify Namespace command with CNS set to 10h. This should return a list of all existing namespaces in the system, active and inactive.
4. Go through the list.
5. If a corresponding LUN entry exists, skip this step, as this must have been an active namespace that was covered in previous steps.

LUN extension entries are populated as follows:

When a namespace is created:
- namespaceId is set.
- nsStatus is set to "INACTIVE"
- slotStatus is set to "FREE"
- identifyData is partially set

When a namespace is attached:
- drive is pulled for namespace identify
- identifyData is set accordingly
- nsStatus is set to "ATTACHED"
- slotStatus is set to "ONLINE"
- ReadOnly is set to FALSE

When a namespace is detached:
- nsStatus is set to "INACTIVE"
- slotStatus is set to "FREE"
- ReadOnly is set to TRUE

When a namespace is deleted:
- The entire LUN extension entry is set to 0.

There are also new reasons for the LUN to be offline:

typedef enum _LUN_OFFLINE_REASON
{
    NOT_OFFLINE,
    FORMAT_IN_PROGRESS,
    DETACH_IN_PROGRESS,
    DELETE_IN_PROGRESS
    // Add more as needed
} LUN_OFFLINE_REASON;

When delete or detach requests are made, the driver will call StorportDeviceBusy to pause incoming requests,
and the LUN is marked as offline with the appropriate reason.  When a user tries to delete an attached namespace,
the driver will first send a detach command, and then the delete command.

*****************
Known Limitations
*****************

1. If no namepsaces are present, the driver will fail to load.
2. If an error happens on any one namespace during initialization the driver will fail to load.

The handling for these two scenarios could be strengthened and improved, which we did not get to in this patch.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/nvmewin/attachments/20160226/282240a1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IntelNamespaceManagementV2.zip
Type: application/x-zip-compressed
Size: 225855 bytes
Desc: IntelNamespaceManagementV2.zip
URL: <http://lists.openfabrics.org/pipermail/nvmewin/attachments/20160226/282240a1/attachment.bin>


More information about the nvmewin mailing list