… | |
… | |
196 | |
196 | |
197 | /*****************************************************************************/ |
197 | /*****************************************************************************/ |
198 | |
198 | |
199 | #define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1) |
199 | #define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1) |
200 | |
200 | |
201 | /* calculcate time difference in ~1/EIO_TICKS of a second */ |
201 | /* calculate time difference in ~1/EIO_TICKS of a second */ |
202 | static int tvdiff (struct timeval *tv1, struct timeval *tv2) |
202 | static int tvdiff (struct timeval *tv1, struct timeval *tv2) |
203 | { |
203 | { |
204 | return (tv2->tv_sec - tv1->tv_sec ) * EIO_TICKS |
204 | return (tv2->tv_sec - tv1->tv_sec ) * EIO_TICKS |
205 | + ((tv2->tv_usec - tv1->tv_usec) >> 10); |
205 | + ((tv2->tv_usec - tv1->tv_usec) >> 10); |
206 | } |
206 | } |
… | |
… | |
598 | } |
598 | } |
599 | |
599 | |
600 | static void etp_set_max_poll_time (double nseconds) |
600 | static void etp_set_max_poll_time (double nseconds) |
601 | { |
601 | { |
602 | if (WORDACCESS_UNSAFE) X_LOCK (reslock); |
602 | if (WORDACCESS_UNSAFE) X_LOCK (reslock); |
603 | max_poll_time = nseconds; |
603 | max_poll_time = nseconds * EIO_TICKS; |
604 | if (WORDACCESS_UNSAFE) X_UNLOCK (reslock); |
604 | if (WORDACCESS_UNSAFE) X_UNLOCK (reslock); |
605 | } |
605 | } |
606 | |
606 | |
607 | static void etp_set_max_poll_reqs (unsigned int maxreqs) |
607 | static void etp_set_max_poll_reqs (unsigned int maxreqs) |
608 | { |
608 | { |
… | |
… | |
867 | if (!res || errno != ENOSYS) |
867 | if (!res || errno != ENOSYS) |
868 | return res; |
868 | return res; |
869 | #endif |
869 | #endif |
870 | |
870 | |
871 | /* even though we could play tricks with the flags, it's better to always |
871 | /* even though we could play tricks with the flags, it's better to always |
872 | * call fdatasync, as thta matches the expectation of it's users best */ |
872 | * call fdatasync, as that matches the expectation of its users best */ |
873 | return fdatasync (fd); |
873 | return fdatasync (fd); |
874 | } |
874 | } |
875 | |
875 | |
876 | #if !HAVE_READAHEAD |
876 | #if !HAVE_READAHEAD |
877 | # undef readahead |
877 | # undef readahead |