Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
sched.h File Reference
#include <linux/timer.h>
#include <linux/ktime.h>
#include <linux/sunrpc/types.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/sunrpc/xdr.h>

Go to the source code of this file.

Data Structures

struct  rpc_message
 
struct  rpc_wait
 
struct  rpc_task
 
struct  rpc_call_ops
 
struct  rpc_task_setup
 
struct  rpc_timer
 
struct  rpc_wait_queue
 

Macros

#define tk_xprt   tk_client->cl_xprt
 
#define task_for_each(task, pos, head)
 
#define task_for_first(task, head)
 
#define RPC_TASK_ASYNC   0x0001 /* is an async task */
 
#define RPC_TASK_SWAPPER   0x0002 /* is swapping in/out */
 
#define RPC_CALL_MAJORSEEN   0x0020 /* major timeout seen */
 
#define RPC_TASK_ROOTCREDS   0x0040 /* force root creds */
 
#define RPC_TASK_DYNAMIC   0x0080 /* task was kmalloc'ed */
 
#define RPC_TASK_KILLED   0x0100 /* task was killed */
 
#define RPC_TASK_SOFT   0x0200 /* Use soft timeouts */
 
#define RPC_TASK_SOFTCONN   0x0400 /* Fail if can't connect */
 
#define RPC_TASK_SENT   0x0800 /* message was sent */
 
#define RPC_TASK_TIMEOUT   0x1000 /* fail with ETIMEDOUT on timeout */
 
#define RPC_IS_ASYNC(t)   ((t)->tk_flags & RPC_TASK_ASYNC)
 
#define RPC_IS_SWAPPER(t)   ((t)->tk_flags & RPC_TASK_SWAPPER)
 
#define RPC_DO_ROOTOVERRIDE(t)   ((t)->tk_flags & RPC_TASK_ROOTCREDS)
 
#define RPC_ASSASSINATED(t)   ((t)->tk_flags & RPC_TASK_KILLED)
 
#define RPC_IS_SOFT(t)   ((t)->tk_flags & (RPC_TASK_SOFT|RPC_TASK_TIMEOUT))
 
#define RPC_IS_SOFTCONN(t)   ((t)->tk_flags & RPC_TASK_SOFTCONN)
 
#define RPC_WAS_SENT(t)   ((t)->tk_flags & RPC_TASK_SENT)
 
#define RPC_TASK_RUNNING   0
 
#define RPC_TASK_QUEUED   1
 
#define RPC_TASK_ACTIVE   2
 
#define RPC_IS_RUNNING(t)   test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
 
#define rpc_set_running(t)   set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
 
#define rpc_test_and_set_running(t)   test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
 
#define rpc_clear_running(t)
 
#define RPC_IS_QUEUED(t)   test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
 
#define rpc_set_queued(t)   set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
 
#define rpc_clear_queued(t)
 
#define RPC_IS_ACTIVATED(t)   test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)
 
#define RPC_PRIORITY_LOW   (-1)
 
#define RPC_PRIORITY_NORMAL   (0)
 
#define RPC_PRIORITY_HIGH   (1)
 
#define RPC_PRIORITY_PRIVILEGED   (2)
 
#define RPC_NR_PRIORITY   (1 + RPC_PRIORITY_PRIVILEGED - RPC_PRIORITY_LOW)
 
#define RPC_BATCH_COUNT   16
 
#define RPC_IS_PRIORITY(q)   ((q)->maxpriority > 0)
 

Typedefs

typedef void(* rpc_action )(struct rpc_task *)
 

Functions

struct rpc_taskrpc_new_task (const struct rpc_task_setup *)
 
struct rpc_taskrpc_run_task (const struct rpc_task_setup *)
 
struct rpc_taskrpc_run_bc_task (struct rpc_rqst *req, const struct rpc_call_ops *ops)
 
void rpc_put_task (struct rpc_task *)
 
void rpc_put_task_async (struct rpc_task *)
 
void rpc_exit_task (struct rpc_task *)
 
void rpc_exit (struct rpc_task *, int)
 
void rpc_release_calldata (const struct rpc_call_ops *, void *)
 
void rpc_killall_tasks (struct rpc_clnt *)
 
void rpc_execute (struct rpc_task *)
 
void rpc_init_priority_wait_queue (struct rpc_wait_queue *, const char *)
 
void rpc_init_wait_queue (struct rpc_wait_queue *, const char *)
 
void rpc_destroy_wait_queue (struct rpc_wait_queue *)
 
void rpc_sleep_on (struct rpc_wait_queue *, struct rpc_task *, rpc_action action)
 
void rpc_sleep_on_priority (struct rpc_wait_queue *, struct rpc_task *, rpc_action action, int priority)
 
void rpc_wake_up_queued_task (struct rpc_wait_queue *, struct rpc_task *)
 
void rpc_wake_up (struct rpc_wait_queue *)
 
struct rpc_taskrpc_wake_up_next (struct rpc_wait_queue *)
 
struct rpc_taskrpc_wake_up_first (struct rpc_wait_queue *, bool(*)(struct rpc_task *, void *), void *)
 
void rpc_wake_up_status (struct rpc_wait_queue *, int)
 
int rpc_queue_empty (struct rpc_wait_queue *)
 
void rpc_delay (struct rpc_task *, unsigned long)
 
voidrpc_malloc (struct rpc_task *, size_t)
 
void rpc_free (void *)
 
int rpciod_up (void)
 
void rpciod_down (void)
 
int __rpc_wait_for_completion_task (struct rpc_task *task, int(*)(void *))
 
int rpc_init_mempool (void)
 
void rpc_destroy_mempool (void)
 
void rpc_prepare_task (struct rpc_task *task)
 

Variables

struct workqueue_structrpciod_workqueue
 

Macro Definition Documentation

#define RPC_ASSASSINATED (   t)    ((t)->tk_flags & RPC_TASK_KILLED)

Definition at line 138 of file sched.h.

#define RPC_BATCH_COUNT   16

Definition at line 209 of file sched.h.

#define RPC_CALL_MAJORSEEN   0x0020 /* major timeout seen */

Definition at line 126 of file sched.h.

#define rpc_clear_queued (   t)
Value:
do { \
smp_mb__before_clear_bit(); \
clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \
smp_mb__after_clear_bit(); \
} while (0)

Definition at line 160 of file sched.h.

#define rpc_clear_running (   t)
Value:
do { \
smp_mb__before_clear_bit(); \
clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \
smp_mb__after_clear_bit(); \
} while (0)

Definition at line 151 of file sched.h.

#define RPC_DO_ROOTOVERRIDE (   t)    ((t)->tk_flags & RPC_TASK_ROOTCREDS)

Definition at line 137 of file sched.h.

#define RPC_IS_ACTIVATED (   t)    test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)

Definition at line 167 of file sched.h.

#define RPC_IS_ASYNC (   t)    ((t)->tk_flags & RPC_TASK_ASYNC)

Definition at line 135 of file sched.h.

#define RPC_IS_PRIORITY (   q)    ((q)->maxpriority > 0)

Definition at line 210 of file sched.h.

#define RPC_IS_QUEUED (   t)    test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)

Definition at line 158 of file sched.h.

#define RPC_IS_RUNNING (   t)    test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)

Definition at line 147 of file sched.h.

#define RPC_IS_SOFT (   t)    ((t)->tk_flags & (RPC_TASK_SOFT|RPC_TASK_TIMEOUT))

Definition at line 139 of file sched.h.

#define RPC_IS_SOFTCONN (   t)    ((t)->tk_flags & RPC_TASK_SOFTCONN)

Definition at line 140 of file sched.h.

#define RPC_IS_SWAPPER (   t)    ((t)->tk_flags & RPC_TASK_SWAPPER)

Definition at line 136 of file sched.h.

#define RPC_NR_PRIORITY   (1 + RPC_PRIORITY_PRIVILEGED - RPC_PRIORITY_LOW)

Definition at line 178 of file sched.h.

#define RPC_PRIORITY_HIGH   (1)

Definition at line 176 of file sched.h.

#define RPC_PRIORITY_LOW   (-1)

Definition at line 174 of file sched.h.

#define RPC_PRIORITY_NORMAL   (0)

Definition at line 175 of file sched.h.

#define RPC_PRIORITY_PRIVILEGED   (2)

Definition at line 177 of file sched.h.

#define rpc_set_queued (   t)    set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)

Definition at line 159 of file sched.h.

#define rpc_set_running (   t)    set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)

Definition at line 148 of file sched.h.

#define RPC_TASK_ACTIVE   2

Definition at line 145 of file sched.h.

#define RPC_TASK_ASYNC   0x0001 /* is an async task */

Definition at line 124 of file sched.h.

#define RPC_TASK_DYNAMIC   0x0080 /* task was kmalloc'ed */

Definition at line 128 of file sched.h.

#define RPC_TASK_KILLED   0x0100 /* task was killed */

Definition at line 129 of file sched.h.

#define RPC_TASK_QUEUED   1

Definition at line 144 of file sched.h.

#define RPC_TASK_ROOTCREDS   0x0040 /* force root creds */

Definition at line 127 of file sched.h.

#define RPC_TASK_RUNNING   0

Definition at line 143 of file sched.h.

#define RPC_TASK_SENT   0x0800 /* message was sent */

Definition at line 132 of file sched.h.

#define RPC_TASK_SOFT   0x0200 /* Use soft timeouts */

Definition at line 130 of file sched.h.

#define RPC_TASK_SOFTCONN   0x0400 /* Fail if can't connect */

Definition at line 131 of file sched.h.

#define RPC_TASK_SWAPPER   0x0002 /* is swapping in/out */

Definition at line 125 of file sched.h.

#define RPC_TASK_TIMEOUT   0x1000 /* fail with ETIMEDOUT on timeout */

Definition at line 133 of file sched.h.

#define rpc_test_and_set_running (   t)    test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)

Definition at line 149 of file sched.h.

#define RPC_WAS_SENT (   t)    ((t)->tk_flags & RPC_TASK_SENT)

Definition at line 141 of file sched.h.

