1. 30 11月, 2016 1 次提交
  2. 21 9月, 2016 2 次提交
    • S
      lightnvm: expose device geometry through sysfs · 40267efd
      Simon A. F. Lund 提交于
      For a host to access an Open-Channel SSD, it has to know its geometry,
      so that it writes and reads at the appropriate device bounds.
      
      Currently, the geometry information is kept within the kernel, and not
      exported to user-space for consumption. This patch exposes the
      configuration through sysfs and enables user-space libraries, such as
      liblightnvm, to use the sysfs implementation to get the geometry of an
      Open-Channel SSD.
      
      The sysfs entries are stored within the device hierarchy, and can be
      found using the "lightnvm" device type.
      
      An example configuration looks like this:
      
      /sys/class/nvme/
      └── nvme0n1
         ├── capabilities: 3
         ├── device_mode: 1
         ├── erase_max: 1000000
         ├── erase_typ: 1000000
         ├── flash_media_type: 0
         ├── media_capabilities: 0x00000001
         ├── media_type: 0
         ├── multiplane: 0x00010101
         ├── num_blocks: 1022
         ├── num_channels: 1
         ├── num_luns: 4
         ├── num_pages: 64
         ├── num_planes: 1
         ├── page_size: 4096
         ├── prog_max: 100000
         ├── prog_typ: 100000
         ├── read_max: 10000
         ├── read_typ: 10000
         ├── sector_oob_size: 0
         ├── sector_size: 4096
         ├── media_manager: gennvm
         ├── ppa_format: 0x380830082808001010102008
         ├── vendor_opcode: 0
         ├── max_phys_secs: 64
         └── version: 1
      Signed-off-by: NSimon A. F. Lund <slund@cnexlabs.com>
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      40267efd
    • M
      lightnvm: control life of nvm_dev in driver · b0b4e09c
      Matias Bjørling 提交于
      LightNVM compatible device drivers does not have a method to expose
      LightNVM specific sysfs entries.
      
      To enable LightNVM sysfs entries to be exposed, lightnvm device
      drivers require a struct device to attach it to. To allow both the
      actual device driver and lightnvm sysfs entries to coexist, the device
      driver tracks the lifetime of the nvm_dev structure.
      
      This patch refactors NVMe and null_blk to handle the lifetime of struct
      nvm_dev, which eliminates the need for struct gendisk when a lightnvm
      compatible device is provided.
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      b0b4e09c
  3. 07 7月, 2016 6 次提交
  4. 07 5月, 2016 16 次提交
  5. 19 3月, 2016 3 次提交
  6. 04 3月, 2016 2 次提交
  7. 05 2月, 2016 1 次提交
    • M
      lightnvm: allow to force mm initialization · bf643185
      Matias Bjørling 提交于
      System block allows the device to initialize with its configured media
      manager. The system blocks is written to disk, and read again when media
      manager is determined. For this to work, the backend must store the
      data. Device drivers, such as null_blk, does not have any backend
      storage. This patch allows the media manager to be initialized without a
      storage backend.
      
      It also fix incorrect configuration of capabilities in null_blk, as it
      does not support get/set bad block interface.
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      bf643185
  8. 14 1月, 2016 1 次提交
  9. 12 1月, 2016 8 次提交
    • M
      lightnvm: introduce factory reset · 8b4970c4
      Matias Bjørling 提交于
      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: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      8b4970c4
    • M
      lightnvm: use system block for mm initialization · b7692076
      Matias Bjørling 提交于
      Use system block information to register the appropriate media manager.
      This enables the LightNVM subsystem to instantiate a media manager
      selected by the user, instead of relying on automatic detection by each
      media manager loaded in the kernel.
      
      A device must now be initialized before it can proceed to initialize its
      media manager. Upon initialization, the configured media manager is
      automatically initialized as well.
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      b7692076
    • M
      lightnvm: core on-disk initialization · e3eb3799
      Matias Bjørling 提交于
      An Open-Channel SSD shall be initialized before use. To initialize, we
      define an on-disk format, that keeps a small set of metadata to bring up
      the media manager on top of the device.
      
      The initial step is introduced to allow a user to format the disks for a
      given media manager. During format, a system block is stored on one to
      three separate luns on the device. Each lun has the system block
      duplicated. During initialization, the system block can be retrieved and
      the appropriate media manager can initialized.
      
      The on-disk format currently covers (struct nvm_system_block):
      
       - Magic value "NVMS".
       - Monotonic increasing sequence number.
       - The physical block erase count.
       - Version of the system block format.
       - Media manager type.
       - Media manager superblock physical address.
      
      The interface provides three functions to manage the system block:
      
       int nvm_init_sysblock(struct nvm_dev *, struct nvm_sb_info *)
       int nvm_get_sysblock(struct nvm *dev, struct nvm_sb_info *)
       int nvm_update_sysblock(struct nvm *dev, struct nvm_sb_info *)
      
      Each implement a part of the logic to manage the system block. The
      initialization creates the first system blocks and mark them on the
      device. Get retrieves the latest system block by scanning all pages in
      the associated system blocks. The update sysblock writes new metadata
      and allocates new block if necessary.
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      e3eb3799
    • M
      lightnvm: introduce mlc lower page table mappings · ca5927e7
      Matias Bjørling 提交于
      NAND MLC memories have both lower and upper pages. When programming,
      both of these must be written, before data can be read. However,
      these lower and upper pages might not placed at even and odd flash
      pages, but can be skipped. Therefore each flash memory has its lower
      pages defined, which can then be used when programming and to know when
      padding are necessary.
      
      This patch implements the lower page definition in the specification,
      and exposes it through a simple lookup table at dev->lptbl.
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      ca5927e7
    • M
      lightnvm: add mccap support · f9a99950
      Matias Bjørling 提交于
      Some flash media has extended capabilities, such as programming SLC
      pages on MLC/TLC flash, erase/program suspend, scramble and encryption.
      MCCAP is introduced to detect support for these capabilities in the
      command set.
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      f9a99950
    • J
      lightnvm: manage open and closed blocks separately · ff0e498b
      Javier González 提交于
      LightNVM targets need to know the state of the flash block when doing
      flash optimizations. An example is implementing a write buffer to
      respect the flash page size. Currently, block state is not accounted
      for; the media manager only differentiates among free, bad and in-use
      blocks.
      
      This patch adds the logic in the generic media manager to enable
      targets manage blocks into open and close separately, and it implements
      such management in rrpc. It also adds a set of flags to describe the
      state of the block (open, closed, free, bad).
      
      In order to avoid taking two locks (nvm_lun and rrpc_lun) consecutively,
      we introduce lockless get_/put_block primitives so that the open and
      close list locks and future common logic is handled within the nvm_lun
      lock.
      Signed-off-by: NJavier González <javier@cnexlabs.com>
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      ff0e498b
    • M
      lightnvm: fix missing grown bad block type · b5d4acd4
      Matias Bjørling 提交于
      The get/set bad block interface defines good block, factory bad block,
      grown bad block, device reserved block, and host reserved block.
      Unfortunately the grown bad block was missing, leaving the offsets wrong
      for device and host side reserved blocks.
      
      This patch adds the missing type and corrects the offsets.
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      b5d4acd4
    • M
      lightnvm: introduce nvm_submit_ppa · 09719b62
      Matias Bjørling 提交于
      Internal logic for both core and media managers, does not have a
      backing bio for issuing I/Os. Introduce nvm_submit_ppa to allow raw
      I/Os to be submitted to the underlying device driver.
      
      The function request the device, ppa, data buffer and its length and
      will submit the I/O synchronously to the device. The return value may
      therefore be used to detect any errors regarding the issued I/O.
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      09719b62