This is a replacement and extension of the patch titled: "[PATCH] sg: retrofit SG_FLAG_Q_AT_TAIL flag" The aim is to give control over midlevel queuing when commands are submitted via the sg, bsg and the block layer SG_IO ioctl pass-throughs. The current defaults remain: sg and bsg queue at_head while the block layer SG_IO ioctl queues at_tail . This patch allows user space programs that care to override the default queuing for the sg driver and the block layer SG_IO ioctl. The bsg driver already has this capability. This patch is against lk 2.6.33 Changelog - add SG_FLAG_Q_AT_TAIL and add SG_FLAG_Q_AT_HEAD flags to sg.h - act on these flags in the sg driver and the block layer SG_IO ioctl - correct stale urls in the sg driver code Signed-off-by: Douglas Gilbert