@@ -260,7 +260,7 @@ static void nvme_uring_cmd_exit(struct io_uring *ring)
260260}
261261
262262static int nvme_uring_cmd_admin_passthru_async (struct nvme_transport_handle * hdl ,
263- struct io_uring * ring , struct nvme_passthru_cmd * cmd , __u32 * result )
263+ struct io_uring * ring , struct nvme_passthru_cmd * cmd )
264264{
265265 struct io_uring_sqe * sqe ;
266266 int ret ;
@@ -274,7 +274,6 @@ static int nvme_uring_cmd_admin_passthru_async(struct nvme_transport_handle *hdl
274274 sqe -> fd = hdl -> fd ;
275275 sqe -> opcode = IORING_OP_URING_CMD ;
276276 sqe -> cmd_op = NVME_URING_CMD_ADMIN ;
277- sqe -> user_data = (__u64 )(uintptr_t )result ;
278277
279278 ret = io_uring_submit (ring );
280279 if (ret < 0 )
@@ -286,26 +285,16 @@ static int nvme_uring_cmd_admin_passthru_async(struct nvme_transport_handle *hdl
286285static int nvme_uring_cmd_wait_complete (struct io_uring * ring , int n )
287286{
288287 struct io_uring_cqe * cqe ;
289- int i , ret = 0 ;
290- __u32 * result ;
288+ int ret , i ;
291289
292290 for (i = 0 ; i < n ; i ++ ) {
293291 ret = io_uring_wait_cqe (ring , & cqe );
294- if (ret )
295- return -1 ;
296-
297- if (cqe -> res ) {
298- result = (__u32 * )cqe -> user_data ;
299- if (result )
300- * result = cqe -> res ;
301- ret = cqe -> res ;
302- break ;
303- }
304-
292+ if (ret < 0 )
293+ return - errno ;
305294 io_uring_cqe_seen (ring , cqe );
306295 }
307296
308- return ret ;
297+ return 0 ;
309298}
310299
311300static bool nvme_uring_is_usable (struct nvme_transport_handle * hdl )
@@ -388,15 +377,16 @@ int nvme_get_log(struct nvme_transport_handle *hdl,
388377#ifdef CONFIG_LIBURING
389378 if (use_uring ) {
390379 if (n >= NVME_URING_ENTRIES ) {
391- nvme_uring_cmd_wait_complete (& ring , n );
380+ ret = nvme_uring_cmd_wait_complete (& ring , n );
381+ if (ret )
382+ goto uring_exit ;
392383 n = 0 ;
393384 }
394385 n += 1 ;
395- ret = nvme_uring_cmd_admin_passthru_async (hdl , & ring ,
396- cmd , result );
397-
386+ ret = nvme_uring_cmd_admin_passthru_async (hdl ,
387+ & ring , cmd );
398388 if (ret )
399- nvme_uring_cmd_exit ( & ring ) ;
389+ goto uring_exit ;
400390 } else {
401391 ret = nvme_submit_admin_passthru (hdl , cmd );
402392 if (ret )
@@ -414,7 +404,8 @@ int nvme_get_log(struct nvme_transport_handle *hdl,
414404
415405#ifdef CONFIG_LIBURING
416406 if (use_uring ) {
417- nvme_uring_cmd_wait_complete (& ring , n );
407+ ret = nvme_uring_cmd_wait_complete (& ring , n );
408+ uring_exit :
418409 nvme_uring_cmd_exit (& ring );
419410 if (ret )
420411 return ret ;
0 commit comments