blk-core.c File Reference

Go to the source code of this file.

Defines

#define blkdev_free_rq(list)   list_entry((list)->next, struct request, queuelist)

Functions

 DEFINE_TRACE (block_plug)
 DEFINE_TRACE (block_unplug_io)
 DEFINE_TRACE (block_unplug_timer)
 DEFINE_TRACE (block_getrq)
 DEFINE_TRACE (block_sleeprq)
 DEFINE_TRACE (block_rq_requeue)
 DEFINE_TRACE (block_bio_backmerge)
 DEFINE_TRACE (block_bio_frontmerge)
 DEFINE_TRACE (block_bio_queue)
 DEFINE_TRACE (block_rq_complete)
 DEFINE_TRACE (block_remap)
 EXPORT_TRACEPOINT_SYMBOL_GPL (block_remap)
static int __make_request (struct request_queue *q, struct bio *bio)
static void drive_stat_acct (struct request *rq, int new_io)
void blk_queue_congestion_threshold (struct request_queue *q)
struct backing_dev_info * blk_get_backing_dev_info (struct block_device *bdev)
 blk_get_backing_dev_info - get the address of a queue's backing_dev_info : device
 EXPORT_SYMBOL (blk_get_backing_dev_info)
void blk_rq_init (struct request_queue *q, struct request *rq)
 EXPORT_SYMBOL (blk_rq_init)
static void req_bio_endio (struct request *rq, struct bio *bio, unsigned int nbytes, int error)
void blk_dump_rq_flags (struct request *rq, char *msg)
 EXPORT_SYMBOL (blk_dump_rq_flags)
void blk_plug_device (struct request_queue *q)
 EXPORT_SYMBOL (blk_plug_device)
void blk_plug_device_unlocked (struct request_queue *q)
 blk_plug_device_unlocked - plug a device without queue lock held : The &struct request_queue to plug
 EXPORT_SYMBOL (blk_plug_device_unlocked)
int blk_remove_plug (struct request_queue *q)
 EXPORT_SYMBOL (blk_remove_plug)
void __generic_unplug_device (struct request_queue *q)
void generic_unplug_device (struct request_queue *q)
 generic_unplug_device - fire a request queue : The &struct request_queue in question
 EXPORT_SYMBOL (generic_unplug_device)
static void blk_backing_dev_unplug (struct backing_dev_info *bdi, struct page *page)
void blk_unplug_work (struct work_struct *work)
void blk_unplug_timeout (unsigned long data)
void blk_unplug (struct request_queue *q)
 EXPORT_SYMBOL (blk_unplug)
static void blk_invoke_request_fn (struct request_queue *q)
void blk_start_queue (struct request_queue *q)
 blk_start_queue - restart a previously stopped queue : The &struct request_queue in question
 EXPORT_SYMBOL (blk_start_queue)
void blk_stop_queue (struct request_queue *q)
 blk_stop_queue - stop a queue : The &struct request_queue in question
 EXPORT_SYMBOL (blk_stop_queue)
void blk_sync_queue (struct request_queue *q)
 blk_sync_queue - cancel any pending callbacks on a queue : the queue
 EXPORT_SYMBOL (blk_sync_queue)
void __blk_run_queue (struct request_queue *q)
 __blk_run_queue - run a single device queue : The queue to run
 EXPORT_SYMBOL (__blk_run_queue)
void blk_run_queue (struct request_queue *q)
 blk_run_queue - run a single device queue : The queue to run
 EXPORT_SYMBOL (blk_run_queue)
void blk_put_queue (struct request_queue *q)
void blk_cleanup_queue (struct request_queue *q)
 EXPORT_SYMBOL (blk_cleanup_queue)
static int blk_init_free_list (struct request_queue *q)
struct request_queue * blk_alloc_queue (gfp_t gfp_mask)
 EXPORT_SYMBOL (blk_alloc_queue)
struct request_queue * blk_alloc_queue_node (gfp_t gfp_mask, int node_id)
 EXPORT_SYMBOL (blk_alloc_queue_node)
struct request_queue * blk_init_queue (request_fn_proc *rfn, spinlock_t *lock)
 blk_init_queue - prepare a request queue for use with a block device : The function to be called to process requests that have been placed on the queue.
 EXPORT_SYMBOL (blk_init_queue)
struct request_queue * blk_init_queue_node (request_fn_proc *rfn, spinlock_t *lock, int node_id)
 EXPORT_SYMBOL (blk_init_queue_node)
