Klaus Post
0680af7414
Set O_NONBLOCK for reads and writes on unix ( #20133 )
...
Tracing syscalls, opening and reading an `xl.meta` looks like this:
```
openat(AT_FDCWD, "/mnt/drive1/ss8-old/testbucket/ObjSize4MiBThreads72/(554O51H/peTb(0iztdbTKw59.csv/xl.meta", O_RDONLY|O_NOATIME|O_CLOEXEC) = 34 <0.000>
fcntl(34, F_GETFL) = 0x48000 (flags O_RDONLY|O_LARGEFILE|O_NOATIME) <0.000>
fcntl(34, F_SETFL, O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_NOATIME) = 0 <0.000>
epoll_ctl(4, EPOLL_CTL_ADD, 34, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data={u32=3172471557, u64=8145488475984499461}}) = -1 EPERM (Operation not permitted) <0.000>
fcntl(34, F_GETFL) = 0x48800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_NOATIME) <0.000>
fcntl(34, F_SETFL, O_RDONLY|O_LARGEFILE|O_NOATIME) = 0 <0.000>
fstat(34, {st_mode=S_IFREG|0644, st_size=354, ...}) = 0 <0.000>
read(34, "XL2 \1\0\3\0\306\0\0\1P\2\2\1\304$\225\304\20\0\0\0\0\0\0\0\0\0\0\0"..., 354) = 354 <0.000>
close(34) = 0 <0.000>
```
Everything until `fstat` is the `os.Open` call.
Looking at the code: https://github.com/golang/go/blob/master/src/os/file_unix.go#L212-L243
It seems for every file it "tries" to see if it is pollable. This causes `syscall.SetNonblock(fd, true)` to be called. This is the first `F_SETFL`.
It then calls `f.pfd.Init("file", true)`. This will attempt to set it as pollable using `epoll_ctl`. This will always fail for files. It therefore calls `syscall.SetNonblock(fd, false)` resulting in the second `F_SETFL`.
If we set the `O_NONBLOCK` call on the initial open, we should avoid the 4 `fcntl` syscalls per file.
I don't see any way to avoid the `epoll_ctl` call, since kind is either `kindOpenFile` or `kindNonBlock`, so "pollable" will always be true. However avoiding 4 of 6 syscalls still seems worth it.
This should not have any effect, since files will end up with "nonblock" anyway.
2024-07-23 09:36:24 -07:00
..
2024-06-05 00:51:13 -07:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2024-07-03 00:17:20 -07:00
2024-02-21 22:26:06 -08:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2024-07-11 18:04:53 -07:00
2024-06-27 17:22:30 -07:00
2024-05-24 16:05:23 -07:00
2024-06-28 02:06:25 -07:00
2024-06-28 02:06:25 -07:00
2024-07-14 11:12:07 -07:00
2024-07-16 07:03:03 -07:00
2024-05-09 11:04:41 -07:00
2024-07-02 01:17:52 -07:00
2024-05-24 16:05:23 -07:00
2024-05-14 00:26:50 -07:00
2023-09-25 08:13:08 -07:00
2024-06-13 15:26:38 -07:00
2024-05-27 21:44:00 -07:00
2023-06-07 11:25:26 -07:00
2024-06-26 01:32:06 -07:00
2024-06-19 01:59:21 -07:00
2024-03-04 10:05:56 -08:00
2024-06-13 15:26:38 -07:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2023-05-05 19:53:12 -07:00
2024-05-24 16:05:23 -07:00
2024-06-25 10:32:56 -07:00
2024-07-02 13:41:29 -07:00
2023-12-02 02:51:33 -08:00
2024-07-23 00:05:53 -07:00
2024-07-23 00:05:53 -07:00
2024-07-23 00:05:53 -07:00
2023-08-29 11:27:23 -07:00
2024-05-06 13:27:52 -07:00
2024-07-23 00:05:53 -07:00
2023-12-02 02:51:33 -08:00
2023-12-02 02:51:33 -08:00
2024-01-08 15:22:28 -08:00
2024-06-10 20:13:30 -07:00
2023-08-29 11:27:23 -07:00
2024-07-23 00:05:53 -07:00
2024-07-23 00:05:53 -07:00
2024-07-23 00:05:53 -07:00
2023-08-29 11:27:23 -07:00
2023-12-02 02:51:33 -08:00
2024-07-11 16:13:15 -07:00
2023-12-02 02:51:33 -08:00
2022-12-23 07:46:00 -08:00
2024-01-30 12:43:25 -08:00
2024-05-14 17:11:04 -07:00
2024-01-30 18:11:45 -08:00
2024-01-30 12:43:25 -08:00
2023-08-23 03:07:06 -07:00
2024-01-24 13:36:44 -08:00
2024-06-21 07:49:49 -07:00
2024-06-26 00:44:34 -07:00
2024-05-24 16:05:23 -07:00
2022-10-24 17:44:15 -07:00
2024-06-10 08:50:49 -07:00
2024-06-21 15:22:24 -07:00
2022-05-31 02:57:57 -07:00
2023-12-01 07:56:24 -08:00
2024-06-10 08:50:49 -07:00
2024-05-24 16:05:23 -07:00
2024-06-10 08:31:51 -07:00
2024-06-10 20:13:30 -07:00
2023-05-24 22:52:39 -07:00
2024-06-21 15:22:24 -07:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2024-06-10 08:50:49 -07:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2024-05-08 17:51:34 -07:00
2023-09-16 02:28:06 -07:00
2024-05-24 16:05:23 -07:00
2024-02-05 22:00:45 -08:00
2024-03-21 10:21:35 -07:00
2024-02-05 22:00:45 -08:00
2024-02-21 22:26:06 -08:00
2022-08-22 16:53:06 -07:00
2024-03-21 10:21:35 -07:00
2023-08-08 13:27:40 -07:00
2024-06-10 08:31:51 -07:00
2024-07-12 07:57:31 -07:00
2023-08-30 01:00:59 -07:00
2024-02-05 22:00:45 -08:00
2024-02-05 22:00:45 -08:00
2024-06-21 15:22:24 -07:00
2024-05-24 16:05:23 -07:00
2022-10-24 17:44:15 -07:00
2024-05-01 10:57:52 -07:00
2024-05-17 09:53:34 -07:00
2022-09-19 11:05:16 -07:00
2024-07-22 00:04:48 -07:00
2023-09-18 10:00:54 -07:00
2024-05-16 16:13:47 -07:00
2024-07-10 13:16:44 -07:00
2023-06-19 17:53:08 -07:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2023-08-23 03:07:06 -07:00
2024-05-24 16:05:23 -07:00
2023-07-08 07:31:42 -07:00
2024-03-17 23:42:40 -07:00
2024-05-03 04:18:58 -07:00
2023-09-24 22:15:31 -07:00
2024-07-04 07:25:45 -07:00
2024-06-18 09:11:04 -07:00
2024-01-12 23:51:08 -08:00
2024-06-18 09:11:04 -07:00
2024-01-12 23:51:08 -08:00
2024-06-18 09:11:04 -07:00
2024-03-10 01:15:15 -08:00
2024-05-08 17:51:34 -07:00
2022-08-10 12:46:45 -07:00
2024-07-02 08:13:05 -07:00
2024-05-24 16:05:23 -07:00
2022-10-14 03:08:40 -07:00
2022-08-19 16:21:05 -07:00
2022-09-23 21:17:08 -07:00
2024-06-27 19:44:56 -07:00
2024-01-12 23:53:03 -08:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2024-06-21 15:22:24 -07:00
2022-07-25 12:37:26 -07:00
2024-01-30 18:11:45 -08:00
2024-05-24 16:05:23 -07:00
2024-01-30 12:43:25 -08:00
2024-05-21 07:36:21 -07:00
2024-01-30 12:43:25 -08:00
2024-05-14 17:11:04 -07:00
2022-08-04 16:10:08 -07:00
2024-01-30 12:43:25 -08:00
2024-06-10 08:51:27 -07:00
2024-07-23 03:53:03 -07:00
2024-06-10 08:51:27 -07:00
2024-07-10 09:55:36 -07:00
2024-05-17 13:57:37 -07:00
2024-01-17 23:03:17 -08:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2024-06-12 23:56:12 -07:00
2024-01-30 12:43:25 -08:00
2024-07-23 03:53:03 -07:00
2022-07-04 14:02:54 -07:00
2024-07-01 07:38:46 -07:00
2024-07-01 07:38:46 -07:00
2022-10-25 12:36:57 -07:00
2024-03-21 10:21:35 -07:00
2024-06-27 17:22:30 -07:00
2024-07-18 13:37:34 -07:00
2024-02-11 23:21:56 -08:00
2024-07-12 13:51:54 -07:00
2024-01-30 18:11:45 -08:00
2024-07-02 13:41:29 -07:00
2024-04-04 05:04:40 -07:00
2024-06-21 15:22:24 -07:00
2024-04-15 01:25:46 -07:00
2024-05-24 16:05:23 -07:00
2024-06-03 08:45:54 -07:00
2024-03-08 19:07:08 -08:00
2024-03-28 10:44:56 -07:00
2024-06-05 18:01:15 -07:00
2024-07-10 09:55:36 -07:00
2024-07-22 00:04:48 -07:00
2024-07-08 14:44:00 -07:00
2024-07-12 07:57:31 -07:00
2024-02-21 22:26:06 -08:00
2024-06-10 08:31:51 -07:00
2022-05-27 06:00:19 -07:00
2022-11-28 10:20:55 -08:00
2024-06-26 00:44:34 -07:00
2023-01-23 16:42:47 +05:30
2024-05-14 23:25:13 -07:00
2024-06-03 08:45:54 -07:00
2024-05-05 09:56:21 -07:00
2024-05-09 01:44:07 -07:00
2024-06-13 15:26:38 -07:00
2024-07-14 11:12:07 -07:00
2024-07-11 18:04:53 -07:00
2024-07-14 11:12:07 -07:00
2024-03-04 18:50:24 -08:00
2024-04-05 08:17:08 -07:00
2024-04-05 08:17:08 -07:00
2024-07-22 00:04:48 -07:00
2024-07-22 00:04:48 -07:00
2024-07-16 07:03:03 -07:00
2024-07-16 07:03:03 -07:00
2024-05-07 16:55:37 -07:00
2022-07-05 14:45:49 -07:00
2022-07-05 14:45:49 -07:00
2023-07-05 10:40:45 -07:00
2023-12-01 07:56:24 -08:00
2024-01-17 23:03:17 -08:00
2024-05-24 16:05:23 -07:00
2024-02-19 14:54:46 -08:00
2024-03-21 10:21:35 -07:00
2023-03-04 20:57:35 -08:00
2024-02-19 14:54:46 -08:00
2023-11-20 17:09:35 -08:00
2023-11-24 09:07:14 -08:00
2024-07-22 00:04:48 -07:00
2023-11-20 17:09:35 -08:00
2023-11-20 17:09:35 -08:00
2024-07-03 11:49:48 -07:00
2024-06-19 10:12:20 -07:00
2022-03-25 16:29:45 -07:00
2024-05-24 16:05:23 -07:00
2024-07-09 15:26:42 -07:00
2022-10-24 17:44:15 -07:00
2024-04-04 05:04:40 -07:00
2024-07-12 09:23:16 -07:00
2024-02-19 14:54:46 -08:00
2024-03-19 13:23:12 -07:00
2024-07-12 09:23:16 -07:00
2022-09-19 11:05:16 -07:00
2024-04-04 05:04:40 -07:00
2023-11-20 17:09:35 -08:00
2023-11-20 17:09:35 -08:00
2024-05-31 22:17:37 -07:00
2024-07-12 09:23:16 -07:00
2024-05-31 22:16:24 -07:00
2024-05-17 08:15:13 -07:00
2024-07-15 09:28:02 -07:00
2024-03-10 01:15:15 -08:00
2024-03-10 01:15:15 -08:00
2024-03-04 10:05:56 -08:00
2024-06-20 10:55:03 -07:00
2024-05-23 00:41:18 -07:00
2024-05-10 07:50:39 -07:00
2024-05-23 00:41:18 -07:00
2024-05-08 17:51:34 -07:00
2024-05-24 05:50:46 -07:00
2024-05-14 00:25:56 -07:00
2024-03-10 01:15:15 -08:00
2024-05-02 01:20:42 -07:00
2024-04-23 21:10:35 -07:00
2024-07-14 11:11:42 -07:00
2024-07-15 09:28:02 -07:00
2024-06-06 02:36:25 -07:00
2024-05-14 00:27:33 -07:00
2024-05-23 00:41:18 -07:00
2024-05-24 12:29:25 -07:00
2024-06-20 10:55:03 -07:00
2024-05-12 10:23:50 -07:00
2024-04-16 22:10:25 -07:00
2024-03-10 01:15:15 -08:00
2024-06-20 10:55:03 -07:00
2024-07-15 09:28:02 -07:00
2024-07-14 11:11:42 -07:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2023-06-05 16:56:35 -07:00
2024-06-10 08:51:27 -07:00
2024-04-19 01:43:09 -07:00
2024-06-19 07:34:00 -07:00
2023-06-19 17:53:08 -07:00
2024-06-20 07:49:22 -07:00
2024-07-02 08:13:05 -07:00
2023-11-20 17:09:35 -08:00
2024-06-10 08:31:51 -07:00
2024-06-10 08:31:51 -07:00
2022-12-23 07:46:00 -08:00
2024-07-16 16:46:41 -07:00
2022-12-23 07:46:00 -08:00
2024-04-04 05:04:40 -07:00
2024-06-21 15:22:24 -07:00
2024-06-21 15:22:24 -07:00
2024-05-01 04:07:40 -07:00
2024-02-21 22:26:06 -08:00
2024-06-12 23:56:12 -07:00
2024-02-21 22:26:06 -08:00
2024-05-24 16:05:23 -07:00
2024-06-10 20:13:30 -07:00
2024-07-02 08:13:05 -07:00
2024-06-10 08:31:51 -07:00
2024-07-16 16:46:41 -07:00
2024-07-22 00:04:48 -07:00
2024-06-14 06:28:35 -07:00
2023-09-13 08:14:36 -07:00
2024-01-17 23:03:17 -08:00
2023-10-18 11:08:15 -07:00
2024-02-14 17:09:38 -08:00
2022-09-19 11:05:16 -07:00
2023-09-13 08:14:36 -07:00
2024-04-22 10:49:30 -07:00
2024-02-14 17:09:38 -08:00
2024-02-14 17:09:38 -08:00
2024-02-14 17:09:38 -08:00
2024-06-20 07:49:22 -07:00
2024-06-20 07:49:22 -07:00
2024-06-20 07:49:22 -07:00
2024-06-17 07:29:18 -07:00
2024-06-17 07:29:18 -07:00
2024-05-24 16:05:23 -07:00
2024-05-24 16:05:23 -07:00
2024-05-22 16:07:14 -07:00
2024-01-17 23:03:17 -08:00
2024-07-10 07:18:44 -07:00
2024-07-12 13:51:54 -07:00
2023-12-21 16:56:43 -08:00
2022-10-25 12:36:57 -07:00
2022-10-25 12:36:57 -07:00
2024-07-08 14:44:00 -07:00
2024-06-10 08:31:51 -07:00
2023-09-24 22:15:31 -07:00
2024-07-15 09:28:02 -07:00
2023-12-07 01:33:56 -08:00
2024-07-12 13:51:54 -07:00
2024-07-02 08:09:36 -07:00
2024-07-12 13:51:54 -07:00
2024-07-12 13:51:54 -07:00
2024-02-27 23:02:14 -08:00
2022-10-24 17:44:15 -07:00
2024-06-28 02:06:25 -07:00
2024-06-05 00:51:13 -07:00
2024-07-01 15:02:01 -07:00
2023-02-13 01:26:38 -08:00
2024-05-01 10:57:52 -07:00
2022-10-14 03:08:40 -07:00
2024-01-17 23:03:17 -08:00
2024-06-13 15:26:38 -07:00
2024-02-21 22:26:06 -08:00
2024-01-17 23:03:17 -08:00
2024-04-05 14:26:41 -07:00
2024-06-13 15:26:38 -07:00
2024-05-16 16:13:47 -07:00
2023-06-19 17:53:08 -07:00
2023-08-30 01:00:59 -07:00
2024-02-05 22:00:45 -08:00
2024-02-05 22:00:45 -08:00
2022-11-14 07:16:40 -08:00
2022-11-14 07:16:40 -08:00
2024-01-17 23:03:17 -08:00
2024-07-14 11:12:07 -07:00
2024-05-06 02:45:10 -07:00
2024-06-10 08:51:27 -07:00
2024-06-10 08:51:27 -07:00
2022-09-19 11:05:16 -07:00
2024-07-23 03:53:03 -07:00
2024-04-04 05:04:40 -07:00
2024-06-10 08:51:27 -07:00
2024-07-22 00:04:48 -07:00
2024-07-23 03:53:03 -07:00
2023-11-20 17:09:35 -08:00
2023-11-20 17:09:35 -08:00
2024-06-17 07:29:18 -07:00
2024-07-22 00:04:48 -07:00
2022-12-01 12:10:54 -08:00
2024-05-16 16:13:47 -07:00
2023-05-05 19:53:12 -07:00
2022-05-26 17:58:09 -07:00
2024-04-04 05:04:40 -07:00
2024-07-10 11:41:49 -07:00
2024-06-10 20:13:30 -07:00
2023-08-03 13:24:25 -07:00
2024-07-22 00:04:48 -07:00
2023-06-19 17:53:08 -07:00
2023-12-20 20:13:40 -08:00
2024-05-24 16:05:23 -07:00
2024-02-19 14:54:46 -08:00
2024-03-21 10:21:35 -07:00
2024-02-19 14:54:46 -08:00
2024-04-16 22:09:58 -07:00
2024-07-03 00:17:20 -07:00
2024-05-28 10:14:16 -07:00
2024-04-04 05:04:40 -07:00
2024-03-08 19:07:08 -08:00
2024-03-08 19:07:08 -08:00
2024-07-02 13:41:29 -07:00
2023-07-31 08:36:19 -07:00
2024-03-08 19:07:08 -08:00
2024-05-24 16:05:23 -07:00
2024-02-23 13:28:14 -08:00
2024-06-05 15:00:34 -07:00
2024-05-20 11:54:52 -07:00
2024-03-05 08:44:08 -08:00
2024-06-21 22:26:45 -07:00
2024-04-21 04:43:18 -07:00
2024-04-21 04:43:18 -07:00
2024-07-03 00:17:20 -07:00
2024-07-23 09:36:24 -07:00
2024-07-23 09:36:24 -07:00
2024-07-02 13:41:29 -07:00
2022-07-25 12:37:26 -07:00
2023-11-28 22:35:16 -08:00
2024-06-10 08:51:27 -07:00
2023-03-06 08:56:29 -08:00
2024-02-21 22:26:06 -08:00
2024-06-07 15:18:44 -07:00
2024-06-17 07:29:18 -07:00
2024-03-21 10:21:35 -07:00
2024-04-04 05:04:40 -07:00
2024-05-29 12:14:09 -07:00
2024-03-08 09:50:48 -08:00
2024-04-19 09:43:43 -07:00
2024-05-29 12:14:09 -07:00
2024-03-01 21:11:03 -08:00
2024-03-01 21:11:03 -08:00
2024-04-04 05:04:40 -07:00
2024-07-23 03:53:03 -07:00