[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E09BC89.40306@free-electrons.com>
Date: Tue, 28 Jun 2011 13:35:37 +0200
From: David Wagner <david.wagner@...e-electrons.com>
To: dedekind1@...il.com
CC: dwmw2@...radead.org, linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] UBI: new module ubiblk: block layer on top of UBI
Hi,
On 06/27/2011 09:26 PM, Artem Bityutskiy wrote:
> On Fri, 2011-06-24 at 15:34 +0200, david.wagner@...e-electrons.com
> wrote:
>> + /* Stolen from mtd_blkdevs.c */
>> + /* Create processing thread */
>> + dev->thread = kthread_run(ubi_ubiblk_thread, dev, "%s%d_%d",
>> + "kubiblkd", dev->ubi_num, dev->vol_id);
>> + if (IS_ERR(dev->thread)) {
>> + ret = PTR_ERR(dev->thread);
>> + goto out_thread;
>> + }
>
> Why we need a kernel thread? Could you please describe when exactly it
> is needed and why we cannot avoid having it?
Do you mean that there could be another/better way ?
I read that workqueues could be used for that but since they seem to
internally use kthreads, I don't see the advantage yet. Simpler API ?
I also tried without a kthread altogether (and call do_ubiblk_request
directly within the callback registered with blk_init_queue) but got
lost in locks/context debugging ...
It seems that do_ubiblk_request needs to be in process context because
there are thousands causes for blocking (locking, page fault, for
instance, are the one I encountered). And on the other hand,
blk_run_queue must not block ; So we need to wake the thread up and
return (what ubi_ubiblk_request does).
So, would this be a sufficient justification ?
It's probably possible, however, to have only one thread for the whole
module instead of having one for each volume ; but that seemed good
enough on first approach.
I fixed the read errors issue with filesystems != SquashFS, so they
should all work, now.
I'll send the next iteration, probably later today.
--
David Wagner, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists