Re: __make_request question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Narasimhamurthy Giridhar wrote:

> Hi all
> In __make_request(), there is a statement :
> 
> el_ret = elevator->elevator_merge_fn(....);


a function pointer!

Quick look through LXR!! (I don't know what it is :-)


blkdev.h
--------

12   struct elevator_s;
13   typedef struct elevator_s elevator_t;


elevator.h
----------

8 typedef int (elevator_merge_fn) (request_queue_t *, struct request **, 

9                   struct list_head *, struct buffer_head *, int, int);



15 struct elevator_s
16 {
17    int read_latency;
18    int write_latency;
19
20    elevator_merge_fn *elevator_merge_fn;
21    elevator_merge_cleanup_fn *elevator_merge_cleanup_fn;
22    elevator_merge_req_fn *elevator_merge_req_fn;
23
24    unsigned int queue_ID;
25 };


  84 #define ELEVATOR_NOOP \
  85 ((elevator_t) {                                                    \
  86     0,                              /* read_latency */ \
  87     0,                              /* write_latency */ \
  88                                                         \
  89     elevator_noop_merge,            /* elevator_merge_fn */ \
  90     elevator_noop_merge_cleanup,    /* elevator_merge_cleanup_fn */\
  91     elevator_noop_merge_req,        /* elevator_merge_req_fn */ \
  92 })
  93
  94 #define ELEVATOR_LINUS \
  95 ((elevator_t) {                                                    \
  96     8192,                           /* read passovers */ \
  97     16384,                          /* write passovers */ \
  98                                                           \
  99     elevator_linus_merge,           /* elevator_merge_fn */ \
100     elevator_linus_merge_cleanup,   /* elevator_merge_cleanup_fn */\
101     elevator_linus_merge_req,       /* elevator_merge_req_fn */ \
102 })
103



elevator_noop_merge
-------------------
Defined as a function in:

     * drivers/block/elevator.c, line 144

elevator_linus_merge
--------------------
Defined as a function in:

     * drivers/block/elevator.c, line 78



BTW
What is an elevator?

Regards,
Sourav



> 
> Where is the definition of this elevator_merge_fn ?
> How does it work ?
> Thanx
> Narasimhamurthy Giri, Clemson University Computer Science Dept.
> -------------------------------------------------------------------------------
> Judge not lest ye be judged yourself.
> -------------------------------------------------------------------------------
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> IRC Channel:   irc.openprojects.net / #kernelnewbies
> Web Page:      http://www.kernelnewbies.org/
> 
> 



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux