[PATCH] tux3: Use system_long_wq instead of kernel_bdi_wq
Dongsu Park
dongsu.park at profitbricks.com
Thu May 22 02:53:51 PDT 2014
From: Dongsu Park <dongsu.park at profitbricks.com>
Using kallsyms_lookup_name() for looking up bdi_wq doesn't look like
a good idea. Because kallsyms_lookup_name("bdi_wq") returns NULL, when
CONFIG_KALLSYMS_ALL is not configured in the kernel. That results in
the whole filesystem being unable to be mounted. Given that not every
kernel is configured with CONFIG_KALLSYMS_ALL, that kind of hack will
not always work.
Moreover, it does not look necessary at all, to manage its own workqueue
kernel_bdi_wq. It's just enough to queue a work item to system_long_wq.
Cc: Daniel Phillips <daniel at phunq.net>
Cc: OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
Signed-off-by: Dongsu Park <dongsu.park at profitbricks.com>
---
fs/tux3/commit_flusher_hack.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/fs/tux3/commit_flusher_hack.c b/fs/tux3/commit_flusher_hack.c
index 08696edccf26..dfd1c799207d 100644
--- a/fs/tux3/commit_flusher_hack.c
+++ b/fs/tux3/commit_flusher_hack.c
@@ -275,9 +275,6 @@ static long tux3_do_writeback(struct bdi_writeback *wb)
return wrote;
}
-/* Dirty hack to get bdi_wq address from module */
-static struct workqueue_struct *kernel_bdi_wq;
-
/*
* Handle writeback of dirty data for the device backed by this bdi. Also
* reschedules periodically and does kupdated style flushing.
@@ -326,7 +323,7 @@ static void tux3_writeback_workfn(struct work_struct *work)
#endif
if (!list_empty(&bdi->work_list) ||
(wb_has_dirty_io(wb) && dirty_writeback_interval))
- queue_delayed_work(kernel_bdi_wq, &wb->dwork,
+ queue_delayed_work(system_long_wq, &wb->dwork,
msecs_to_jiffies(dirty_writeback_interval * 10));
current->flags &= ~PF_SWAPWRITE;
@@ -335,19 +332,6 @@ static void tux3_writeback_workfn(struct work_struct *work)
#include <linux/kallsyms.h>
static int tux3_setup_writeback(struct sb *sb, struct backing_dev_info *bdi)
{
- /* Dirty hack to get bdi_wq address from module */
- if (kernel_bdi_wq == NULL) {
- unsigned long wq_addr;
-
- wq_addr = kallsyms_lookup_name("bdi_wq");
- if (!wq_addr) {
- tux3_err(sb, "couldn't find bdi_wq address\n");
- return -EINVAL;
- }
- kernel_bdi_wq = *(struct workqueue_struct **)wq_addr;
- tux3_msg(sb, "use bdi_wq %p", kernel_bdi_wq);
- }
-
/* Overwrite callback by ourself handler */
INIT_DELAYED_WORK(&bdi->wb.dwork, tux3_writeback_workfn);
--
1.9.1
More information about the Tux3
mailing list