Lines Matching refs:req
11 #define req_ref_zero_or_close_to_overflow(req) \ argument
12 ((unsigned int) atomic_read(&(req->refs)) + 127u <= 127u)
14 static inline bool req_ref_inc_not_zero(struct io_kiocb *req) in req_ref_inc_not_zero() argument
16 WARN_ON_ONCE(!(req->flags & REQ_F_REFCOUNT)); in req_ref_inc_not_zero()
17 return atomic_inc_not_zero(&req->refs); in req_ref_inc_not_zero()
20 static inline bool req_ref_put_and_test_atomic(struct io_kiocb *req) in req_ref_put_and_test_atomic() argument
22 WARN_ON_ONCE(!(data_race(req->flags) & REQ_F_REFCOUNT)); in req_ref_put_and_test_atomic()
23 WARN_ON_ONCE(req_ref_zero_or_close_to_overflow(req)); in req_ref_put_and_test_atomic()
24 return atomic_dec_and_test(&req->refs); in req_ref_put_and_test_atomic()
27 static inline bool req_ref_put_and_test(struct io_kiocb *req) in req_ref_put_and_test() argument
29 if (likely(!(req->flags & REQ_F_REFCOUNT))) in req_ref_put_and_test()
32 WARN_ON_ONCE(req_ref_zero_or_close_to_overflow(req)); in req_ref_put_and_test()
33 return atomic_dec_and_test(&req->refs); in req_ref_put_and_test()
36 static inline void req_ref_get(struct io_kiocb *req) in req_ref_get() argument
38 WARN_ON_ONCE(!(req->flags & REQ_F_REFCOUNT)); in req_ref_get()
39 WARN_ON_ONCE(req_ref_zero_or_close_to_overflow(req)); in req_ref_get()
40 atomic_inc(&req->refs); in req_ref_get()
43 static inline void req_ref_put(struct io_kiocb *req) in req_ref_put() argument
45 WARN_ON_ONCE(!(req->flags & REQ_F_REFCOUNT)); in req_ref_put()
46 WARN_ON_ONCE(req_ref_zero_or_close_to_overflow(req)); in req_ref_put()
47 atomic_dec(&req->refs); in req_ref_put()
50 static inline void __io_req_set_refcount(struct io_kiocb *req, int nr) in __io_req_set_refcount() argument
52 if (!(req->flags & REQ_F_REFCOUNT)) { in __io_req_set_refcount()
53 req->flags |= REQ_F_REFCOUNT; in __io_req_set_refcount()
54 atomic_set(&req->refs, nr); in __io_req_set_refcount()
58 static inline void io_req_set_refcount(struct io_kiocb *req) in io_req_set_refcount() argument
60 __io_req_set_refcount(req, 1); in io_req_set_refcount()