LWN: Comments on "Driver porting: a simple block driver" https://lwn.net/Articles/25415/ This is a special feed containing comments posted to the individual LWN article titled "Driver porting: a simple block driver". en-us Fri, 19 Sep 2025 13:56:09 +0000 Fri, 19 Sep 2025 13:56:09 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Driver porting: a simple block driver https://lwn.net/Articles/25524/ https://lwn.net/Articles/25524/ axboe Oh, wrt request flags again. The same point applies (even more so) to checking the data direction of a request. You want to use rq_data_dir(rq) (which returns READ or WRITE), not look at the direction bit in the flags. Fri, 14 Mar 2003 20:05:22 +0000 Driver porting: a simple block driver https://lwn.net/Articles/25523/ https://lwn.net/Articles/25523/ axboe Nice article, two small comments:<p>- Recent developments in IO schedulers (the anticipatory version) differentiates between &quot;is the pending request queue empty&quot; and &quot;are there request pending, but you must not start one now&quot;. This means that the best way to write the queueing loop for the request_fn is simply:<p>while ((rq = elv_next_request(q)) != NULL)<br> /* handle request */<p>and just forget about whether the queue is conceptually empty or not.<p>- 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-&gt;flags. For checking whether this is a regular fs request or not, you would use blk_fs_request(rq).<p>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:<p>if (!(rq-&gt;flags &amp; REQ_CMD))<p>and not<p>if (!rq-&gt;flags &amp; REQ_CMD)<p>Of course this is a moot point if you just use blk_fs_request() instead. Fri, 14 Mar 2003 20:01:31 +0000