int blk_get_queue (struct request_queue *q)
static void blk_free_request (struct request_queue *q, struct request *rq)
static struct request * blk_alloc_request (struct request_queue *q, int rw, int priv, gfp_t gfp_mask)
static int ioc_batching (struct request_queue *q, struct io_context *ioc)
static void ioc_set_batching (struct request_queue *q, struct io_context *ioc)
static void __freed_request (struct request_queue *q, int rw)
static void freed_request (struct request_queue *q, int rw, int priv)
static struct request * get_request (struct request_queue *q, int rw_flags, struct bio *bio, gfp_t gfp_mask)
static struct request * get_request_wait (struct request_queue *q, int rw_flags, struct bio *bio)
struct request * blk_get_request (struct request_queue *q, int rw, gfp_t gfp_mask)
 EXPORT_SYMBOL (blk_get_request)
void blk_start_queueing (struct request_queue *q)
 blk_start_queueing - initiate dispatch of requests to device : request queue to kick into gear
 EXPORT_SYMBOL (blk_start_queueing)
void blk_requeue_request (struct request_queue *q, struct request *rq)
 blk_requeue_request - put a request back on queue : request queue where request should be inserted : request to be inserted
 EXPORT_SYMBOL (blk_requeue_request)
void blk_insert_request (struct request_queue *q, struct request *rq, int at_head, void *data)
 blk_insert_request - insert a special request into a request queue : request queue where request should be inserted : request to be inserted : insert request at head or tail of queue : private data
 EXPORT_SYMBOL (blk_insert_request)
static void add_request (struct request_queue *q, struct request *req)
static void part_round_stats_single (int cpu, struct hd_struct *part, unsigned long now)
void part_round_stats (int cpu, struct hd_struct *part)
 part_round_stats() - Round off the performance stats on a struct disk_stats.
 EXPORT_SYMBOL_GPL (part_round_stats)
void __blk_put_request (struct request_queue *q, struct request *req)
 EXPORT_SYMBOL_GPL (__blk_put_request)
void blk_put_request (struct request *req)
 EXPORT_SYMBOL (blk_put_request)
void init_request_from_bio (struct request *req, struct bio *bio)
static void blk_partition_remap (struct bio *bio)
static void handle_bad_sector (struct bio *bio)
static int should_fail_request (struct bio *bio)
static int bio_check_eod (struct bio *bio, unsigned int nr_sectors)
static void __generic_make_request (struct bio *bio)
 generic_make_request - hand a buffer to its device driver for I/O : The bio describing the location in memory and on the device.
void generic_make_request (struct bio *bio)
 EXPORT_SYMBOL (generic_make_request)
void submit_bio (int rw, struct bio *bio)
 submit_bio - submit a bio to the block device layer for I/O : whether to READ or WRITE, or maybe to READA (read ahead) : The &struct bio which describes the I/O
 EXPORT_SYMBOL (submit_bio)
int blk_rq_check_limits (struct request_queue *q, struct request *rq)
 blk_rq_check_limits - Helper function to check a request for the queue limit : the queue : the request being checked
 EXPORT_SYMBOL_GPL (blk_rq_check_limits)
int blk_insert_cloned_request (struct request_queue *q, struct request *rq)
 blk_insert_cloned_request - Helper for stacking drivers to submit a request : the queue to submit the request : the request being queued
 EXPORT_SYMBOL_GPL (blk_insert_cloned_request)
void blkdev_dequeue_request (struct request *req)
 blkdev_dequeue_request - dequeue request and start timeout timer : request to dequeue
 EXPORT_SYMBOL (blkdev_dequeue_request)
static void blk_account_io_completion (struct request *req, unsigned int bytes)
static void blk_account_io_done (struct request *req)
static int __end_that_request_first (struct request *req, int error, int nr_bytes)
 __end_that_request_first - end I/O on a request : the request being processed : 0 for success, < 0 for error : number of bytes to complete
static void end_that_request_last (struct request *req, int error)
unsigned int blk_rq_bytes (struct request *rq)
 blk_rq_bytes - Returns bytes left to complete in the entire request : the request being processed
 EXPORT_SYMBOL_GPL (blk_rq_bytes)
unsigned int blk_rq_cur_bytes (struct request *rq)
 blk_rq_cur_bytes - Returns bytes left to complete in the current segment : the request being processed
 EXPORT_SYMBOL_GPL (blk_rq_cur_bytes)
void end_request (struct request *req, int uptodate)
 end_request - end I/O on the current segment of the request : the request being processed : error value or 0/1 uptodate flag
 EXPORT_SYMBOL (end_request)
