Subject: Re: Writing to disk from the network stack (bottom half of the kernel)
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Paul Sommerhein <>
List: tech-kern
Date: 02/05/2003 20:38:23
On Tue, Feb 04, 2003 at 09:31:48AM -0800, Jonathan Stone wrote:
> >Ok, this might not be feasible, but what I want to do is to
> >write a 64kB chunk of data to the end of a disk file from
> >within the network stack in the bottom half of the kernel
> >(incoming data path, no process context).
> You should create a kernel thread and use it as a `write helper'
> Create a queue of pending writes, synchronize with the queue
> (from both sides) with a suitable bottohnetlf interrupt
> priority.
> The helper will run a loop: tsleep() on the queue head waiting
> for more data to arrive; then checking for a non-empty queue. If
> non-empty, it removes the first element, writes it, and checks
> again.  The bottom-half enqueue does a wakeup on the queue
> address if it attempts an insert whilst the queue is nonempty.

Thanks, I will go for this.  Given that the some of the file
system code I would have to use (like block allocation) will
sometimes block and therefore requires context, I now see that
besides a kernel thread, using a process would be the only other
viable option.

Thanks to all who responded!

Best regards,