|
|
Subscribe / Log in / New account

Driver porting: a simple block driver

Driver porting: a simple block driver

Posted Mar 14, 2003 20:01 UTC (Fri) by axboe (subscriber, #904)
Parent article: Driver porting: a simple block driver

Nice article, two small comments:

- Recent developments in IO schedulers (the anticipatory version) differentiates between "is the pending request queue empty" and "are there request pending, but you must not start one now". This means that the best way to write the queueing loop for the request_fn is simply:

while ((rq = elv_next_request(q)) != NULL)
/* handle request */

and just forget about whether the queue is conceptually empty or not.

- For compatability reasons (and for allowing me or others from changing the implementation beneath you!), you should use the blk_*_request() macros instead of looking directly at the request->flags. For checking whether this is a regular fs request or not, you would use blk_fs_request(rq).

There's also an error in the flags checking as it is written in the article, I don't know if this is due to the html conversion. But it should read:

if (!(rq->flags & REQ_CMD))

and not

if (!rq->flags & REQ_CMD)

Of course this is a moot point if you just use blk_fs_request() instead.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds