linux/drivers/md
Jon Derrick 8745faa956 md: Use optimal I/O size for last bitmap page
If the bitmap space has enough room, size the I/O for the last bitmap
page write to the optimal I/O size for the storage device. The expanded
write is checked that it won't overrun the data or metadata.

The drive this was tested against has higher latencies when there are
sub-4k writes due to device-side read-mod-writes of its atomic 4k write
unit. This change helps increase performance by sizing the last bitmap
page I/O for the device's preferred write unit, if it is given.

Example Intel/Solidigm P5520
Raid10, Chunk-size 64M, bitmap-size 57228 bits

$ mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/nvme{0,1,2,3}n1
        --assume-clean --bitmap=internal --bitmap-chunk=64M
$ fio --name=test --direct=1 --filename=/dev/md0 --rw=randwrite --bs=4k --runtime=60

Without patch:
  write: IOPS=1676, BW=6708KiB/s (6869kB/s)(393MiB/60001msec); 0 zone resets

With patch:
  write: IOPS=15.7k, BW=61.4MiB/s (64.4MB/s)(3683MiB/60001msec); 0 zone resets

Biosnoop:
Without patch:
Time        Process        PID     Device      LBA        Size      Lat
1.410377    md0_raid10     6900    nvme0n1   W 16         4096      0.02
1.410387    md0_raid10     6900    nvme2n1   W 16         4096      0.02
1.410374    md0_raid10     6900    nvme3n1   W 16         4096      0.01
1.410381    md0_raid10     6900    nvme1n1   W 16         4096      0.02
1.410411    md0_raid10     6900    nvme1n1   W 115346512  4096      0.01
1.410418    md0_raid10     6900    nvme0n1   W 115346512  4096      0.02
1.410915    md0_raid10     6900    nvme2n1   W 24         3584      0.43 <--
1.410935    md0_raid10     6900    nvme3n1   W 24         3584      0.45 <--
1.411124    md0_raid10     6900    nvme1n1   W 24         3584      0.64 <--
1.411147    md0_raid10     6900    nvme0n1   W 24         3584      0.66 <--
1.411176    md0_raid10     6900    nvme3n1   W 2019022184 4096      0.01
1.411189    md0_raid10     6900    nvme2n1   W 2019022184 4096      0.02

