@@ -60,15 +60,15 @@ impl<'a, S: BitmapSlice> io::Read for AsyncZcReader<'a, S> {
60
60
}
61
61
}
62
62
63
- struct AsyncZcWriter < ' a , S : BitmapSlice = ( ) > ( Writer < ' a , S > ) ;
63
+ struct AsyncZcWriter < ' a , ' b , S : BitmapSlice = ( ) > ( Writer < ' a , ' b , S > ) ;
64
64
65
65
// The underlying VolatileSlice contains "*mut u8", which is just a pointer to a u8 array.
66
66
// Actually we rely on the AsyncExecutor is a single-threaded worker, and we do not really send
67
67
// 'Reader' to other threads.
68
- unsafe impl < ' a , S : BitmapSlice > Send for AsyncZcWriter < ' a , S > { }
68
+ unsafe impl < ' a , ' b , S : BitmapSlice > Send for AsyncZcWriter < ' a , ' b , S > { }
69
69
70
70
#[ async_trait( ?Send ) ]
71
- impl < ' a , S : BitmapSlice > AsyncZeroCopyWriter for AsyncZcWriter < ' a , S > {
71
+ impl < ' a , ' b , S : BitmapSlice > AsyncZeroCopyWriter for AsyncZcWriter < ' a , ' b , S > {
72
72
async fn async_write_from (
73
73
& mut self ,
74
74
f : Arc < dyn AsyncFileReadWriteVolatile > ,
@@ -79,7 +79,7 @@ impl<'a, S: BitmapSlice> AsyncZeroCopyWriter for AsyncZcWriter<'a, S> {
79
79
}
80
80
}
81
81
82
- impl < ' a , S : BitmapSlice > ZeroCopyWriter for AsyncZcWriter < ' a , S > {
82
+ impl < ' a , ' b , S : BitmapSlice > ZeroCopyWriter for AsyncZcWriter < ' a , ' b , S > {
83
83
fn write_from (
84
84
& mut self ,
85
85
f : & mut dyn FileReadWriteVolatile ,
@@ -90,7 +90,7 @@ impl<'a, S: BitmapSlice> ZeroCopyWriter for AsyncZcWriter<'a, S> {
90
90
}
91
91
}
92
92
93
- impl < ' a , S : BitmapSlice > io:: Write for AsyncZcWriter < ' a , S > {
93
+ impl < ' a , ' b , S : BitmapSlice > io:: Write for AsyncZcWriter < ' a , ' b , S > {
94
94
fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
95
95
self . 0 . write ( buf)
96
96
}
@@ -116,7 +116,7 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
116
116
pub async unsafe fn async_handle_message < S : BitmapSlice > (
117
117
& self ,
118
118
mut r : Reader < ' _ , S > ,
119
- w : Writer < ' _ , S > ,
119
+ w : Writer < ' _ , ' _ , S > ,
120
120
vu_req : Option < & mut dyn FsCacheReqHandler > ,
121
121
hook : Option < & dyn MetricsHook > ,
122
122
) -> Result < usize > {
@@ -210,10 +210,13 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
210
210
res
211
211
}
212
212
213
- async fn async_lookup < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
213
+ async fn async_lookup < S : BitmapSlice > (
214
+ & self ,
215
+ mut ctx : SrvContext < ' _ , ' _ , F , S > ,
216
+ ) -> Result < usize > {
214
217
let buf = ServerUtil :: get_message_body ( & mut ctx. r , & ctx. in_header , 0 ) ?;
215
218
let name = bytes_to_cstr ( buf. as_ref ( ) ) ?;
216
- let version = self . vers . load ( ) ;
219
+ let version = & self . meta . load ( ) . version ;
217
220
let result = self
218
221
. fs
219
222
. async_lookup ( ctx. context ( ) , ctx. nodeid ( ) , name)
@@ -236,7 +239,10 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
236
239
}
237
240
}
238
241
239
- async fn async_getattr < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
242
+ async fn async_getattr < S : BitmapSlice > (
243
+ & self ,
244
+ mut ctx : SrvContext < ' _ , ' _ , F , S > ,
245
+ ) -> Result < usize > {
240
246
let GetattrIn { flags, fh, .. } = ctx. r . read_obj ( ) . map_err ( Error :: DecodeMessage ) ?;
241
247
let handle = if ( flags & GETATTR_FH ) != 0 {
242
248
Some ( fh. into ( ) )
@@ -251,7 +257,10 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
251
257
ctx. async_handle_attr_result ( result) . await
252
258
}
253
259
254
- async fn async_setattr < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
260
+ async fn async_setattr < S : BitmapSlice > (
261
+ & self ,
262
+ mut ctx : SrvContext < ' _ , ' _ , F , S > ,
263
+ ) -> Result < usize > {
255
264
let setattr_in: SetattrIn = ctx. r . read_obj ( ) . map_err ( Error :: DecodeMessage ) ?;
256
265
let handle = if setattr_in. valid & FATTR_FH != 0 {
257
266
Some ( setattr_in. fh . into ( ) )
@@ -268,7 +277,7 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
268
277
ctx. async_handle_attr_result ( result) . await
269
278
}
270
279
271
- async fn async_open < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
280
+ async fn async_open < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , ' _ , F , S > ) -> Result < usize > {
272
281
let OpenIn { flags, fuse_flags } = ctx. r . read_obj ( ) . map_err ( Error :: DecodeMessage ) ?;
273
282
let result = self
274
283
. fs
@@ -289,7 +298,7 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
289
298
}
290
299
}
291
300
292
- async fn async_read < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
301
+ async fn async_read < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , ' _ , F , S > ) -> Result < usize > {
293
302
let ReadIn {
294
303
fh,
295
304
offset,
@@ -347,7 +356,7 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
347
356
. await
348
357
. map_err ( Error :: EncodeMessage ) ?;
349
358
ctx. w
350
- . async_commit ( Some ( & data_writer. 0 ) )
359
+ . async_commit ( Some ( & mut data_writer. 0 ) )
351
360
. await
352
361
. map_err ( Error :: EncodeMessage ) ?;
353
362
Ok ( out. len as usize )
@@ -356,7 +365,10 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
356
365
}
357
366
}
358
367
359
- async fn async_write < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
368
+ async fn async_write < S : BitmapSlice > (
369
+ & self ,
370
+ mut ctx : SrvContext < ' _ , ' _ , F , S > ,
371
+ ) -> Result < usize > {
360
372
let WriteIn {
361
373
fh,
362
374
offset,
@@ -408,7 +420,10 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
408
420
}
409
421
}
410
422
411
- async fn async_fsync < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
423
+ async fn async_fsync < S : BitmapSlice > (
424
+ & self ,
425
+ mut ctx : SrvContext < ' _ , ' _ , F , S > ,
426
+ ) -> Result < usize > {
412
427
let FsyncIn {
413
428
fh, fsync_flags, ..
414
429
} = ctx. r . read_obj ( ) . map_err ( Error :: DecodeMessage ) ?;
@@ -424,7 +439,10 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
424
439
}
425
440
}
426
441
427
- async fn async_fsyncdir < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
442
+ async fn async_fsyncdir < S : BitmapSlice > (
443
+ & self ,
444
+ mut ctx : SrvContext < ' _ , ' _ , F , S > ,
445
+ ) -> Result < usize > {
428
446
let FsyncIn {
429
447
fh, fsync_flags, ..
430
448
} = ctx. r . read_obj ( ) . map_err ( Error :: DecodeMessage ) ?;
@@ -440,7 +458,10 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
440
458
}
441
459
}
442
460
443
- async fn async_create < S : BitmapSlice > ( & self , mut ctx : SrvContext < ' _ , F , S > ) -> Result < usize > {
461
+ async fn async_create < S : BitmapSlice > (
462
+ & self ,
463
+ mut ctx : SrvContext < ' _ , ' _ , F , S > ,
464
+ ) -> Result < usize > {
444
465
let args: CreateIn = ctx. r . read_obj ( ) . map_err ( Error :: DecodeMessage ) ?;
445
466
let buf = ServerUtil :: get_message_body ( & mut ctx. r , & ctx. in_header , size_of :: < CreateIn > ( ) ) ?;
446
467
let name = bytes_to_cstr ( & buf) ?;
@@ -476,7 +497,7 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
476
497
477
498
async fn async_fallocate < S : BitmapSlice > (
478
499
& self ,
479
- mut ctx : SrvContext < ' _ , F , S > ,
500
+ mut ctx : SrvContext < ' _ , ' _ , F , S > ,
480
501
) -> Result < usize > {
481
502
let FallocateIn {
482
503
fh,
@@ -497,7 +518,7 @@ impl<F: AsyncFileSystem + Sync> Server<F> {
497
518
}
498
519
}
499
520
500
- impl < ' a , F : AsyncFileSystem , S : BitmapSlice > SrvContext < ' a , F , S > {
521
+ impl < ' a , ' b , F : AsyncFileSystem , S : BitmapSlice > SrvContext < ' a , ' b , F , S > {
501
522
async fn async_reply_ok < T : ByteValued > (
502
523
& mut self ,
503
524
out : Option < T > ,
0 commit comments