1. 02 Oct, 2020 15 commits
    • Coly Li's avatar
      bcache: remove embedded struct cache_sb from struct cache_set · 4a784266
      Coly Li authored
      Since bcache code was merged into mainline kerrnel, each cache set only
      as one single cache in it. The multiple caches framework is here but the
      code is far from completed. Considering the multiple copies of cached
      data can also be stored on e.g. md raid1 devices, it is unnecessary to
      support multiple caches in one cache set indeed.
      
      The previous preparation patches fix the dependencies of explicitly
      making a cache set only have single cache. Now we don't have to maintain
      an embedded partial super block in struct cache_set, the in-memory super
      block can be directly referenced from struct cache.
      
      This patch removes the embedded struct cache_sb from struct cache_set,
      and fixes all locations where the superb lock was referenced from this
      removed super block by referencing the in-memory super block of struct
      cache.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      4a784266
    • Coly Li's avatar
      bcache: check and set sync status on cache's in-memory super block · 6f9414e0
      Coly Li authored
      Currently the cache's sync status is checked and set on cache set's in-
      memory partial super block. After removing the embedded struct cache_sb
      from cache set and reference cache's in-memory super block from struct
      cache_set, the sync status can set and check directly on cache's super
      block.
      
      This patch checks and sets the cache sync status directly on cache's
      in-memory super block. This is a preparation for later removing embedded
      struct cache_sb from struct cache_set.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      6f9414e0
    • Coly Li's avatar
      bcache: remove can_attach_cache() · ebaa1ac1
      Coly Li authored
      After removing the embedded struct cache_sb from struct cache_set, cache
      set will directly reference the in-memory super block of struct cache.
      It is unnecessary to compare block_size, bucket_size and nr_in_set from
      the identical in-memory super block in can_attach_cache().
      
      This is a preparation patch for latter removing cache_set->sb from
      struct cache_set.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      ebaa1ac1
    • Coly Li's avatar
      bcache: don't check seq numbers in register_cache_set() · 08a17828
      Coly Li authored
      In order to update the partial super block of cache set, the seq numbers
      of cache and cache set are checked in register_cache_set(). If cache's
      seq number is larger than cache set's seq number, cache set must update
      its partial super block from cache's super block. It is unncessary when
      the embedded struct cache_sb is removed from struct cache set.
      
      This patch removed the seq numbers checking from register_cache_set(),
      because later there will be no such partial super block in struct cache
      set, the cache set will directly reference in-memory super block from
      struct cache. This is a preparation patch for removing embedded struct
      cache_sb from struct cache_set.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      08a17828
    • Coly Li's avatar
      bcache: only use bucket_bytes() on struct cache · 63a96c05
      Coly Li authored
      Because struct cache_set and struct cache both have struct cache_sb,
      macro bucket_bytes() currently are used on both of them. When removing
      the embedded struct cache_sb from struct cache_set, this macro won't be
      used on struct cache_set anymore.
      
      This patch unifies all bucket_bytes() usage only on struct cache, this is
      one of the preparation to remove the embedded struct cache_sb from
      struct cache_set.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      63a96c05
    • Coly Li's avatar
      bcache: remove useless bucket_pages() · 3c4fae29
      Coly Li authored
      It seems alloc_bucket_pages() is the only user of bucket_pages().
      Considering alloc_bucket_pages() is removed from bcache code, it is safe
      to remove the useless macro bucket_pages() now.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      3c4fae29
    • Coly Li's avatar
      bcache: remove useless alloc_bucket_pages() · 421cf1c5
      Coly Li authored
      Now no one uses alloc_bucket_pages() anymore, remove it from bcache.h.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      421cf1c5
    • Coly Li's avatar
      bcache: only use block_bytes() on struct cache · 4e1ebae3
      Coly Li authored
      Because struct cache_set and struct cache both have struct cache_sb,
      therefore macro block_bytes() can be used on both of them. When removing
      the embedded struct cache_sb from struct cache_set, this macro won't be
      used on struct cache_set anymore.
      
      This patch unifies all block_bytes() usage only on struct cache, this is
      one of the preparation to remove the embedded struct cache_sb from
      struct cache_set.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      4e1ebae3
    • Coly Li's avatar
      bcache: add set_uuid in struct cache_set · 1132e56e
      Coly Li authored
      This patch adds a separated set_uuid[16] in struct cache_set, to store
      the uuid of the cache set. This is the preparation to remove the
      embedded struct cache_sb from struct cache_set.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      1132e56e
    • Coly Li's avatar
      bcache: remove for_each_cache() · 08fdb2cd
      Coly Li authored
      Since now each cache_set explicitly has single cache, for_each_cache()
      is unnecessary. This patch removes this macro, and update all locations
      where it is used, and makes sure all code logic still being consistent.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      08fdb2cd
    • Coly Li's avatar
      bcache: explicitly make cache_set only have single cache · 697e2349
      Coly Li authored
      Currently although the bcache code has a framework for multiple caches
      in a cache set, but indeed the multiple caches never completed and users
      use md raid1 for multiple copies of the cached data.
      
      This patch does the following change in struct cache_set, to explicitly
      make a cache_set only have single cache,
      - Change pointer array "*cache[MAX_CACHES_PER_SET]" to a single pointer
        "*cache".
      - Remove pointer array "*cache_by_alloc[MAX_CACHES_PER_SET]".
      - Remove "caches_loaded".
      
      Now the code looks as exactly what it does in practic: only one cache is
      used in the cache set.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      697e2349
    • Coly Li's avatar
      bcache: remove 'int n' from parameter list of bch_bucket_alloc_set() · 17e4aed8
      Coly Li authored
      The parameter 'int n' from bch_bucket_alloc_set() is not cleared
      defined. From the code comments n is the number of buckets to alloc, but
      from the code itself 'n' is the maximum cache to iterate. Indeed all the
      locations where bch_bucket_alloc_set() is called, 'n' is alwasy 1.
      
      This patch removes the confused and unnecessary 'int n' from parameter
      list of  bch_bucket_alloc_set(), and explicitly allocates only 1 bucket
      for its caller.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      17e4aed8
    • Qinglang Miao's avatar
      bcache: Convert to DEFINE_SHOW_ATTRIBUTE · 84e5d136
      Qinglang Miao authored
      Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
      
      As inode->iprivate equals to third parameter of
      debugfs_create_file() which is NULL. So it's equivalent
      to original code logic.
      Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      84e5d136
    • Dongsheng Yang's avatar
      bcache: check c->root with IS_ERR_OR_NULL() in mca_reserve() · 7e59c506
      Dongsheng Yang authored
      In mca_reserve(c) macro, we are checking root whether is NULL or not.
      But that's not enough, when we read the root node in run_cache_set(),
      if we got an error in bch_btree_node_read_done(), we will return
      ERR_PTR(-EIO) to c->root.
      
      And then we will go continue to unregister, but before calling
      unregister_shrinker(&c->shrink), there is a possibility to call
      bch_mca_count(), and we would get a crash with call trace like that:
      
      [ 2149.876008] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000b5
      ... ...
      [ 2150.598931] Call trace:
      [ 2150.606439]  bch_mca_count+0x58/0x98 [escache]
      [ 2150.615866]  do_shrink_slab+0x54/0x310
      [ 2150.624429]  shrink_slab+0x248/0x2d0
      [ 2150.632633]  drop_slab_node+0x54/0x88
      [ 2150.640746]  drop_slab+0x50/0x88
      [ 2150.648228]  drop_caches_sysctl_handler+0xf0/0x118
      [ 2150.657219]  proc_sys_call_handler.isra.18+0xb8/0x110
      [ 2150.666342]  proc_sys_write+0x40/0x50
      [ 2150.673889]  __vfs_write+0x48/0x90
      [ 2150.681095]  vfs_write+0xac/0x1b8
      [ 2150.688145]  ksys_write+0x6c/0xd0
      [ 2150.695127]  __arm64_sys_write+0x24/0x30
      [ 2150.702749]  el0_svc_handler+0xa0/0x128
      [ 2150.710296]  el0_svc+0x8/0xc
      Signed-off-by: default avatarDongsheng Yang <dongsheng.yang@easystack.cn>
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      7e59c506
    • Coly Li's avatar
      bcache: share register sysfs with async register · a58e88bf
      Coly Li authored
      Previously the experimental async registration uses a separate sysfs
      file register_async. Now the async registration code seems working well
      for a while, we can do furtuher testing with it now.
      
      This patch changes the async bcache registration shares the same sysfs
      file /sys/fs/bcache/register (and register_quiet). Async registration
      will be default behavior if BCACHE_ASYNC_REGISTRATION is set in kernel
      configure. By default, BCACHE_ASYNC_REGISTRATION is not configured yet.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      a58e88bf
  2. 29 Sep, 2020 1 commit
    • Niklas Cassel's avatar
      null_blk: add support for max open/active zone limit for zoned devices · dc4d137e
      Niklas Cassel authored
      Add support for user space to set a max open zone and a max active zone
      limit via configfs. By default, the default values are 0 == no limit.
      
      Call the block layer API functions used for exposing the configured
      limits to sysfs.
      
      Add accounting in null_blk_zoned so that these new limits are respected.
      Performing an operation that would exceed these limits results in a
      standard I/O error.
      
      A max open zone limit exists in the ZBC standard.
      While null_blk_zoned is used to test the Zoned Block Device model in
      Linux, when it comes to differences between ZBC and ZNS, null_blk_zoned
      mostly follows ZBC.
      
      Therefore, implement the manage open zone resources function from ZBC,
      but additionally add support for max active zones.
      This enables user space not only to test against a device with an open
      zone limit, but also to test against a device with an active zone limit.
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      dc4d137e
  3. 28 Sep, 2020 1 commit
    • Jens Axboe's avatar
      Merge tag 'nvme-5.10-2020-09-27' of git://git.infradead.org/nvme into for-5.10/drivers · 1ed4211d
      Jens Axboe authored
      Pull NVMe updates from Christoph:
      
      "nvme updates for 5.10
      
       - fix keep alive timer modification (Amit Engel)
       - order the PCI ID list more sensibly (Andy Shevchenko)
       - cleanup the open by controller helper (Chaitanya Kulkarni)
       - use an xarray for th CSE log lookup (Chaitanya Kulkarni)
       - support ZNS in nvmet passthrough mode (Chaitanya Kulkarni)
       - fix nvme_ns_report_zones (me)
       - add a sanity check to nvmet-fc (James Smart)
       - fix interrupt allocation when too many polled queues are specified
         (Jeffle Xu)
       - small nvmet-tcp optimization (Mark Wunderlich)"
      
      * tag 'nvme-5.10-2020-09-27' of git://git.infradead.org/nvme:
        nvme-pci: allocate separate interrupt for the reserved non-polled I/O queue
        nvme: fix error handling in nvme_ns_report_zones
        nvmet-fc: fix missing check for no hostport struct
        nvmet: add passthru ZNS support
        nvmet: handle keep-alive timer when kato is modified by a set features cmd
        nvmet-tcp: have queue io_work context run on sock incoming cpu
        nvme-pci: Move enumeration by class to be last in the table
        nvme: use an xarray to lookup the Commands Supported and Effects log
        nvme: lift the file open code from nvme_ctrl_get_by_path
      1ed4211d
  4. 27 Sep, 2020 9 commits
  5. 25 Sep, 2020 1 commit
    • Jens Axboe's avatar
      Merge branch 'md-next' of... · 163090c1
      Jens Axboe authored
      Merge branch 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-5.10/drivers
      
      Pull MD updates from Song.
      
      * 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
        md/raid10: improve discard request for far layout
        md/raid10: improve raid10 discard request
        md/raid10: pull codes that wait for blocked dev into one function
        md/raid10: extend r10bio devs to raid disks
        md: add md_submit_discard_bio() for submitting discard bio
        md: Simplify code with existing definition RESYNC_SECTORS in raid10.c
        md/raid5: reallocate page array after setting new stripe_size
        md/raid5: resize stripe_head when reshape array
        md/raid5: let multiple devices of stripe_head share page
        md/raid6: let async recovery function support different page offset
        md/raid6: let syndrome computor support different page offset
        md/raid5: convert to new xor compution interface
        md/raid5: add new xor function to support different page offset
        md/raid5: make async_copy_data() to support different page offset
        md/raid5: add a new member of offset into r5dev
        md: only calculate blocksize once and use i_blocksize()
      163090c1
  6. 24 Sep, 2020 13 commits