Skip to content
  • Boaz Harrosh's avatar
    [SCSI] osd_uld: API for retrieving osd devices from Kernel · b799bc7d
    Boaz Harrosh authored
    
    
    Kernel clients like exofs can retrieve struct osd_dev(s)
    by means of below API.
    
    + osduld_path_lookup() - given a path (e.g "/dev/osd0") locks and
    returns the corresponding struct osd_dev, which is then needed
    for subsequent libosd use.
    
    + osduld_put_device() - free up use of an osd_dev.
    
    Devices can be shared by multiple clients. The osd_uld_device's
    life time is governed by an embedded kref structure.
    
    The osd_uld_device holds an extra reference to both it's
    char-device and it's scsi_device, and will release these just
    before the final deallocation.
    
    There are three possible lock sources of the osd_uld_device
    1. First and for most is the probe() function called by
      scsi-ml upon a successful login into a target. Released in release()
      when logout.
    2. Second by user-mode file handles opened on the char-dev.
    3. Third is here by Kernel users.
    All three locks must be removed before the osd_uld_device is freed.
    
    The MODULE has three lock sources as well:
    1. scsi-ml at probe() time, removed after release(). (login/logout)
    2. The user-mode file handles open/close.
    3. Import symbols by client modules like exofs.
    
    TODO:
      This API is not enough for the pNFS-objects LD. A more versatile
      API will be needed. Proposed API could be:
      struct osd_dev *osduld_sysid_lookup(const char id[OSD_SYSTEMID_LEN]);
    
    Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
    b799bc7d