1. 23 Aug, 2017 6 commits
    • Shaohua Li's avatar
      nullb: use ida to manage index · 94bc02e3
      Shaohua Li authored
      We now dynamically create disks. Managing the disk index with ida to
      avoid bump up the index too much.
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      94bc02e3
    • Shaohua Li's avatar
      nullb: add interface to power on disk · cedcafad
      Shaohua Li authored
      The device created in nullb configfs interface isn't power on by
      default. After user configures the device, user can do 'echo 1 >
      xxx/nullb/device_name/power' to power on the device, which will create a
      disk. the xxx/nullb/device_name/index is the disk index, so if the index
      is 2, the new created disk should be named as /dev/nullb2. Note, the
      'index' is only valid after disk is power on.
      
      'echo 0 > xxx/nullb/device_name/power' will remove the disk. Note, this
      doesn't remove the device. To remove the device, user should do 'rmdir
      xxx/nullb/device_name'. Removing the device will remove the disk too.
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      cedcafad
    • Shaohua Li's avatar
      nullb: add configfs interface · 3bf2bd20
      Shaohua Li authored
      Add configfs interface for nullb. configfs interface is more flexible
      and easy to configure in a per-disk basis.
      
      Configuration is something like this:
      mount -t configfs none /mnt
      
      Checking which features the driver supports:
      cat /mnt/nullb/features
      
      The 'features' attribute is for future extension. We probably will add
      new features into the driver, userspace can check this attribute to find
      the supported features.
      
      Create/remove a device:
      mkdir/rmdir /mnt/nullb/a
      
      Then configure the device by setting attributes under /mnt/nullb/a, most
      of nullb supported module parameters are converted to attributes:
      size; /* device size in MB */
      completion_nsec; /* time in ns to complete a request */
      submit_queues; /* number of submission queues */
      home_node; /* home node for the device */
      queue_mode; /* block interface */
      blocksize; /* block size */
      irqmode; /* IRQ completion handler */
      hw_queue_depth; /* queue depth */
      use_lightnvm; /* register as a LightNVM device */
      blocking; /* blocking blk-mq device */
      use_per_node_hctx; /* use per-node allocation for hardware context */
      
      Note, creating a device doesn't create a disk immediately. Creating a
      disk is done in two phases: create a device and then power on the
      device. Next patch will introduce device power on.
      
      Based on original patch from Kyungchan Koh
      Signed-off-by: default avatarKyungchan Koh <kkc6196@fb.com>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      3bf2bd20
    • Shaohua Li's avatar
      nullb: factor disk parameters · 2984c868
      Shaohua Li authored
      When we switch to configfs interface, each disk could have different
      configuration. To prepare for the change, we move most disk setting to a
      separate data structure. The existing module parameter interface is
      kept. The 'nr_devices' and 'shared_tags' don't make sense for per-disk
      setting, so they are remained as global settings.
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      2984c868
    • Dan Carpenter's avatar
      skd: error pointer dereference in skd_cons_disk() · 92d499d4
      Dan Carpenter authored
      My initial impulse was to check for IS_ERR_OR_NULL() but when I looked
      at this code a bit more closely, we should only need to check for
      IS_ERR().
      
      The blk_mq_alloc_tag_set() returns negative error codes and zero on
      success so we can just do an "if (rc) goto err_out;".  It's better to
      preserve the error code anyhow.  The blk_mq_init_queue() returns error
      pointers on failure, it never returns NULL.  We can also remove the
      "q = NULL;" at the start because that's no longer needed.
      
      Fixes: ca33dd92 ("skd: Convert to blk-mq")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      92d499d4
    • Dan Carpenter's avatar
      skd: Uninitialized variable in skd_isr_completion_posted() · c0b3dda7
      Dan Carpenter authored
      Someone got too agressive about removing initializations and
      accidentally removed the "rc = 0;" which is required.
      
      Fixes: c830da8c ("skd: Remove superfluous initializations from skd_isr_completion_posted()")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      c0b3dda7
  2. 18 Aug, 2017 34 commits