• Matias Bjørling's avatar
    lightnvm: introduce factory reset · 8b4970c4
    Matias Bjørling authored
    Now that a device can be managed using the system blocks, a method to
    reset the device is necessary as well. This patch introduces logic to
    reset the device easily to factory state and exposes it through an
    ioctl.
    
    The ioctl takes the following flags:
    
      NVM_FACTORY_ERASE_ONLY_USER
          By default all blocks, except host-reserved blocks are erased upon
          factory reset. Instead of this, only erase host-reserved blocks.
      NVM_FACTORY_RESET_HOST_BLKS
          Mark host-reserved blocks to be erased and set their type to free.
      NVM_FACTORY_RESET_GRWN_BBLKS
          Mark "grown bad blocks" to be erased and set their type to free.
    Signed-off-by: default avatarMatias Bjørling <m@bjorling.me>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    8b4970c4
sysblk.c 17.1 KB