@@ -508,6 +508,7 @@ enum {
508
508
REQ_F_FORCE_ASYNC_BIT = IOSQE_ASYNC_BIT ,
509
509
REQ_F_BUFFER_SELECT_BIT = IOSQE_BUFFER_SELECT_BIT ,
510
510
511
+ REQ_F_LINK_HEAD_BIT ,
511
512
REQ_F_LINK_NEXT_BIT ,
512
513
REQ_F_FAIL_LINK_BIT ,
513
514
REQ_F_INFLIGHT_BIT ,
@@ -543,6 +544,8 @@ enum {
543
544
/* IOSQE_BUFFER_SELECT */
544
545
REQ_F_BUFFER_SELECT = BIT (REQ_F_BUFFER_SELECT_BIT ),
545
546
547
+ /* head of a link */
548
+ REQ_F_LINK_HEAD = BIT (REQ_F_LINK_HEAD_BIT ),
546
549
/* already grabbed next link */
547
550
REQ_F_LINK_NEXT = BIT (REQ_F_LINK_NEXT_BIT ),
548
551
/* fail rest of links */
@@ -1437,7 +1440,7 @@ static bool io_link_cancel_timeout(struct io_kiocb *req)
1437
1440
if (ret != -1 ) {
1438
1441
io_cqring_fill_event (req , - ECANCELED );
1439
1442
io_commit_cqring (ctx );
1440
- req -> flags &= ~REQ_F_LINK ;
1443
+ req -> flags &= ~REQ_F_LINK_HEAD ;
1441
1444
io_put_req (req );
1442
1445
return true;
1443
1446
}
@@ -1473,7 +1476,7 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
1473
1476
1474
1477
list_del_init (& req -> link_list );
1475
1478
if (!list_empty (& nxt -> link_list ))
1476
- nxt -> flags |= REQ_F_LINK ;
1479
+ nxt -> flags |= REQ_F_LINK_HEAD ;
1477
1480
* nxtptr = nxt ;
1478
1481
break ;
1479
1482
}
@@ -1484,7 +1487,7 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
1484
1487
}
1485
1488
1486
1489
/*
1487
- * Called if REQ_F_LINK is set, and we fail the head request
1490
+ * Called if REQ_F_LINK_HEAD is set, and we fail the head request
1488
1491
*/
1489
1492
static void io_fail_links (struct io_kiocb * req )
1490
1493
{
@@ -1517,7 +1520,7 @@ static void io_fail_links(struct io_kiocb *req)
1517
1520
1518
1521
static void io_req_find_next (struct io_kiocb * req , struct io_kiocb * * nxt )
1519
1522
{
1520
- if (likely (!(req -> flags & REQ_F_LINK )))
1523
+ if (likely (!(req -> flags & REQ_F_LINK_HEAD )))
1521
1524
return ;
1522
1525
1523
1526
/*
@@ -1669,7 +1672,7 @@ static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx)
1669
1672
1670
1673
static inline bool io_req_multi_free (struct req_batch * rb , struct io_kiocb * req )
1671
1674
{
1672
- if ((req -> flags & REQ_F_LINK ) || io_is_fallback_req (req ))
1675
+ if ((req -> flags & REQ_F_LINK_HEAD ) || io_is_fallback_req (req ))
1673
1676
return false;
1674
1677
1675
1678
if (!(req -> flags & REQ_F_FIXED_FILE ) || req -> io )
@@ -2562,7 +2565,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock)
2562
2565
2563
2566
req -> result = 0 ;
2564
2567
io_size = ret ;
2565
- if (req -> flags & REQ_F_LINK )
2568
+ if (req -> flags & REQ_F_LINK_HEAD )
2566
2569
req -> result = io_size ;
2567
2570
2568
2571
/*
@@ -2653,7 +2656,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock)
2653
2656
2654
2657
req -> result = 0 ;
2655
2658
io_size = ret ;
2656
- if (req -> flags & REQ_F_LINK )
2659
+ if (req -> flags & REQ_F_LINK_HEAD )
2657
2660
req -> result = io_size ;
2658
2661
2659
2662
/*
@@ -5476,7 +5479,7 @@ static struct io_kiocb *io_prep_linked_timeout(struct io_kiocb *req)
5476
5479
{
5477
5480
struct io_kiocb * nxt ;
5478
5481
5479
- if (!(req -> flags & REQ_F_LINK ))
5482
+ if (!(req -> flags & REQ_F_LINK_HEAD ))
5480
5483
return NULL ;
5481
5484
/* for polled retry, if flag is set, we already went through here */
5482
5485
if (req -> flags & REQ_F_POLLED )
@@ -5636,7 +5639,7 @@ static int io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
5636
5639
/* same numerical values with corresponding REQ_F_*, safe to copy */
5637
5640
req -> flags |= sqe_flags & (IOSQE_IO_DRAIN | IOSQE_IO_HARDLINK |
5638
5641
IOSQE_ASYNC | IOSQE_FIXED_FILE |
5639
- IOSQE_BUFFER_SELECT );
5642
+ IOSQE_BUFFER_SELECT | IOSQE_IO_LINK );
5640
5643
5641
5644
fd = READ_ONCE (sqe -> fd );
5642
5645
ret = io_req_set_file (state , req , fd , sqe_flags );
@@ -5687,7 +5690,7 @@ static int io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
5687
5690
req -> ctx -> drain_next = 0 ;
5688
5691
}
5689
5692
if (sqe_flags & (IOSQE_IO_LINK |IOSQE_IO_HARDLINK )) {
5690
- req -> flags |= REQ_F_LINK ;
5693
+ req -> flags |= REQ_F_LINK_HEAD ;
5691
5694
INIT_LIST_HEAD (& req -> link_list );
5692
5695
5693
5696
if (io_alloc_async_ctx (req ))
0 commit comments