#define task_for_each (   task,
  pos,
  head 
)
Value:
if ((task=list_entry(pos, struct rpc_task, u.tk_wait.list)),1)

Definition at line 93 of file sched.h.

#define task_for_first (   task,
  head 
)
Value:
if (!list_empty(head) && \
((task=list_entry((head)->next, struct rpc_task, u.tk_wait.list)),1))

Definition at line 97 of file sched.h.

#define tk_xprt   tk_client->cl_xprt

Definition at line 90 of file sched.h.

Typedef Documentation

typedef void(* rpc_action)(struct rpc_task *)

Definition at line 101 of file sched.h.

Function Documentation

int __rpc_wait_for_completion_task ( struct rpc_task task,
int(*)(void *)   
)

Definition at line 291 of file sched.c.

void rpc_delay ( struct rpc_task ,
unsigned  long 
)

Definition at line 620 of file sched.c.

void rpc_destroy_mempool ( void  )

Definition at line 1044 of file sched.c.

void rpc_destroy_wait_queue ( struct rpc_wait_queue )

Definition at line 226 of file sched.c.

void rpc_execute ( struct rpc_task )

Definition at line 784 of file sched.c.

void rpc_exit ( struct rpc_task ,
int   
)

Definition at line 673 of file sched.c.

void rpc_exit_task ( struct rpc_task )

Definition at line 659 of file sched.c.

void rpc_free ( void buffer)

rpc_free - free buffer allocated via rpc_malloc : buffer to free

Definition at line 844 of file sched.c.

int rpc_init_mempool ( void  )

Definition at line 1059 of file sched.c.

void rpc_init_priority_wait_queue ( struct rpc_wait_queue ,
const char  
)

Definition at line 214 of file sched.c.

void rpc_init_wait_queue ( struct rpc_wait_queue ,
const char  
)

Definition at line 220 of file sched.c.

void rpc_killall_tasks ( struct rpc_clnt )

Definition at line 577 of file clnt.c.

void* rpc_malloc ( struct rpc_task task,
size_t  size 
)

rpc_malloc - allocate an RPC buffer : RPC task that will use this buffer : requested byte size

To prevent rpciod from hanging, this allocator never sleeps, returning NULL if the request cannot be serviced immediately. The caller can arrange to sleep in a way that is safe for rpciod.

Most requests are 'small' (under 2KiB) and can be serviced from a mempool, ensuring that NFS reads and writes can always proceed, and that there is good locality of reference for these buffers.

In order to avoid memory starvation triggering more writebacks of NFS requests, we avoid using GFP_KERNEL.

Definition at line 815 of file sched.c.

struct rpc_task* rpc_new_task ( const struct rpc_task_setup )
read

Definition at line 901 of file sched.c.

void rpc_prepare_task ( struct rpc_task task)

Definition at line 630 of file sched.c.

void rpc_put_task ( struct rpc_task )

Definition at line 968 of file sched.c.

void rpc_put_task_async ( struct rpc_task )

Definition at line 974 of file sched.c.

int rpc_queue_empty ( struct rpc_wait_queue )

Definition at line 410 of file sched.c.

void rpc_release_calldata ( const struct rpc_call_ops ,
void  
)

Definition at line 682 of file sched.c.

struct rpc_task* rpc_run_bc_task ( struct rpc_rqst *  req,
const struct rpc_call_ops ops 
)
read
struct rpc_task* rpc_run_task ( const struct rpc_task_setup task_setup_data)
read

rpc_run_task - Allocate a new RPC task, then run rpc_execute against it : pointer to task initialisation data

Definition at line 797 of file clnt.c.

void rpc_sleep_on ( struct rpc_wait_queue ,
struct rpc_task ,
rpc_action  action 
)

Definition at line 342 of file sched.c.

void rpc_sleep_on_priority ( struct rpc_wait_queue ,
struct rpc_task ,
rpc_action  action,
int  priority 
)

Definition at line 357 of file sched.c.

void rpc_wake_up ( struct rpc_wait_queue queue)

rpc_wake_up - wake up all rpc_tasks : rpc_wait_queue on which the tasks are sleeping

Grabs queue->lock

Definition at line 536 of file sched.c.

struct rpc_task* rpc_wake_up_first ( struct rpc_wait_queue ,
bool(*)(struct rpc_task *, void *)  ,
void  
)
read

Definition at line 495 of file sched.c.

struct rpc_task* rpc_wake_up_next ( struct rpc_wait_queue )
read

Definition at line 524 of file sched.c.

void rpc_wake_up_queued_task ( struct rpc_wait_queue ,
struct rpc_task  
)

Definition at line 424 of file sched.c.

void rpc_wake_up_status ( struct rpc_wait_queue queue,
int  status 
)

rpc_wake_up_status - wake up all rpc_tasks and set their status value. : rpc_wait_queue on which the tasks are sleeping : status value to set

Grabs queue->lock

Definition at line 565 of file sched.c.

void rpciod_down ( void  )

Definition at line 1009 of file sched.c.

int rpciod_up ( void  )

Definition at line 1004 of file sched.c.

Variable Documentation

struct workqueue_struct* rpciod_workqueue

Definition at line 57 of file sched.c.