• Christoph Hellwig's avatar
    nvme: add ANA support · 0d0b660f
    Christoph Hellwig authored
    Add support for Asynchronous Namespace Access as specified in NVMe 1.3
    TP 4004.  With ANA each namespace attached to a controller belongs to an
    ANA group that describes the characteristics of accessing the namespaces
    through this controller.  In the optimized and non-optimized states
    namespaces can be accessed regularly, although in a multi-pathing
    environment we should always prefer to access a namespace through a
    controller where an optimized relationship exists.  Namespaces in
    Inaccessible, Permanent-Loss or Change state for a given controller
    should not be accessed.
    
    The states are updated through reading the ANA log page, which is read
    once during controller initialization, whenever the ANA change notice
    AEN is received, or when one of the ANA specific status codes that
    signal a state change is received on a command.
    
    The ANA state is kept in the nvme_ns structure, which makes the checks in
    the fast path very simple.  Updating the ANA state when reading the log
    page is also very simple, the only downside is that finding the initial
    ANA state when scanning for namespaces is a bit cumbersome.
    
    The gendisk for a ns_head is only registered once a live path for it
    exists.  Without that the kernel would hang during partition scanning.
    
    Includes fixes and improvements from Hannes Reinecke.
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
    Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
    0d0b660f
multipath.c 14.8 KB