With patch:
Time        Process        PID     Device      LBA        Size      Lat
5.747193    md0_raid10     727     nvme0n1   W 16         4096      0.01
5.747192    md0_raid10     727     nvme1n1   W 16         4096      0.02
5.747195    md0_raid10     727     nvme3n1   W 16         4096      0.01
5.747202    md0_raid10     727     nvme2n1   W 16         4096      0.02
5.747229    md0_raid10     727     nvme3n1   W 1196223704 4096      0.02
5.747224    md0_raid10     727     nvme0n1   W 1196223704 4096      0.01
5.747279    md0_raid10     727     nvme0n1   W 24         4096      0.01 <--
5.747279    md0_raid10     727     nvme1n1   W 24         4096      0.02 <--
5.747284    md0_raid10     727     nvme3n1   W 24         4096      0.02 <--
5.747291    md0_raid10     727     nvme2n1   W 24         4096      0.02 <--
5.747314    md0_raid10     727     nvme2n1   W 2234636712 4096      0.01
5.747317    md0_raid10     727     nvme1n1   W 2234636712 4096      0.02

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jon Derrick <jonathan.derrick@linux.dev>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230224183323.638-4-jonathan.derrick@linux.dev
2023-04-13 22:20:24 -07:00
..
bcache flexible-array transformations for 6.3-rc1 2023-02-25 12:53:42 -08:00
persistent-data dm: add missing blank line after declarations/fix those 2023-02-14 14:23:07 -05:00
dm-audit.c dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-audit.h dm: introduce audit event module for device mapper 2021-10-27 16:53:47 -04:00
dm-bio-prison-v1.c dm: don't indent labels 2023-02-14 14:23:07 -05:00
dm-bio-prison-v1.h dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-bio-prison-v2.c dm: address space issues relative to switch/while/for/... 2023-02-14 14:23:06 -05:00
dm-bio-prison-v2.h dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-bio-record.h dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-bufio.c dm: fix use of sizeof() macro 2023-02-14 14:23:07 -05:00
dm-builtin.c dm: adjust EXPORT_SYMBOL() to follow functions immediately 2023-02-14 14:23:07 -05:00
dm-cache-background-tracker.c dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-cache-background-tracker.h dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-cache-block-types.h dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-cache-metadata.c dm: prefer '"%s...", __func__' 2023-02-14 14:23:07 -05:00
dm-cache-metadata.h dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-cache-policy-internal.h dm: add missing empty lines 2023-02-14 14:23:06 -05:00
dm-cache-policy-smq.c dm: add missing empty lines 2023-02-14 14:23:06 -05:00
dm-cache-policy.c dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-cache-policy.h dm: address indent/space issues 2023-02-14 14:23:06 -05:00
dm-cache-target.c dm cache: add cond_resched() to various workqueue loops 2023-02-17 14:49:12 -05:00
dm-clone-metadata.c dm clone metadata: remove unused function 2021-04-19 13:20:31 -04:00
dm-clone-metadata.h dm clone metadata: Fix return type of dm_clone_nr_of_hydrated_regions() 2020-03-27 14:42:51 -04:00
dm-clone-target.c dm clone: prefer kvmalloc_array() 2023-02-14 14:23:08 -05:00
dm-core.h dm: add argument identifier names 2023-02-14 14:23:06 -05:00
dm-crypt.c - Fix DM cache target to free background tracker work items, otherwise 2023-02-22 13:21:31 -08:00
dm-delay.c dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-dust.c dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-ebs-target.c dm: avoid spaces before function arguments or in favour of tabs 2023-02-14 14:23:06 -05:00
dm-era-target.c dm: prefer '"%s...", __func__' 2023-02-14 14:23:07 -05:00
dm-exception-store.c dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-exception-store.h dm: avoid spaces before function arguments or in favour of tabs 2023-02-14 14:23:06 -05:00
dm-flakey.c dm: add missing empty lines 2023-02-14 14:23:06 -05:00
dm-ima.c dm: avoid inline filenames 2023-02-14 14:23:07 -05:00
dm-ima.h dm: avoid inline filenames 2023-02-14 14:23:07 -05:00
dm-init.c dm: avoid inline filenames 2023-02-14 14:23:07 -05:00
dm-integrity.c - Fix DM cache target to free background tracker work items, otherwise 2023-02-22 13:21:31 -08:00
dm-io-rewind.c dm: avoid void function return statements 2023-02-14 14:23:07 -05:00
dm-io-tracker.h dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-io.c dm: don't indent labels 2023-02-14 14:23:07 -05:00
dm-ioctl.c dm ioctl: remove unnecessary check when using dm_get_mdptr() 2023-02-17 14:49:21 -05:00
dm-kcopyd.c dm: fix use of sizeof() macro 2023-02-14 14:23:07 -05:00
dm-linear.c dm: don't indent labels 2023-02-14 14:23:07 -05:00
dm-log-userspace-base.c dm: avoid void function return statements 2023-02-14 14:23:07 -05:00
dm-log-userspace-transfer.c dm: avoid split of quoted strings where possible 2023-02-14 14:23:07 -05:00
dm-log-userspace-transfer.h dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-log-writes.c dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-log.c dm log: avoid multiple line dereference 2023-02-14 14:23:07 -05:00
dm-mpath.c dm: update targets using system workqueues to use a local workqueue 2023-02-14 14:23:08 -05:00
dm-mpath.h dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-path-selector.c dm: adjust EXPORT_SYMBOL() to follow functions immediately 2023-02-14 14:23:07 -05:00
dm-path-selector.h dm: avoid spaces before function arguments or in favour of tabs 2023-02-14 14:23:06 -05:00
dm-ps-historical-service-time.c dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-ps-io-affinity.c dm: address space issues relative to switch/while/for/... 2023-02-14 14:23:06 -05:00
dm-ps-queue-length.c dm: avoid spaces before function arguments or in favour of tabs 2023-02-14 14:23:06 -05:00
dm-ps-round-robin.c dm: correct block comments format. 2023-02-14 14:23:06 -05:00
dm-ps-service-time.c dm: avoid spaces before function arguments or in favour of tabs 2023-02-14 14:23:06 -05:00
dm-raid.c dm: fix suspect indent whitespace 2023-02-14 14:23:07 -05:00
dm-raid1.c dm: update targets using system workqueues to use a local workqueue 2023-02-14 14:23:08 -05:00
dm-region-hash.c dm: correct block comments format. 2023-02-14 14:23:06 -05:00
dm-rq.c dm: avoid using symbolic permissions 2023-02-14 14:23:07 -05:00
dm-rq.h dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-snap-persistent.c dm: avoid split of quoted strings where possible 2023-02-14 14:23:07 -05:00
dm-snap-transient.c dm: avoid split of quoted strings where possible 2023-02-14 14:23:07 -05:00
dm-snap.c dm: avoid split of quoted strings where possible 2023-02-14 14:23:07 -05:00
dm-stats.c dm: avoid using symbolic permissions 2023-02-14 14:23:07 -05:00
dm-stats.h dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-stripe.c dm: update targets using system workqueues to use a local workqueue 2023-02-14 14:23:08 -05:00
dm-switch.c dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-sysfs.c dm sysfs: make kobj_type structure constant 2023-02-14 14:23:08 -05:00
dm-table.c blk-crypto: make blk_crypto_evict_key() return void 2023-03-16 09:35:09 -06:00
dm-target.c dm: adjust EXPORT_SYMBOL() to follow functions immediately 2023-02-14 14:23:07 -05:00
dm-thin-metadata.c dm: avoid useless 'else' after 'break' or return' 2023-02-14 14:23:07 -05:00
dm-thin-metadata.h dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-thin.c dm thin: add cond_resched() to various workqueue loops 2023-02-17 14:46:27 -05:00
dm-uevent.c dm: avoid spaces before function arguments or in favour of tabs 2023-02-14 14:23:06 -05:00
dm-uevent.h dm: fix undue/missing spaces 2023-02-14 14:23:06 -05:00
dm-unstripe.c dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-verity-fec.c dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-verity-fec.h dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-verity-loadpin.c dm: verity-loadpin: Only trust verity targets with enforcement 2022-09-07 16:37:27 -07:00
dm-verity-target.c dm: avoid useless 'else' after 'break' or return' 2023-02-14 14:23:07 -05:00
dm-verity-verify-sig.c dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-verity-verify-sig.h dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-verity.h dm: change "unsigned" to "unsigned int" 2023-02-14 14:23:06 -05:00
dm-writecache.c dm: fix use of sizeof() macro 2023-02-14 14:23:07 -05:00
dm-zero.c dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-zone.c dm: add missing SPDX-License-Indentifiers 2023-02-14 14:23:06 -05:00
dm-zoned-metadata.c dm: don't indent labels 2023-02-14 14:23:07 -05:00
dm-zoned-reclaim.c dm kcopyd: avoid useless atomic operations 2021-06-04 12:07:24 -04:00
dm-zoned-target.c dm: avoid void function return statements 2023-02-14 14:23:07 -05:00
dm-zoned.h dm/dm-zoned: Use the enum req_op type 2022-07-14 12:14:31 -06:00
dm.c dm: remove unnecessary (void*) conversion in event_callback() 2023-02-20 11:52:49 -05:00
dm.h dm: correct block comments format. 2023-02-14 14:23:06 -05:00
Kconfig drivers/md: Remove "select SRCU" 2023-02-02 16:26:05 -08:00
Makefile hardening updates for v5.20-rc1 2022-08-02 14:38:59 -07:00
md-autodetect.c md: return the allocated devices from md_alloc 2022-08-02 17:22:46 -06:00
md-bitmap.c md: Use optimal I/O size for last bitmap page 2023-04-13 22:20:24 -07:00
md-bitmap.h
md-cluster.c fs: dlm: remove DLM_LSFL_FS from uapi 2022-08-23 14:54:54 -05:00
md-cluster.h
md-faulty.c block: pass a block_device to bio_clone_fast 2022-02-04 07:43:18 -07:00
md-linear.c md: remove most calls to bdevname 2022-05-22 23:07:21 -07:00
md-linear.h md/raid1: Replace zero-length array with flexible-array 2020-05-13 12:02:23 -07:00
md-multipath.c md: remove most calls to bdevname 2022-05-22 23:07:21 -07:00
md-multipath.h
md.c md: make kobj_type structures constant 2023-04-13 22:20:23 -07:00
md.h md: account io_acct_set usage with active_io 2023-02-08 15:46:57 -08:00
raid0.c md/raid0, raid10: Don't set discard sectors for request queue 2022-11-14 10:15:34 -08:00
raid0.h
raid1-10.c md: raid1/raid10: drop pending_cnt 2022-03-08 15:16:54 -08:00
raid1.c block: remove bio_set_op_attrs 2022-12-07 09:43:12 -07:00
raid1.h md: raid1/raid10: drop pending_cnt 2022-03-08 15:16:54 -08:00
raid5-cache.c md/raid5: use bdev_write_cache instead of open coding it 2022-11-14 10:15:35 -08:00
raid5-log.h md/raid5-ppl: Drop unused argument from ppl_handle_flush_request() 2022-08-02 17:14:31 -06:00
raid5-ppl.c md/raid5: use bdev_write_cache instead of open coding it 2022-11-14 10:15:35 -08:00
raid5.c md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d 2022-09-22 00:05:06 -07:00
raid5.h md/raid5: Cleanup prototype of raid5_get_active_stripe() 2022-09-22 00:05:04 -07:00
raid10.c md/raid10: Fix typo in comment (replacment -> replacement) 2023-04-13 22:20:23 -07:00
raid10.h md/raid10: convert resync_lock to use seqlock 2022-09-22 00:05:05 -07:00