static int end_that_request_data (struct request *rq, int error, unsigned int nr_bytes, unsigned int bidi_bytes)
static int blk_end_io (struct request *rq, int error, unsigned int nr_bytes, unsigned int bidi_bytes, int(drv_callback)(struct request *))
 blk_end_io - Generic end_io function to complete a request.
int blk_end_request (struct request *rq, int error, unsigned int nr_bytes)
 blk_end_request - Helper function for drivers to complete the request.
 EXPORT_SYMBOL_GPL (blk_end_request)
int __blk_end_request (struct request *rq, int error, unsigned int nr_bytes)
 __blk_end_request - Helper function for drivers to complete the request.
 EXPORT_SYMBOL_GPL (__blk_end_request)
int blk_end_bidi_request (struct request *rq, int error, unsigned int nr_bytes, unsigned int bidi_bytes)
 blk_end_bidi_request - Helper function for drivers to complete bidi request.
 EXPORT_SYMBOL_GPL (blk_end_bidi_request)
void blk_update_request (struct request *rq, int error, unsigned int nr_bytes)
 blk_update_request - Special helper function for request stacking drivers : the request being processed : 0 for success, < 0 for error : number of bytes to complete
 EXPORT_SYMBOL_GPL (blk_update_request)
int blk_end_request_callback (struct request *rq, int error, unsigned int nr_bytes, int(drv_callback)(struct request *))
 blk_end_request_callback - Special helper function for tricky drivers : the request being processed : 0 for success, < 0 for error : number of bytes to complete : function called between completion of bios in the request and completion of the request.
 EXPORT_SYMBOL_GPL (blk_end_request_callback)
void blk_rq_bio_prep (struct request_queue *q, struct request *rq, struct bio *bio)
int blk_lld_busy (struct request_queue *q)
 blk_lld_busy - Check if underlying low-level drivers of a device are busy : the queue of the device being checked
 EXPORT_SYMBOL_GPL (blk_lld_busy)
int kblockd_schedule_work (struct request_queue *q, struct work_struct *work)
 EXPORT_SYMBOL (kblockd_schedule_work)
int __init blk_dev_init (void)

Variables

static struct kmem_cacherequest_cachep
struct kmem_cacheblk_requestq_cachep
static struct workqueue_structkblockd_workqueue


Define Documentation

#define blkdev_free_rq ( list   )     list_entry((list)->next, struct request, queuelist)

Definition at line 738 of file blk-core.c.


Function Documentation

int __blk_end_request ( struct request *  rq,
int  error,
unsigned int  nr_bytes 
)

__blk_end_request - Helper function for drivers to complete the request.

: the request being processed : 0 for success, < 0 for error : number of bytes to complete

Description: Must be called with queue lock held unlike blk_end_request().

Return: 0 - we are done with this request 1 - still buffers pending for this request

Definition at line 2004 of file blk-core.c.

void __blk_put_request ( struct request_queue *  q,
struct request *  req 
)

Definition at line 1060 of file blk-core.c.

void __blk_run_queue ( struct request_queue *  q  ) 

__blk_run_queue - run a single device queue : The queue to run

Description: See . This variant must be called with the queue lock held and interrupts disabled.

Definition at line 424 of file blk-core.c.

static int __end_that_request_first ( struct request *  req,
int  error,
int  nr_bytes 
) [static]

__end_that_request_first - end I/O on a request : the request being processed : 0 for success, < 0 for error : number of bytes to complete

Description: Ends I/O on a number of bytes attached to , and sets it up for the next range of segments (if any) in the cluster.

Return: 0 - we are done with this request, call end_that_request_last() 1 - still buffers pending for this request

Definition at line 1729 of file blk-core.c.

static void __freed_request ( struct request_queue *  q,
int  rw 
) [static]

Definition at line 705 of file blk-core.c.

static void __generic_make_request ( struct bio *  bio  )  [inline, static]

generic_make_request - hand a buffer to its device driver for I/O : The bio describing the location in memory and on the device.

generic_make_request() is used to make I/O requests of block devices. It is passed a &struct bio, which describes the I/O that needs to be done.

generic_make_request() does not return any status. The success/failure status of the request, along with notification of completion, is delivered asynchronously through the bio->bi_end_io function described (one day) else where.

The caller of generic_make_request must make sure that bi_io_vec are set to describe the memory buffer, and that bi_dev and bi_sector are set to describe the device address, and the bi_end_io and optionally bi_private are set to describe how completion notification should be signaled.

generic_make_request and the drivers it calls may use bi_next if this bio happens to be merged with someone else, and may change bi_dev and bi_sector for remaps as it sees fit. So the values of these fields should NOT be depended on after the call to generic_make_request.

