@@ -238,7 +238,10 @@ struct UringIoCtx {
238238 tx : oneshot:: Sender < anyhow:: Result < usize , WorkerError > > ,
239239 io_type : UringIoType ,
240240 addr : RawFileAddress ,
241+
241242 w_bufs : Vec < bytes:: Bytes > ,
243+ w_iovecs : Vec < IoSlice < ' static > > ,
244+
242245 r_bufs : Vec < RawBuf > ,
243246}
244247
@@ -302,15 +305,15 @@ impl UringIoEngineShard {
302305 UringIoType :: WriteV => {
303306 self . write_inflight += 1 ;
304307 // https://github.com/tokio-rs/io-uring/blob/master/io-uring-test/src/utils.rs#L95
305- let slices = ctx
306- . w_bufs
307- . iter ( )
308- . map ( |x| IoSlice :: new ( x . as_ref ( ) ) )
309- . collect :: < Vec < _ > > ( ) ;
310- opcode :: Writev :: new ( fd , slices . as_ptr ( ) . cast ( ) , slices . len ( ) as _ )
311- . offset ( ctx . addr . offset )
312- . build ( )
313- . flags ( squeue :: Flags :: IO_LINK )
308+ opcode :: Writev :: new (
309+ fd ,
310+ ctx . w_iovecs . as_ptr ( ) . cast ( ) ,
311+ ctx . w_iovecs . len ( ) as _ ,
312+ )
313+ . offset ( ctx . addr . offset )
314+ . build ( )
315+ . flags ( squeue :: Flags :: IO_LINK )
316+ . into ( )
314317 }
315318 } ;
316319 let data = Box :: into_raw ( ctx) as u64 ;
@@ -370,6 +373,10 @@ impl LocalIO for UringIo {
370373 let shard = & self . write_txs [ tag % self . write_txs . len ( ) ] ;
371374 let byte_size = options. data . len ( ) ;
372375 let bufs = options. data . always_bytes ( ) ;
376+ let slices = bufs
377+ . iter ( )
378+ . map ( |x| IoSlice :: new ( x. as_ref ( ) ) )
379+ . collect :: < Vec < _ > > ( ) ;
373380
374381 let path = self . with_root ( path) ;
375382 let path = Path :: new ( & path) ;
@@ -384,6 +391,7 @@ impl LocalIO for UringIo {
384391 offset : options. offset . unwrap_or ( 0 ) ,
385392 } ,
386393 w_bufs : bufs,
394+ w_iovecs : slices,
387395 r_bufs : vec ! [ ] ,
388396 } ;
389397 let _ = shard. send ( ctx) ;
@@ -435,6 +443,7 @@ impl LocalIO for UringIo {
435443 offset,
436444 } ,
437445 w_bufs : vec ! [ ] ,
446+ w_iovecs : vec ! [ ] ,
438447 r_bufs : vec ! [ RawBuf {
439448 ptr: buf. as_mut_ptr( ) ,
440449 len: length as usize ,
0 commit comments