File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,9 @@ const INIT_EXT: u64 = 0x4000_0000;
197
197
// This flag indicates whether the guest kernel enable per-file dax
198
198
const PERFILE_DAX : u64 = 0x2_0000_0000 ;
199
199
200
+ // this flag indicates whether the guest kernel enable resend
201
+ const HAS_RESEND : u64 = 1_u64 << 39 ;
202
+
200
203
// This flag indicates whether to enable fd-passthrough. It was defined in the
201
204
// Anolis kernel but not in the upstream kernel. To avoid collision, we'll set
202
205
// it to the most significant bit.
@@ -458,6 +461,9 @@ bitflags! {
458
461
/// If this feature is enabled, filesystem will notify guest kernel whether file
459
462
/// enable DAX by EntryOut.Attr.flags of inode when lookup
460
463
const PERFILE_DAX = PERFILE_DAX ;
464
+
465
+ /// indicates whether the kernel support resend inflight request
466
+ const HAS_RESEND = HAS_RESEND ;
461
467
}
462
468
}
463
469
@@ -755,7 +761,8 @@ pub enum NotifyOpcode {
755
761
Store = 4 ,
756
762
Retrieve = 5 ,
757
763
Delete = 6 ,
758
- CodeMax = 7 ,
764
+ Resend = 7 ,
765
+ CodeMax = 8 ,
759
766
}
760
767
761
768
#[ repr( C ) ]
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ pub const MAX_REQ_PAGES: u16 = 256; // 1MB
51
51
pub struct Server < F : FileSystem + Sync > {
52
52
fs : F ,
53
53
vers : ArcSwap < ServerVersion > ,
54
+ enabled : Option < FsOptions > ,
54
55
}
55
56
56
57
impl < F : FileSystem + Sync > Server < F > {
@@ -62,6 +63,7 @@ impl<F: FileSystem + Sync> Server<F> {
62
63
major : KERNEL_VERSION ,
63
64
minor : KERNEL_MINOR_VERSION ,
64
65
} ) ) ,
66
+ enabled : None ,
65
67
}
66
68
}
67
69
}
Original file line number Diff line number Diff line change @@ -57,6 +57,27 @@ impl<F: FileSystem + Sync> Server<F> {
57
57
. map_err ( Error :: FailedToWrite ) ?;
58
58
buffer_writer. commit ( None ) . map_err ( Error :: InvalidMessage )
59
59
}
60
+
61
+ #[ cfg( feature = "fusedev" ) ]
62
+ pub fn notify_resend < S : BitmapSlice > (
63
+ & self ,
64
+ mut w : FuseDevWriter < ' _ , S > ,
65
+ ) -> Result < ( ) > {
66
+ if !self . enabled . map_or ( false , |enabled| {
67
+ enabled. contains ( FsOptions :: HAS_RESEND )
68
+ } ) {
69
+ return Ok ( 0 )
70
+ }
71
+ let mut buffer_writer = w. split_at ( 0 ) . map_err ( Error :: FailedToSplitWriter ) ?;
72
+ let mut header = OutHeader :: default ( ) ;
73
+ header. unique = 0 ;
74
+ header. error = NotifyOpcode :: Resend as i32 ;
75
+ buffer_writer
76
+ . write_obj ( header)
77
+ . map_err ( Error :: FailedToWrite ) ?;
78
+ buffer_writer. commit ( None ) . map_err ( Error :: InvalidMessage )
79
+ }
80
+
60
81
/// Main entrance to handle requests from the transport layer.
61
82
///
62
83
/// It receives Fuse requests from transport layers, parses the request according to Fuse ABI,
@@ -744,6 +765,7 @@ impl<F: FileSystem + Sync> Server<F> {
744
765
}
745
766
let vers = ServerVersion { major, minor } ;
746
767
self . vers . store ( Arc :: new ( vers) ) ;
768
+ self . enabled = Some ( enabled) ;
747
769
if minor < KERNEL_MINOR_VERSION_INIT_OUT_SIZE {
748
770
ctx. reply_ok (
749
771
Some (
You can’t perform that action at this time.
0 commit comments