1. 01 Feb, 2023 4 commits
    • Xiao Ni's avatar
      md: Change active_io to percpu · 72adae23
      Xiao Ni authored
      Now the type of active_io is atomic. It's used to count how many ios are
      in the submitting process and it's added and decreased very time. But it
      only needs to check if it's zero when suspending the raid. So we can
      switch atomic to percpu to improve the performance.
      
      After switching active_io to percpu type, we use the state of active_io
      to judge if the raid device is suspended. And we don't need to wake up
      ->sb_wait in md_handle_request anymore. It's done in the callback function
      which is registered when initing active_io. The argument mddev->suspended
      is only used to count how many users are trying to set raid to suspend
      state.
      Signed-off-by: default avatarXiao Ni <xni@redhat.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      72adae23
    • Xiao Ni's avatar
      md: Factor out is_md_suspended helper · d1932913
      Xiao Ni authored
      This helper function will be used in next patch. It's easy for
      understanding.
      Signed-off-by: default avatarXiao Ni <xni@redhat.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      d1932913
    • Hou Tao's avatar
      md: don't update recovery_cp when curr_resync is ACTIVE · 1d1f25bf
      Hou Tao authored
      Don't update recovery_cp when curr_resync is MD_RESYNC_ACTIVE, otherwise
      md may skip the resync of the first 3 sectors if the resync procedure is
      interrupted before the first calling of ->sync_request() as shown below:
      
      md_do_sync thread          control thread
        // setup resync
        mddev->recovery_cp = 0
        j = 0
        mddev->curr_resync = MD_RESYNC_ACTIVE
      
                                   // e.g., set array as idle
                                   set_bit(MD_RECOVERY_INTR, &&mddev_recovery)
        // resync loop
        // check INTR before calling sync_request
        !test_bit(MD_RECOVERY_INTR, &mddev->recovery
      
        // resync interrupted
        // update recovery_cp from 0 to 3
        // the resync of three 3 sectors will be skipped
        mddev->recovery_cp = 3
      
      Fixes: eac58d08 ("md: Use enum for overloaded magic numbers used by mddev->curr_resync")
      Cc: stable@vger.kernel.org # 6.0+
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      1d1f25bf
    • Bart Van Assche's avatar
      loop: Improve the hw_queue_depth kernel module parameter implementation · e152a05f
      Bart Van Assche authored
      Make the following minor changes which were reported by colleagues
      while reviewing this code:
      - Remove the parentheses from around the LOOP_DEFAULT_HW_Q_DEPTH
        definition since these are superfluous.
      - Accept other number formats than decimal, e.g. hexadecimal.
      - Do not set hw_queue_depth to an out-of-range value, even if that value
        won't be used.
      - Use the LOOP_DEFAULT_HW_Q_DEPTH macro in the kernel module parameter
        description to prevent that the description gets out of sync.
      
      This patch has been tested as follows:
      
       # modprobe -r loop
       # modprobe loop hw_queue_depth=-1
       modprobe: ERROR: could not insert 'loop': Invalid argument
       # modprobe loop hw_queue_depth=0
       modprobe: ERROR: could not insert 'loop': Invalid argument
       # modprobe loop hw_queue_depth=1; cat /sys/module/loop/parameters/hw_queue_depth
       1
       # modprobe -r loop; modprobe loop; cat /sys/module/loop/parameters/hw_queue_depth hw_queue_depth=0x10
       16
       # modprobe -r loop; modprobe loop; cat /sys/module/loop/parameters/hw_queue_depth hw_queue_depth=128
       128
       # modprobe -r loop; modprobe loop hw_queue_depth=129; cat /sys/module/loop/parameters/hw_queue_depth
       129
       # modprobe -r loop; modprobe loop hw_queue_depth=$((1<<32))
       modprobe: ERROR: could not insert 'loop': Numerical result out of range
      
      See also commit ef44c508 ("loop: allow user to set the queue
      depth").
      
      Cc: Chaitanya Kulkarni <kch@nvidia.com>
      Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
      Link: https://lore.kernel.org/r/20230130211347.832110-1-bvanassche@acm.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      e152a05f
  2. 31 Jan, 2023 2 commits
  3. 30 Jan, 2023 14 commits
  4. 29 Jan, 2023 20 commits