closures: move to lib/
Subsystems (3)
PATCH 1/1 closures: move to lib/
the closure code was never intended to be bcache specific - hopefully it can be useful elsewhere in the kernel.
--- drivers/md/bcache/Kconfig | 9 - drivers/md/bcache/Makefile | 2 +- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/closure.c | 222 ---------------------- drivers/md/bcache/closure.h | 453 -------------------------------------------- drivers/md/bcache/util.h | 3 +- include/linux/closure.h | 451 +++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 8 + lib/Makefile | 2 +- lib/closure.c | 218 +++++++++++++++++++++ 10 files changed, 681 insertions(+), 689 deletions(-) delete mode 100644 drivers/md/bcache/closure.c delete mode 100644 drivers/md/bcache/closure.h create mode 100644 include/linux/closure.h create mode 100644 lib/closure.c
drivers/md/bcache/Kconfig +0 -9
@@ -16,15 +16,6 @@ config BCACHE_DEBUG Enables extra debugging tools, allows expensive runtime checks to be turned on. -config BCACHE_CLOSURES_DEBUG - bool "Debug closures" - depends on BCACHE - select DEBUG_FS - ---help--- - Keeps all active closures in a linked list and provides a debugfs - interface to list them, which makes it possible to see asynchronous - operations that get stuck. - # cgroup code needs to be updated: # #config CGROUP_BCACHE
drivers/md/bcache/Makefile +1 -1
@@ -2,6 +2,6 @@ obj-$(CONFIG_BCACHE) += bcache.o bcache-y := alloc.o btree.o bset.o io.o journal.o writeback.o\ - movinggc.o request.o super.o sysfs.o debug.o util.o trace.o stats.o closure.o + movinggc.o request.o super.o sysfs.o debug.o util.o trace.o stats.o CFLAGS_request.o += -Iblock
drivers/md/bcache/bcache.h +1 -1
@@ -179,6 +179,7 @@#include <linux/bcache.h> #include <linux/bio.h> +#include <linux/closure.h> #include <linux/kobject.h> #include <linux/list.h> #include <linux/mutex.h>
@@ -188,7 +189,6 @@#include <linux/workqueue.h> #include "util.h" -#include "closure.h" struct bucket {atomic_t pin;
drivers/md/bcache/closure.c deleted +0 -222
222 lines not on this page · raw message
drivers/md/bcache/closure.h deleted +0 -453
453 lines not on this page · raw message
drivers/md/bcache/util.h +1 -2
@@ -2,6 +2,7 @@#ifndef _BCACHE_UTIL_H#define _BCACHE_UTIL_H +#include <linux/closure.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/llist.h>
@@ -9,8 +10,6 @@#include <linux/vmalloc.h> #include <linux/workqueue.h> -#include "closure.h" -#define PAGE_SECTORS (PAGE_SIZE / 512)struct closure ;
include/linux/closure.h new file +451 -0
451 lines not on this page · raw message
lib/Kconfig.debug +8 -0
@@ -1240,6 +1240,14 @@ config DEBUG_BLOCK_EXT_DEVT Say N if you are unsure. +config CLOSURE_DEBUG + bool "Debug closures" + select DEBUG_FS + ---help--- + Keeps all active closures in a linked list and provides a debugfs + interface to list them, which makes it possible to see asynchronous + operations that get stuck. + config NOTIFIER_ERROR_INJECTION tristate "Notifier error injection" depends on DEBUG_KERNEL
lib/Makefile +1 -1
@@ -26,7 +26,7 @@ obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ - percpu-refcount.o percpu_ida.o + percpu-refcount.o percpu_ida.o closure.o obj-y += string_helpers.o obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o obj-y += kstrtox.o
lib/closure.c new file +218 -0
218 lines not on this page · raw message
Signature · 1 line
1.8.5.1
Quoted 9 lines · Kent Overstreet
the closure code was never intended to be bcache specific - hopefully it can be useful elsewhere in the kernel.
Signed-off-by Kent Overstreet <[email protected]>Cc Tejun Heo <[email protected]>Cc Andrew Morton <[email protected]>Cc Oleg Nesterov <[email protected]>Cc Arjan van de Ven <[email protected]>Cc Dan Williams <[email protected]>
Quoted 16 lines
--- drivers/md/bcache/Kconfig | 9 - drivers/md/bcache/Makefile | 2 +- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/closure.c | 222 ---------------------- drivers/md/bcache/closure.h | 453 -------------------------------------------- drivers/md/bcache/util.h | 3 +- include/linux/closure.h | 451 +++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 8 + lib/Makefile | 2 +- lib/closure.c | 218 +++++++++++++++++++++ 10 files changed, 681 insertions(+), 689 deletions(-) delete mode 100644 drivers/md/bcache/closure.c delete mode 100644 drivers/md/bcache/closure.h create mode 100644 include/linux/closure.h create mode 100644 lib/closure.c
This would be smaller to review with git diff -M
Quoted 27 lines · Dan Williams
Quoted 9 lines · Kent Overstreet
the closure code was never intended to be bcache specific - hopefully it can be useful elsewhere in the kernel.
Signed-off-by Kent Overstreet <[email protected]>Cc Tejun Heo <[email protected]>Cc Andrew Morton <[email protected]>Cc Oleg Nesterov <[email protected]>Cc Arjan van de Ven <[email protected]>Cc Dan Williams <[email protected]>Quoted 16 lines
--- drivers/md/bcache/Kconfig | 9 - drivers/md/bcache/Makefile | 2 +- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/closure.c | 222 ---------------------- drivers/md/bcache/closure.h | 453 -------------------------------------------- drivers/md/bcache/util.h | 3 +- include/linux/closure.h | 451 +++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 8 + lib/Makefile | 2 +- lib/closure.c | 218 +++++++++++++++++++++ 10 files changed, 681 insertions(+), 689 deletions(-) delete mode 100644 drivers/md/bcache/closure.c delete mode 100644 drivers/md/bcache/closure.h create mode 100644 include/linux/closure.h create mode 100644 lib/closure.c
Quoted 1 line
This would be smaller to review with git diff -M
I forgot to mention - this is on top of other stuff I have queued up which deletes a fair amount of code in closure.[ch] (finally got rid of some stuff Tejun hated).
Quoted 2 lines · Kent Overstreet
the closure code was never intended to be bcache specific - hopefully it can be useful elsewhere in the kernel.
They are not. They aren't closures in the CS sense, and they are an ugly mess. Please work on removing them instead.
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Kent Overstreet
the closure code was never intended to be bcache specific - hopefully it can be useful elsewhere in the kernel.
They are not. They aren't closures in the CS sense,
If you consider the key thing behind CS closures to be spaghetti stacks, then actually these kind of are.
Quoted 2 lines
and they are an
ugly mess. Please work on removing them instead.
That's not really the kind of technical objection one can respond to. If you think there's a better way of doing this kind of asynchronous stuff, or a better mechanism already in the kernel (ha!) - please, by all means, enlighten us.
Quoted 4 lines · Kent Overstreet
That's not really the kind of technical objection one can respond to. If you think there's a better way of doing this kind of asynchronous stuff, or a better mechanism already in the kernel (ha!) - please, by all means, enlighten us.
Show the actual use, and it shouldn't be hard to find something better.
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Kent Overstreet
That's not really the kind of technical objection one can respond to. If you think there's a better way of doing this kind of asynchronous stuff, or a better mechanism already in the kernel (ha!) - please, by all means, enlighten us.
Show the actual use, and it shouldn't be hard to find something better.
Grep through drivers/md/bcache/...
Hello,
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Kent Overstreet
the closure code was never intended to be bcache specific - hopefully it can be useful elsewhere in the kernel.
They are not. They aren't closures in the CS sense, and they are an ugly mess. Please work on removing them instead.
I pretty much agree with Christoph here. Compared to all other generic utilities we have, the proposed mechanism is giant in its conceptual complexity. This is a lot worse than semaphores. I personally think inclusion of it in the upstream kernel at all was a bad idea.
Thanks.
Signature · 1 line
tejun
Quoted 1 line · Kent Overstreet
Grep through
drivers/md/bcache/...
While that will require a fair amount of work I'm pretty sure we could untangle that mess as well. But what I meant was whatever piece of code that motivated you to move the code to lib/.