Definition at line 1379 of file blk-core.c.

void __generic_unplug_device ( struct request_queue *  q  ) 

Definition at line 268 of file blk-core.c.

static int __make_request ( struct request_queue *  q,
struct bio *  bio 
) [static]

Definition at line 1140 of file blk-core.c.

static void add_request ( struct request_queue *  q,
struct request *  req 
) [inline, static]

Definition at line 1006 of file blk-core.c.

static int bio_check_eod ( struct bio *  bio,
unsigned int  nr_sectors 
) [inline, static]

Definition at line 1329 of file blk-core.c.

static void blk_account_io_completion ( struct request *  req,
unsigned int  bytes 
) [static]

Definition at line 1666 of file blk-core.c.

static void blk_account_io_done ( struct request *  req  )  [static]

Definition at line 1685 of file blk-core.c.

struct request_queue* blk_alloc_queue ( gfp_t  gfp_mask  )  [read]

Definition at line 502 of file blk-core.c.

struct request_queue* blk_alloc_queue_node ( gfp_t  gfp_mask,
int  node_id 
) [read]

Definition at line 508 of file blk-core.c.

static struct request* blk_alloc_request ( struct request_queue *  q,
int  rw,
int  priv,
gfp_t  gfp_mask 
) [static, read]

Definition at line 649 of file blk-core.c.

static void blk_backing_dev_unplug ( struct backing_dev_info *  bdi,
struct page *  page 
) [static]

Definition at line 299 of file blk-core.c.

void blk_cleanup_queue ( struct request_queue *  q  ) 

Definition at line 462 of file blk-core.c.

int __init blk_dev_init ( void   ) 

Definition at line 2159 of file blk-core.c.

void blk_dump_rq_flags ( struct request *  rq,
char *  msg 
)

Definition at line 179 of file blk-core.c.

int blk_end_bidi_request ( struct request *  rq,
int  error,
unsigned int  nr_bytes,
unsigned int  bidi_bytes 
)

blk_end_bidi_request - Helper function for drivers to complete bidi request.

: the bidi request being processed : 0 for success, < 0 for error : number of bytes to complete : number of bytes to complete ->next_rq

Description: Ends I/O on a number of bytes attached to and ->next_rq.

Return: 0 - we are done with this request 1 - still buffers pending for this request

Definition at line 2033 of file blk-core.c.

static int blk_end_io ( struct request *  rq,
int  error,
unsigned int  nr_bytes,
unsigned int  bidi_bytes,
int(drv_callback)(struct request *)   
) [static]

blk_end_io - Generic end_io function to complete a request.

: the request being processed : 0 for success, < 0 for error : number of bytes to complete : number of bytes to complete ->next_rq : function called between completion of bios in the request and completion of the request. If the callback returns non 0, this helper returns without completion of the request.

Description: Ends I/O on a number of bytes attached to and ->next_rq. If has leftover, sets it up for the next range of segments.

Return: 0 - we are done with this request 1 - this request is not freed yet, it still has pending buffers.

Definition at line 1946 of file blk-core.c.

int blk_end_request ( struct request *  rq,
int  error,
unsigned int  nr_bytes 
)

blk_end_request - Helper function for drivers to complete the request.

: the request being processed : 0 for success, < 0 for error : number of bytes to complete

Description: Ends I/O on a number of bytes attached to . If has leftover, sets it up for the next range of segments.

Return: 0 - we are done with this request 1 - still buffers pending for this request

Definition at line 1985 of file blk-core.c.

int blk_end_request_callback ( struct request *  rq,
int  error,
unsigned int  nr_bytes,
int(drv_callback)(struct request *)   
)

blk_end_request_callback - Special helper function for tricky drivers : the request being processed : 0 for success, < 0 for error : number of bytes to complete : function called between completion of bios in the request and completion of the request.

If the callback returns non 0, this helper returns without completion of the request.

Description: Ends I/O on a number of bytes attached to . If has leftover, sets it up for the next range of segments.

This special helper function is used only for existing tricky drivers. (e.g. cdrom_newpc_intr() of ide-cd) This interface will be removed when such drivers are rewritten. Don't use this interface in other places anymore.

Return: 0 - we are done with this request 1 - this request is not freed yet. this request still has pending buffers or the driver doesn't want to finish this request yet.

Definition at line 2095 of file blk-core.c.

static void blk_free_request ( struct request_queue *  q,
struct request *  rq 
) [inline, static]

Definition at line 641 of file blk-core.c.

