Remove useless brances in register functions
cover Remove useless brances in register functions
From: Ammar Faizi <[email protected]>
Hi Jens,
This series removes useless branches in register functions:
- io_uring_register_eventfd()
- io_uring_unregister_eventfd()
- io_uring_register_eventfd_async()
- io_uring_register_buffers()
- io_uring_unregister_buffers()
- io_uring_unregister_files()
- io_uring_register_probe()
- io_uring_register_restrictions()
There are 5 patches in this series.
---
Ammar Faizi (5):
register: Remove useless branches in {un,}register eventfd
register: Remove useless branches in {un,}register buffers
register: Remove useless branch in unregister files
register: Remove useless branch in register probe
register: Remove useless branch in register restrictions
src/register.c | 60 +++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 42 deletions(-)
base-commit: 8fc22e3b3348c0a6384ec926e0b19b6707622e58
Signature · 1 line
Ammar Faizi
PATCH 1/5 register: Remove useless branches in {un,}register eventfd
From: Ammar Faizi <[email protected]>
IORING_{UN,}REGISTER_EVENTFD and IORING_REGISTER_EVENTFD_ASYNC don't return a positive value. These branches are useless. Remove them.
[1]: io_eventfd_register
[2]: io_eventfd_unregister
Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/io_uring.c#L2511-L2547 [1]
Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/io_uring.c#L2549-L2564 [2]
--- src/register.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)
src/register.c +7 -16
@@ -208,30 +208,21 @@ int io_uring_unregister_files(struct io_uring *ring)int io_uring_register_eventfd (struct io_uring *ring,int event_fd) { -int ret; - - ret =__sys_io_uring_register (ring->ring_fd,IORING_REGISTER_EVENTFD , - &event_fd,1 ); -return (ret <0 ) ? ret :0 ; +return __sys_io_uring_register (ring->ring_fd,IORING_REGISTER_EVENTFD , + &event_fd,1 ); }int io_uring_unregister_eventfd (struct io_uring *ring) { -int ret; - - ret =__sys_io_uring_register (ring->ring_fd,IORING_UNREGISTER_EVENTFD , -NULL ,0 ); -return (ret <0 ) ? ret :0 ; +return __sys_io_uring_register (ring->ring_fd,IORING_UNREGISTER_EVENTFD , +NULL ,0 ); }int io_uring_register_eventfd_async (struct io_uring *ring,int event_fd) { -int ret; - - ret =__sys_io_uring_register (ring->ring_fd, -IORING_REGISTER_EVENTFD_ASYNC , &event_fd, -1 ); -return (ret <0 ) ? ret :0 ; +return __sys_io_uring_register (ring->ring_fd, +IORING_REGISTER_EVENTFD_ASYNC , &event_fd, +1 ); } int io_uring_register_probe(struct io_uring *ring, struct io_uring_probe *p,
Signature · 1 line
Ammar Faizi
PATCH 2/5 register: Remove useless branches in {un,}register buffers
In reply to Ammar FaiziFrom: Ammar Faizi <[email protected]>
IORING_REGISTER_BUFFERS and IORING_UNREGISTER_BUFFERS don't return a positive value. These bracnes are useless. Remove them.
[1]: io_sqe_buffers_register
[2]: io_sqe_buffers_unregister
Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/rsrc.c#L1250-L1307 [1]
Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/rsrc.c#L1036-L1054 [2]
--- src/register.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
src/register.c +4 -10
@@ -54,20 +54,14 @@ int io_uring_register_buffers_sparse(struct io_uring *ring, unsigned nr)int io_uring_register_buffers (struct io_uring *ring,const struct iovec *iovecs,unsigned nr_iovecs) { -int ret; - - ret =__sys_io_uring_register (ring->ring_fd,IORING_REGISTER_BUFFERS , - iovecs, nr_iovecs); -return (ret <0 ) ? ret :0 ; +return __sys_io_uring_register (ring->ring_fd,IORING_REGISTER_BUFFERS , + iovecs, nr_iovecs); }int io_uring_unregister_buffers (struct io_uring *ring) { -int ret; - - ret =__sys_io_uring_register (ring->ring_fd,IORING_UNREGISTER_BUFFERS , -NULL ,0 ); -return (ret <0 ) ? ret :0 ; +return __sys_io_uring_register (ring->ring_fd,IORING_UNREGISTER_BUFFERS , +NULL ,0 ); } int io_uring_register_files_update_tag(struct io_uring *ring, unsigned off,
Signature · 1 line
Ammar Faizi
PATCH 3/5 register: Remove useless branch in unregister files
In reply to Ammar FaiziFrom: Ammar Faizi <[email protected]>
IORING_UNREGISTER_FILES doesn't return a positive value. This branch is useless. Remove it.
[1]: io_sqe_files_unregister
Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/rsrc.c#L787-L805 [1]
--- src/register.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
src/register.c +2 -5
@@ -193,11 +193,8 @@ int io_uring_register_files(struct io_uring *ring, const int *files,int io_uring_unregister_files (struct io_uring *ring) { -int ret; - - ret =__sys_io_uring_register (ring->ring_fd,IORING_UNREGISTER_FILES , -NULL ,0 ); -return (ret <0 ) ? ret :0 ; +return __sys_io_uring_register (ring->ring_fd,IORING_UNREGISTER_FILES , +NULL ,0 ); }int io_uring_register_eventfd (struct io_uring *ring,int event_fd)
Signature · 1 line
Ammar Faizi
PATCH 4/5 register: Remove useless branch in register probe
In reply to Ammar FaiziFrom: Ammar Faizi <[email protected]>
IORING_REGISTER_PROBE doesn't return a positive value. This branch is useless. Remove it.
[1]: io_probe
Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/io_uring.c#L3608-L3646 [1]
--- src/register.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
src/register.c +2 -5
@@ -219,11 +219,8 @@ int io_uring_register_eventfd_async(struct io_uring *ring, int event_fd)int io_uring_register_probe (struct io_uring *ring,struct io_uring_probe *p,unsigned int nr_ops) { -int ret; - - ret =__sys_io_uring_register (ring->ring_fd,IORING_REGISTER_PROBE , p, - nr_ops); -return (ret <0 ) ? ret :0 ; +return __sys_io_uring_register (ring->ring_fd,IORING_REGISTER_PROBE , p, + nr_ops); }int io_uring_register_personality (struct io_uring *ring)
Signature · 1 line
Ammar Faizi
PATCH 5/5 register: Remove useless branch in register restrictions
In reply to Ammar FaiziFrom: Ammar Faizi <[email protected]>
IORING_REGISTER_RESTRICTIONS doesn't return a positive value. This branch is useless. Remove it.
[1]: io_register_restrictions
Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/io_uring.c#L3665-L3733 [1]
--- src/register.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
src/register.c +3 -6
@@ -239,12 +239,9 @@ int io_uring_register_restrictions(struct io_uring *ring, struct io_uring_restriction *res, unsigned int nr_res) { - int ret; - - ret =__sys_io_uring_register (ring->ring_fd, -IORING_REGISTER_RESTRICTIONS , res, - nr_res); -return (ret <0 ) ? ret :0 ; +return __sys_io_uring_register (ring->ring_fd, +IORING_REGISTER_RESTRICTIONS , res, + nr_res); }int io_uring_enable_rings (struct io_uring *ring)
Signature · 1 line
Ammar Faizi
Quoted 14 lines · Ammar Faizi
From: Ammar Faizi <[email protected]>
Hi Jens,
This series removes useless branches in register functions:
-io_uring_register_eventfd()
-io_uring_unregister_eventfd()
-io_uring_register_eventfd_async()
-io_uring_register_buffers()
-io_uring_unregister_buffers()
-io_uring_unregister_files()
-io_uring_register_probe()
-io_uring_register_restrictions()
Quoted 1 line
[...]
Applied, thanks!
[1/5] register: Remove useless branches in {un,}register eventfd
commit: ed62cc1a3048e9aed33cf5fb8f47655fc5175bb4
[2/5] register: Remove useless branches in {un,}register buffers
commit: a4ae8662b61bee4b89d6953348944030461f276d
[3/5] register: Remove useless branch in unregister files
commit: 2ca898e57658b0b7a3506c9b97dd6d2a2238c2a3
[4/5] register: Remove useless branch in register probe
commit: 3a418e3e95d0406b2868d79414065d8fa04f2238
[5/5] register: Remove useless branch in register restrictions
commit: 636b6bdaa8d84f1b5318e27d1e4ffa86361ae66dBest regards,
Signature · 1 line
Jens Axboe