| 35 | #endif |
| 36 | |
| 37 | int PollDriver::init(EventCenter *c, int nevent) { |
| 38 | // pfds array will auto scale up to hard_max_pfds, which should be |
| 39 | // greater than total daemons/op_threads (todo: cfg option?) |
| 40 | hard_max_pfds = 8192; |
| 41 | // 128 seems a good starting point, cover clusters up to ~350 OSDs |
| 42 | // with default ms_async_op_threads |
| 43 | max_pfds = 128; |
| 44 | |
| 45 | pfds = (POLLFD*)calloc(max_pfds, sizeof(POLLFD)); |
| 46 | if (!pfds) { |
| 47 | lderr(cct) << __func__ << " unable to allocate memory " << dendl; |
| 48 | return -ENOMEM; |
| 49 | } |
| 50 | |
| 51 | //initialise pfds |
| 52 | for(int i = 0; i < max_pfds; i++){ |
| 53 | pfds[i].fd = -1; |
| 54 | pfds[i].events = 0; |
| 55 | pfds[i].revents = 0; |
| 56 | } |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | // Helper func to register/unregister interest in a FD's events by |
| 61 | // manipulating it's entry in pfds array |
no outgoing calls
no test coverage detected