pstore/blk: Introduce backend for block devices
authorWeiXiong Liao <liaoweixiong@allwinnertech.com>
Wed, 25 Mar 2020 08:54:57 +0000 (16:54 +0800)
committerKees Cook <keescook@chromium.org>
Sat, 30 May 2020 17:34:03 +0000 (10:34 -0700)
commit17639f67c1d61aba3c05e7703f75cd468f9d484f
tree029d85bdaab1530b7b76d47e2033137864857afc
parentd26c3321fe18dc74517dc1f518d584aa33b0a851
pstore/blk: Introduce backend for block devices

pstore/blk is similar to pstore/ram, but uses a block device as the
storage rather than persistent ram.

The pstore/blk backend solves two common use-cases that used to preclude
using pstore/ram:
- not all devices have a battery that could be used to persist
  regular RAM across power failures.
- most embedded intelligent equipment have no persistent ram, which
  increases costs, instead preferring cheaper solutions, like block
  devices.

pstore/blk provides separate configurations for the end user and for the
block drivers. User configuration determines how pstore/blk operates, such
as record sizes, max kmsg dump reasons, etc. These can be set by Kconfig
and/or module parameters, but module parameter have priority over Kconfig.
Driver configuration covers all the details about the target block device,
such as total size of the device and how to perform read/write operations.
These are provided by block drivers, calling pstore_register_blkdev(),
including an optional panic_write callback used to bypass regular IO
APIs in an effort to avoid potentially destabilized kernel code during
a panic.

Signed-off-by: WeiXiong Liao <liaoweixiong@allwinnertech.com>
Link: https://lore.kernel.org/lkml/20200511233229.27745-3-keescook@chromium.org/
Co-developed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/Kconfig
fs/pstore/Makefile
fs/pstore/blk.c [new file with mode: 0644]
include/linux/pstore_blk.h [new file with mode: 0644]