Sample block device driver linux kernel 3.X
Book referred : Linux Device Drivers
Linux Device Driver has everything you need to know about writing drivers. But since it is written with respect to linux kernel 2.6.X I am posting some alternate APIs for old deprecated APIs.
old –> new
elv_next_request() –> blk_fetch_request()
if (! blk_fs_request(req) –> if (req->cmd_type != REQ_TYPE_FS)
end_request(req, 0); –> __blk_end_request_all(req, 0);
end_request(req, 1); –> __blk_end_request_all(req, 0);