struct backing_dev_info* blk_get_backing_dev_info ( struct block_device *  bdev  )  [read]

blk_get_backing_dev_info - get the address of a queue's backing_dev_info : device

Locates the passed device's request queue and returns the address of its backing_dev_info

Will return NULL if the request queue cannot be located.

Definition at line 112 of file blk-core.c.

int blk_get_queue ( struct request_queue *  q  ) 

Definition at line 631 of file blk-core.c.

struct request* blk_get_request ( struct request_queue *  q,
int  rw,
gfp_t  gfp_mask 
) [read]

Definition at line 886 of file blk-core.c.

static int blk_init_free_list ( struct request_queue *  q  )  [static]

Definition at line 483 of file blk-core.c.

struct request_queue* blk_init_queue ( request_fn_proc *  rfn,
spinlock_t *  lock 
) [read]

blk_init_queue - prepare a request queue for use with a block device : The function to be called to process requests that have been placed on the queue.

: Request queue spin lock

Description: If a block device wishes to use the standard request handling procedures, which sorts requests and coalesces adjacent requests, then it must call blk_init_queue(). The function will be called when there are requests on the queue that need to be processed. If the device supports plugging, then may not be called immediately when requests are available on the queue, but may be called at some time later instead. Plugged queues are generally unplugged when a buffer belonging to one of the requests on the queue is needed, or due to memory pressure.

is not required, or even expected, to remove all requests off the queue, but only as many as it can handle at a time. If it does leave requests on the queue, it is responsible for arranging that the requests get dealt with eventually.

The queue spin lock must be held while manipulating the requests on the request queue; this lock will be taken also from interrupt context, so irq disabling is needed for it.

Function returns a pointer to the initialized request queue, or NULL if it didn't succeed.

Note: blk_init_queue() must be paired with a blk_cleanup_queue() call when the block device is deactivated (such as at module unload).

Definition at line 573 of file blk-core.c.

struct request_queue* blk_init_queue_node ( request_fn_proc *  rfn,
spinlock_t *  lock,
int  node_id 
) [read]

Definition at line 580 of file blk-core.c.

int blk_insert_cloned_request ( struct request_queue *  q,
struct request *  rq 
)

blk_insert_cloned_request - Helper for stacking drivers to submit a request : the queue to submit the request : the request being queued

Definition at line 1614 of file blk-core.c.

void blk_insert_request ( struct request_queue *  q,
struct request *  rq,
int  at_head,
void *  data 
)

blk_insert_request - insert a special request into a request queue : request queue where request should be inserted : request to be inserted : insert request at head or tail of queue : private data

Description: Many block devices need to execute commands asynchronously, so they don't block the whole kernel from preemption during request execution. This is accomplished normally by inserting aritficial requests tagged as REQ_TYPE_SPECIAL in to the corresponding request queue, and letting them be scheduled for actual execution by the request queue.

We have the option of inserting the head or the tail of the queue. Typically we use the tail for new ioctls and so forth. We use the head of the queue for things like a QUEUE_FULL message from a device, or a host that is unable to accept a particular command.

Definition at line 970 of file blk-core.c.

static void blk_invoke_request_fn ( struct request_queue *  q  )  [static]

Definition at line 336 of file blk-core.c.

int blk_lld_busy ( struct request_queue *  q  ) 

blk_lld_busy - Check if underlying low-level drivers of a device are busy : the queue of the device being checked

Description: Check if underlying low-level drivers of a device are busy. If the drivers want to export their busy state, they must set own exporting function using blk_queue_lld_busy() first.

Basically, this function is used only by request stacking drivers to stop dispatching requests to underlying devices when underlying devices are busy. This behavior helps more I/O merging on the queue of the request stacking driver and prevents I/O throughput regression on burst I/O load.

Return: 0 - Not busy (The request stacking driver should dispatch request) 1 - Busy (The request stacking driver should stop dispatching request)

Definition at line 2144 of file blk-core.c.

static void blk_partition_remap ( struct bio *  bio  )  [inline, static]

Definition at line 1259 of file blk-core.c.

void blk_plug_device ( struct request_queue *  q  ) 

Definition at line 213 of file blk-core.c.

void blk_plug_device_unlocked ( struct request_queue *  q  ) 

blk_plug_device_unlocked - plug a device without queue lock held : The &struct request_queue to plug

Description: Like (), but grabs the queue lock and disables interrupts.

Definition at line 239 of file blk-core.c.

void blk_put_queue ( struct request_queue *  q  ) 

Definition at line 457 of file blk-core.c.

