This is part of my GSOC project, which is refactoring hardcoded block layer features into filter drivers. Block filter drivers are inserted into the graph only when a feature is needed. This makes the block layer more modular and reuses the block driver abstraction that is already present.
Before write notifiers currently have two users: block/backup.c uses before write notifiers to intercept write requests. This can be refactored to use the filter driver interface by injecting an implicit filter node to intercept the write requests and call backup_do_cow(). block/write-threshold.c checks that write requests do not pass a user set offset and issue an event when they do. A new write-threshold driver can perform the same function and be added by the user when block-{insert,remove}-node are introduced. It is not trivial to convert the existing interface (block-set-write-threshold) to using the filter driver. v2: add motivation in commit messages dropped hunk that removed before-write notifiers Manos Pitsidianakis (2): block: use internal filter node in backup block: add filter driver to block/write-threshold.c block.c | 89 ++++++++++++-- block/backup.c | 207 +++++++++++++++++++++++++++---- block/mirror.c | 7 +- block/qapi.c | 2 +- block/write-threshold.c | 264 +++++++++++++++++++++++++++++++++++----- blockdev.c | 2 +- include/block/block.h | 8 +- include/block/write-threshold.h | 22 ++-- qapi/block-core.json | 19 ++- tests/qemu-iotests/141.out | 2 +- tests/test-write-threshold.c | 40 +++--- 11 files changed, 557 insertions(+), 105 deletions(-) -- 2.11.0