• Chaitanya Kulkarni's avatar
    nvmet: make nvmet_find_namespace() req based · 3a1f7c79
    Chaitanya Kulkarni authored
    The six callers of nvmet_find_namespace() duplicate the error log page
    update and status setting code for each call on failure.
    
    All callers are nvmet requests based functions, so we can pass req
    to the nvmet_find_namesapce() & derive ctrl from req, that'll allow us
    to update the error log page in nvmet_find_namespace(). Now that we
    pass the request we can also get rid of the local variable in
    nvmet_find_namespace() and use the req->ns and return the error code.
    
    Replace the ctrl parameter with nvmet_req for nvmet_find_namespace(),
    centralize the error log page update for non allocated namesapces, and
    return uniform error for non-allocated namespace.
    
    The nvmet_find_namespace() takes nsid parameter which is from NVMe
    commands structures such as get_log_page, identify, rw and common. All
    these commands have same offset for the nsid field.
    
    Derive nsid from req->cmd->common.nsid) & remove the extra parameter
    from the nvmet_find_namespace().
    
    Lastly now we associate the ns to the req parameter that we pass to the
    nvmet_find_namespace(), rename nvmet_find_namespace() to
    nvmet_req_find_ns().
    Signed-off-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    3a1f7c79
nvmet.h 16.6 KB