void blk_put_request ( struct request *  req  ) 

Definition at line 1086 of file blk-core.c.

void blk_queue_congestion_threshold ( struct request_queue *  q  ) 

Definition at line 88 of file blk-core.c.

int blk_remove_plug ( struct request_queue *  q  ) 

Definition at line 253 of file blk-core.c.

void blk_requeue_request ( struct request_queue *  q,
struct request *  rq 
)

blk_requeue_request - put a request back on queue : request queue where request should be inserted : request to be inserted

Description: Drivers often keep queueing requests until the hardware cannot accept more, when that condition happens we need to put the request back on the queue. Must be called with queue lock held.

Definition at line 938 of file blk-core.c.

void blk_rq_bio_prep ( struct request_queue *  q,
struct request *  rq,
struct bio *  bio 
)

Definition at line 2103 of file blk-core.c.

unsigned int blk_rq_bytes ( struct request *  rq  ) 

blk_rq_bytes - Returns bytes left to complete in the entire request : the request being processed

Definition at line 1859 of file blk-core.c.

int blk_rq_check_limits ( struct request_queue *  q,
struct request *  rq 
)

blk_rq_check_limits - Helper function to check a request for the queue limit : the queue : the request being checked

Description: may have been made based on weaker limitations of upper-level queues in request stacking drivers, and it may violate the limitation of . Since the block layer and the underlying device driver trust after it is inserted to , it should be checked against before the insertion using this generic function.

