How can I make a multi-page size block request in kernel?

Hyukjoong Kim wangmir at
Thu Apr 2 22:31:34 EDT 2015


I'm trying to make a special block request at the scsi high-level device
driver (scsi_lib.c).

My target device is SATA block storage, and SATA block stroage typically
use scsi_lib.c as a high-level device driver.

This block request is simple write request similar to typical block request
from file system, but doesn't pass through VFS and file system layer.

>From the linux kernel source, I found two keywords to solve this problem,
1) REQ_TYPE_BLOCK_PC, and 2) blk_make_request()

So, I make a request like this procedure,

bio malloc -> map data into bio using bio_add_pc_page (more than 2 pages)
-> get request structure using blk_make_request(q, bio, GFP_KERNEL) ->
setup request->cmd similar to sd_setup_read_write_cmnd() on sd.c

But am I right?  because I got some error on the SATA like this,

ata4.00: exception Emask 0x70 SAct 0x1e0 SErr 0x400900 action 0x6 frozen
ata4.00: irq_stat 0x28000000, host bus error, interface fatal error
ata4: SError: UnrecovData HostInt Handshk
ata4.00: failed command: WRITE FPDMA QUEUED
ata4.00: cmd61/10:28:00:00:c0/00:00:0d:00:00/40 tag 5 ncq 8192 out
              res 40/00:30:00:00:bf/00:00:0d:00:00/40 Emask 0x70 (host bus
ata4.00: status: {DRDY} ...

Anyone who has knowledge for make block request inside device driver? or,
solution for the error message?


-Hyukoong, Kim

김 혁 중
성균관대학교 IT 융합학과 박사과정
임베디드 소프트웨어 연구실

Kim, Hyukjoong
Sungkyunkwan University
Ph.D Course in Computer Engineering, IT Convergence
Embedded Software Lab.
e-mail : wangmir at / wangmir at
phone : +82 10-9489-8974
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list