Skip to contentSkip to conversation

plugging in 2.4. Does it work?

DISCUSSION Peter T. Breuer 2 participants 3 messages Feb 21, 2001

lore
Share & tools
lore
#0 lore raw

"Jens Axboe wrote:"

Quoted 5 lines

It will still cluster, the code above checks if the next bh is contigious -- if it isn't, then check if we can grow another segment. So you may be lucky that some buffer_heads in the chain are indeed contiguous, that's what the segment count is for. This is exactly the same in 2.4.

OK .. that fixed it. Turned out that I wasn't walking the request bh's on read of clustered requests (but I was doing so on write).

Reads now work fine, but writes show signs of having some problem. I'll beat on that later.

I'm particularly concerned about the error behaviour. How should I set up the end_request code in the case when the request is to be errored? Recall that my end_request code is presently like this:

     io_spin_lock
     while (end_that_request_first(req,!req->errors);
     // one more time for luck
     if (!end_that_request_first(req,!req->errors)
        end_that_request_last(req);
     io_spin_unlock

and I get the impression from other driver code snippets that a single end_that_request_first is enough, but looking at the implementation it can't be. It looks from ll_rw_blk that I should walk the bh chain just the same in the case of error, no?

Peter

#1 lore raw
Quoted 11 lines · Peter T. Breuer

I'm particularly concerned about the error behaviour. How should I set up the end_request code in the case when the request is to be errored? Recall that my end_request code is presently like this:

     io_spin_lock
     while (end_that_request_first(req,!req->errors);
     // one more time for luck
     if (!end_that_request_first(req,!req->errors)
        end_that_request_last(req);
     io_spin_unlock
Quoted 4 lines

and I get the impression from other driver code snippets that a single end_that_request_first is enough, but looking at the implementation it can't be. It looks from ll_rw_blk that I should walk the bh chain just the same in the case of error, no?

The implementation in ll_rw_blk.c (and other places) assumes that a failed request just means the first chunk and it then makes sense to just end i/o on that buffer and resetup the request for the next buffer. If you want to completely scrap the request on an error, then you'll just have to do that manually (ie loop end_that_request_first and end_that_request_last at the end).

void my_end_request(struct request *rq, int uptodate)

{
	while (end_that_request_first(rq, uptodate))
		;

	io_lock
	end_that_request_last(rq);
	io_unlock
}

And why you keep insisting on a duplicate end_that_request_first I don't know?!

Signature · 1 line
Jens Axboe
#2 lore raw

"A month of sundays ago Jens Axboe wrote:"

Quoted 8 lines

The implementation in ll_rw_blk.c (and other places) assumes that a failed request just means the first chunk and it then makes sense to just end i/o on that buffer and resetup the request for the next buffer. If you want to completely scrap the request on an error, then you'll just have to do that manually (ie loop end_that_request_first and end_that_request_last at the end).

void my_end_request(struct request *rq, int uptodate)

Quoted 8 lines
{
	while (end_that_request_first(rq, uptodate))
		;

	io_lock
	end_that_request_last(rq);
	io_unlock
}

OK, thanks!

Quoted 2 lines

And why you keep insisting on a duplicate end_that_request_first I don't know?!

Backwards compatibility. The code has to keep working under older kernel versions too in order to pass the regression tests, and the simplest thing is to put the front while loop in an ifdef while I work on it. At some stage soon I'll do as you want. Things have stopped oopsing on write now, and I've sent it for testing.

That's also why I have the io_lock around the whole code instead of only the last part. I have to put it around something that at least existed in 2.2 and even 2.0. I've stepped the version number and will be revising the code while its being tested. But thanks for the concern :-). I appreciate it!

Peter