When to use blk_end_request_* routines.

Pranay Kumar Srivastava Pranay.Shrivastava at hcl.com
Thu Mar 14 08:23:53 EDT 2013


Hi,

I'm using SLES11-SP1 kernel 2.6.32 .12-0.7

I wrote a block driver for an in-memory disk. The driver seems to work fine however sometimes when I try to unload the driver the machine freezes, the module_exit code looks like the following,

/*We take no more requests!*/
        spin_lock_irqsave(&pks_disk->queue_lock,flags);
                blk_stop_queue(pks_disk->pks_disk_rqq);
        spin_unlock_irqrestore(&pks_disk->queue_lock,flags);

/*Remove disk*/
        del_gendisk(pks_disk->pks_disk_gd);

/*free queue*/
        blk_cleanup_queue(pks_disk->pks_disk_rqq);

I searched around and found out that while processing the requests from request queue you've got to use one of the blk_end_request* functions (which I did). However if I only use

a) blk_end_request: The module removal code freezes machine.

b) blk_end_request_cur: The module removal code works fine.

There's one more
c)blk_end_request_all: Didn't used this one cuz the above one worked :P.

I digged around in the source and found this function
	blk_update_request 
 and in the comment section it says " Actual device drivers should use blk_end_request instead" which I did and the driver module didn't liked it when I tried to remove it :(

Now I'm confused as I've got no clue when to use which function can anyone give some examples please?

	--P.K.S


::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------




More information about the Kernelnewbies mailing list