This function should also be useful for request stacking drivers in some cases below, so export this fuction. Request stacking drivers like request-based dm may change the queue limits while requests are in the queue (e.g. dm's table swapping). Such request stacking drivers should check those requests agaist the new queue limits again when they dispatch those requests, although such checkings are also done against the old queue limits when submitting requests.

Definition at line 1584 of file blk-core.c.

unsigned int blk_rq_cur_bytes ( struct request *  rq  ) 

blk_rq_cur_bytes - Returns bytes left to complete in the current segment : the request being processed

Definition at line 1872 of file blk-core.c.

void blk_rq_init ( struct request_queue *  q,
struct request *  rq 
)

Definition at line 123 of file blk-core.c.

void blk_run_queue ( struct request_queue *  q  ) 

blk_run_queue - run a single device queue : The queue to run

Description: Invoke request handling on this queue, if it has pending work to do. May be used to restart queueing when a request has completed. Also See .

Definition at line 447 of file blk-core.c.

void blk_start_queue ( struct request_queue *  q  ) 

blk_start_queue - restart a previously stopped queue : The &struct request_queue in question

Description: blk_start_queue() will clear the stop flag on the queue, and call the request_fn for the queue if it was in a stopped state when entered. Also see blk_stop_queue(). Queue lock must be held.

Definition at line 363 of file blk-core.c.

void blk_start_queueing ( struct request_queue *  q  ) 

blk_start_queueing - initiate dispatch of requests to device : request queue to kick into gear

This is basically a helper to remove the need to know whether a queue is plugged or not if someone just wants to initiate dispatch of requests for this queue. Should be used to start queueing on a device outside of ->request_fn() context. Also see .

The queue lock must be held with interrupts disabled.

Definition at line 917 of file blk-core.c.

void blk_stop_queue ( struct request_queue *  q  ) 

blk_stop_queue - stop a queue : The &struct request_queue in question

Description: The Linux block layer assumes that a block driver will consume all entries on the request queue when the request_fn strategy is called. Often this will not happen, because of hardware limitations (queue depth settings). If a device driver gets a 'queue full' response, or if it simply chooses not to queue more I/O at one point, it can call this function to prevent the request_fn from being called until the driver has signalled it's ready to go again. This happens by calling blk_start_queue() to restart queue operations. Queue lock must be held.

Definition at line 386 of file blk-core.c.

void blk_sync_queue ( struct request_queue *  q  ) 

blk_sync_queue - cancel any pending callbacks on a queue : the queue

Description: The block layer may perform asynchronous callback activity on a queue, such as calling the unplug function after a timeout. A block device may call blk_sync_queue to ensure that any such activity is cancelled, thus allowing it to release resources that the callbacks might use. The caller must already have made sure that its ->make_request_fn will not re-add plugging prior to calling this function.

Definition at line 407 of file blk-core.c.

void blk_unplug ( struct request_queue *  q  ) 

Definition at line 324 of file blk-core.c.

void blk_unplug_timeout ( unsigned long  data  ) 

Definition at line 316 of file blk-core.c.

void blk_unplug_work ( struct work_struct *  work  ) 

Definition at line 307 of file blk-core.c.

void blk_update_request ( struct request *  rq,
int  error,
unsigned int  nr_bytes 
)

blk_update_request - Special helper function for request stacking drivers : the request being processed : 0 for success, < 0 for error : number of bytes to complete

Description: Ends I/O on a number of bytes attached to , but doesn't complete the request structure even if doesn't have leftover. If has leftover, sets it up for the next range of segments.

This special helper function is only for request stacking drivers (e.g. request-based dm) so that they can handle partial completion. Actual device drivers should use blk_end_request instead.

Definition at line 2055 of file blk-core.c.

void blkdev_dequeue_request ( struct request *  req  ) 

blkdev_dequeue_request - dequeue request and start timeout timer : request to dequeue

Dequeue and start timeout timer on it. This hands off the request to the driver.

Block internal functions which don't want to start timer should call elv_dequeue_request().

Definition at line 1654 of file blk-core.c.

DEFINE_TRACE ( block_remap   ) 

DEFINE_TRACE ( block_rq_complete   ) 

DEFINE_TRACE ( block_bio_queue   ) 

DEFINE_TRACE ( block_bio_frontmerge   ) 

DEFINE_TRACE ( block_bio_backmerge   ) 

DEFINE_TRACE ( block_rq_requeue   ) 

DEFINE_TRACE ( block_sleeprq   ) 

DEFINE_TRACE ( block_getrq   ) 

DEFINE_TRACE ( block_unplug_timer   ) 

DEFINE_TRACE ( block_unplug_io   ) 

DEFINE_TRACE ( block_plug   ) 

static void drive_stat_acct ( struct request *  rq,
int  new_io 
) [static]

Definition at line 65 of file blk-core.c.

void end_request ( struct request *  req,
int  uptodate 
)

end_request - end I/O on the current segment of the request : the request being processed : error value or 0/1 uptodate flag

Description: Ends I/O on the current segment of a request. If that is the only remaining segment, the request is also completed and freed.

This is a remnant of how older block drivers handled I/O completions. Modern drivers typically end I/O on the full request in one go, unless they have a residual value to account for. For that case this function isn't really useful, unless the residual just happens to be the full current segment. In other words, don't use this function in new code. Use blk_end_request() or __blk_end_request() to end a request.

Definition at line 1900 of file blk-core.c.

static int end_that_request_data ( struct request *  rq,
int  error,
unsigned int  nr_bytes,
unsigned int  bidi_bytes 
) [static]

Definition at line 1911 of file blk-core.c.

static void end_that_request_last ( struct request *  req,
int  error 
) [static]

Definition at line 1828 of file blk-core.c.

EXPORT_SYMBOL ( kblockd_schedule_work   ) 

EXPORT_SYMBOL ( end_request   ) 

EXPORT_SYMBOL ( blkdev_dequeue_request   ) 

EXPORT_SYMBOL ( submit_bio   ) 

EXPORT_SYMBOL ( generic_make_request   ) 

EXPORT_SYMBOL ( blk_put_request   ) 

EXPORT_SYMBOL ( blk_insert_request   ) 

EXPORT_SYMBOL ( blk_requeue_request   ) 

EXPORT_SYMBOL ( blk_start_queueing   ) 

EXPORT_SYMBOL ( blk_get_request   ) 

EXPORT_SYMBOL ( blk_init_queue_node   ) 

EXPORT_SYMBOL ( blk_init_queue   ) 

EXPORT_SYMBOL ( blk_alloc_queue_node   ) 

EXPORT_SYMBOL ( blk_alloc_queue   ) 

EXPORT_SYMBOL ( blk_cleanup_queue   ) 

EXPORT_SYMBOL ( blk_run_queue   ) 

EXPORT_SYMBOL ( __blk_run_queue   ) 

EXPORT_SYMBOL ( blk_sync_queue   ) 

EXPORT_SYMBOL ( blk_stop_queue   ) 

EXPORT_SYMBOL ( blk_start_queue   ) 

EXPORT_SYMBOL ( blk_unplug   ) 

EXPORT_SYMBOL ( generic_unplug_device   ) 

EXPORT_SYMBOL ( blk_remove_plug   ) 

EXPORT_SYMBOL ( blk_plug_device_unlocked   ) 

EXPORT_SYMBOL ( blk_plug_device   ) 

EXPORT_SYMBOL ( blk_dump_rq_flags   ) 

EXPORT_SYMBOL ( blk_rq_init   ) 

EXPORT_SYMBOL ( blk_get_backing_dev_info   ) 

EXPORT_SYMBOL_GPL ( blk_lld_busy   ) 

EXPORT_SYMBOL_GPL ( blk_end_request_callback   ) 

EXPORT_SYMBOL_GPL ( blk_update_request   ) 

EXPORT_SYMBOL_GPL ( blk_end_bidi_request   ) 

EXPORT_SYMBOL_GPL ( __blk_end_request   ) 

EXPORT_SYMBOL_GPL ( blk_end_request   ) 

EXPORT_SYMBOL_GPL ( blk_rq_cur_bytes   ) 

EXPORT_SYMBOL_GPL ( blk_rq_bytes   ) 

EXPORT_SYMBOL_GPL ( blk_insert_cloned_request   ) 

EXPORT_SYMBOL_GPL ( blk_rq_check_limits   ) 

EXPORT_SYMBOL_GPL ( __blk_put_request   ) 

EXPORT_SYMBOL_GPL ( part_round_stats   ) 

EXPORT_TRACEPOINT_SYMBOL_GPL ( block_remap   ) 

static void freed_request ( struct request_queue *  q,
int  rw,
int  priv 
) [static]

Definition at line 724 of file blk-core.c.

void generic_make_request ( struct bio *  bio  ) 

Definition at line 1480 of file blk-core.c.

void generic_unplug_device ( struct request_queue *  q  ) 

generic_unplug_device - fire a request queue : The &struct request_queue in question

Description: Linux uses plugging to build bigger requests queues before letting the device have at them. If a queue is plugged, the I/O scheduler is still adding and merging requests on the queue. Once the queue gets unplugged, the request_fn defined for the queue is invoked and transfers started.

Definition at line 289 of file blk-core.c.

static struct request* get_request ( struct request_queue *  q,
int  rw_flags,
struct bio *  bio,
gfp_t  gfp_mask 
) [static, read]

Definition at line 744 of file blk-core.c.

static struct request* get_request_wait ( struct request_queue *  q,
int  rw_flags,
struct bio *  bio 
) [static, read]

Definition at line 847 of file blk-core.c.

static void handle_bad_sector ( struct bio *  bio  )  [static]

Definition at line 1275 of file blk-core.c.

void init_request_from_bio ( struct request *  req,
struct bio *  bio 
)

Definition at line 1097 of file blk-core.c.

static int ioc_batching ( struct request_queue *  q,
struct io_context *  ioc 
) [inline, static]

Definition at line 675 of file blk-core.c.

static void ioc_set_batching ( struct request_queue *  q,
struct io_context *  ioc 
) [static]

Definition at line 696 of file blk-core.c.

int kblockd_schedule_work ( struct request_queue *  q,
struct work_struct *  work 
)

Definition at line 2153 of file blk-core.c.

void part_round_stats ( int  cpu,
struct hd_struct *  part 
)

part_round_stats() - Round off the performance stats on a struct disk_stats.

: cpu number for stats access : target partition

The average IO queue length and utilisation statistics are maintained by observing the current state of the queue length and the amount of time it has been in this state for.

Normally, that accounting is done on IO completion, but that can result in more than a second's worth of IO being accounted for within any one second, leading to >100% utilisation. To deal with that, we call this function to do a round-off before returning the results when reading /proc/diskstats. This accounts immediately for all queue usage up to the current jiffies and restarts the counters again.

Definition at line 1047 of file blk-core.c.

static void part_round_stats_single ( int  cpu,
struct hd_struct *  part,
unsigned long  now 
) [static]

Definition at line 1017 of file blk-core.c.

static void req_bio_endio ( struct request *  rq,
struct bio *  bio,
unsigned int  nbytes,
int  error 
) [static]

Definition at line 140 of file blk-core.c.

static int should_fail_request ( struct bio *  bio  )  [inline, static]

Definition at line 1319 of file blk-core.c.

void submit_bio ( int  rw,
struct bio *  bio 
)

submit_bio - submit a bio to the block device layer for I/O : whether to READ or WRITE, or maybe to READA (read ahead) : The &struct bio which describes the I/O

submit_bio() is very similar in purpose to generic_make_request(), and uses that function to do most of the work. Both are fairly rough interfaces; must be presetup and ready for I/O.

Definition at line 1531 of file blk-core.c.


Variable Documentation

Definition at line 58 of file blk-core.c.

Definition at line 63 of file blk-core.c.

struct kmem_cache* request_cachep [static]

Definition at line 53 of file blk-core.c.


Generated on Wed Apr 11 06:39:15 2012 for DDE - The L4 Device Driver Environment by  doxygen 1.5.6