[ENBD] proxing ioctl's
Peter T. Breuer
ptb@it.uc3m.es
Thu, 15 Mar 2001 15:26:07 +0100 (MET)
"A month of sundays ago Daniel Shane wrote:"
> All we need to do is mark the page undeletable, and when we close
> the connection to a server, just destroy the reserved buffers.
>
> It looks like a 4 or 5 lines of code max to implement client
> side journaling. I even think it would be more efficient that
> the current solution.
Well, I don't know if this is "right", but it _seems_ to be working for
me... as far as I have tested, which is not much. I may simply be
looking at the ordinary kernel caching effect. I know the code was
called.
In the function nbd_do_request, which takes stuff off the kernel queue,
try changing the
nbd_enqueue(lo,req);
to
if ((req->cmd & 0x03) == WRITE && buffer_writes) {
struct buffer_head * bh;
// PTB take it off the queue and ack it now
blkdev_dequeue_request(req);
// PTB go through and protect the written buffers
for (bh = req->bh; bh; bh = bh->b_reqnext)
mark_buffer_protected(bh);
// PTB now vamoosh it normally
nbd_end_request(req);
} else {
nbd_enqueue(lo,req);
}
yah ... I added a MODULE_PARM(buffer_writes,"i"); and a static int
buffer_writes = 0; up top. If you have a better name, tell me.
I also added a stanza to write_proc allowing it to be set dynamically.
What happens to these buffers when one removes the driver? Don't I have
to do something about them? Do you think the protected bit is all that
is required?
Peter