diff options
author | Nathan Huckleberry <nhuck@google.com> | 2022-07-22 09:38:22 +0000 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2022-07-28 17:46:14 -0400 |
commit | b32d45824aa7e07a0c3257a16e3a2a691b11b39a (patch) | |
tree | db93c750daee944f024e6954659f8907100b48f9 /include/linux/dm-bufio.h | |
parent | 0fcb100d50835d6823723ef0898cd565b3796e0a (diff) |
dm bufio: Add DM_BUFIO_CLIENT_NO_SLEEP flag
Add an optional flag that ensures dm_bufio_client does not sleep
(primary focus is to service dm_bufio_get without sleeping). This
allows the dm-bufio cache to be queried from interrupt context.
To ensure that dm-bufio does not sleep, dm-bufio must use a spinlock
instead of a mutex. Additionally, to avoid deadlocks, special care
must be taken so that dm-bufio does not sleep while holding the
spinlock.
But again: the scope of this no_sleep is initially confined to
dm_bufio_get, so __alloc_buffer_wait_no_callback is _not_ changed to
avoid sleeping because __bufio_new avoids allocation for NF_GET.
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'include/linux/dm-bufio.h')
-rw-r--r-- | include/linux/dm-bufio.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/dm-bufio.h b/include/linux/dm-bufio.h index e21480715255..15d9e15ca830 100644 --- a/include/linux/dm-bufio.h +++ b/include/linux/dm-bufio.h @@ -18,6 +18,11 @@ struct dm_bufio_client; struct dm_buffer; /* + * Flags for dm_bufio_client_create + */ +#define DM_BUFIO_CLIENT_NO_SLEEP 0x1 + +/* * Create a buffered IO cache on a given device */ struct dm_bufio_client * |