patch: increase FUSE block size and add retry
1. this should make file managers read small file in one request more likely 2. implemented retry, max times 3 Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
parent
ed0ded33b7
commit
075a877284
@ -1,11 +0,0 @@
|
||||
#include "../cliprdr.h"
|
||||
|
||||
void xf_cliprdr_init(CliprdrClientContext* cliprdr)
|
||||
{
|
||||
(void)cliprdr;
|
||||
}
|
||||
|
||||
void xf_cliprdr_uninit( CliprdrClientContext* cliprdr)
|
||||
{
|
||||
(void)cliprdr;
|
||||
}
|
@ -43,10 +43,11 @@ use crate::{send_data, ClipboardFile, CliprdrError};
|
||||
#[cfg(target_os = "linux")]
|
||||
use super::LDAP_EPOCH_DELTA;
|
||||
|
||||
/// fuse server ready retry max times
|
||||
const READ_RETRY: i32 = 3;
|
||||
|
||||
/// block size for fuse, align to our asynchronic request size over FileContentsRequest.
|
||||
///
|
||||
/// Question: will this hint users to read data in this size?
|
||||
const BLOCK_SIZE: u32 = 128 * 1024;
|
||||
const BLOCK_SIZE: u32 = 4 * 1024 * 1024;
|
||||
|
||||
/// read only permission
|
||||
const PERM_READ: u16 = 0o444;
|
||||
@ -403,6 +404,7 @@ impl fuser::Filesystem for FuseServer {
|
||||
reply.opened(fh, 0);
|
||||
}
|
||||
|
||||
// todo: implement retry
|
||||
fn read(
|
||||
&mut self,
|
||||
_req: &fuser::Request<'_>,
|
||||
@ -539,7 +541,7 @@ impl FuseServer {
|
||||
clip_data_id: 0,
|
||||
};
|
||||
|
||||
send_data(node.conn_id, request);
|
||||
send_data(node.conn_id, request.clone());
|
||||
|
||||
log::debug!(
|
||||
"waiting for read reply for {:?} on stream: {}",
|
||||
@ -547,6 +549,8 @@ impl FuseServer {
|
||||
node.stream_id
|
||||
);
|
||||
|
||||
let mut retry_times = 0;
|
||||
|
||||
loop {
|
||||
let reply = self.rx.recv_timeout(self.timeout).map_err(|e| {
|
||||
log::error!("failed to receive file list from channel: {:?}", e);
|
||||
@ -563,11 +567,18 @@ impl FuseServer {
|
||||
log::debug!("stream id mismatch, ignore");
|
||||
continue;
|
||||
}
|
||||
|
||||
if msg_flags & 1 == 0 {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"failure request",
|
||||
));
|
||||
retry_times += 1;
|
||||
if retry_times > READ_RETRY {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"failure request",
|
||||
));
|
||||
}
|
||||
|
||||
send_data(node.conn_id, request.clone());
|
||||
continue;
|
||||
}
|
||||
return Ok(requested_data);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user