]> www.infradead.org Git - users/dwmw2/linux.git/commit
dm io: don't call the async_io notify.fn on invalid num_regions
authorBenjamin Marzinski <bmarzins@redhat.com>
Tue, 2 Jul 2024 09:58:56 +0000 (11:58 +0200)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 2 Jul 2024 09:58:56 +0000 (11:58 +0200)
commitb0042ba7684c90d9c8e7deb500c73d6ae3872cfe
tree2a03fed07480ef0ff81dd5085696f73a9977f015
parent06a0b333e58407970e9b109d054610d2f107ca87
dm io: don't call the async_io notify.fn on invalid num_regions

If dm_io() returned an error, callers that set a notify.fn and wanted it
called on an error need to check the return value and call notify.fn
themselves if it was -EINVAL but not if it was -EIO. None of them do
this (granted, all the existing async_io users of dm_io call it in a way
that is guaranteed to not return an error).

Simplify the interface by never calling the notify.fn if dm_io returns
an error. This works with the existing dm_io callers which check for an
error and handle it using the same methods as the notify.fn.

This also allows us to move the now equivalent num_regions checks out of
sync_io() and async_io() and into dm_io() itself. Additionally, change
async_io() into a void function, since it can no longer fail.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-io.c