Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5873] feat(gvfs-fuse): add debug log for FuseApiHandle #5905

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clients/filesystem-fuse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ name = "gvfs_fuse"
[dependencies]
async-trait = "0.1"
bytes = "1.6.0"
chrono = "0.4.39"
config = "0.13"
dashmap = "6.1.0"
fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] }
futures-util = "0.3.30"
libc = "0.2.168"
log = "0.4.22"
once_cell = "1.20.2"
opendal = { version = "0.46.0", features = ["services-s3"] }
reqwest = { version = "0.12.9", features = ["json"] }
serde = { version = "1.0.216", features = ["derive"] }
tokio = { version = "1.38.0", features = ["full"] }
tracing = "0.1.41"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to use tracing instead of log, please remove log.

tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
urlencoding = "2.1.3"

Expand Down
1 change: 1 addition & 0 deletions clients/filesystem-fuse/conf/gvfs_fuse.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
file_mask = 0o600
dir_mask = 0o700
fs_type = "memory"
fuse_debug = true

Copy link
Contributor

@diqiu50 diqiu50 Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the format

[fuse.properties]

Expand Down
4 changes: 3 additions & 1 deletion clients/filesystem-fuse/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use crate::error::ErrorCode::{ConfigNotFound, InvalidConfig};
use crate::utils::GvfsResult;
use config::{builder, Config};
use log::{error, info, warn};
use tracing::{error, info, warn};
use serde::Deserialize;
use std::collections::HashMap;
use std::fs;
Expand Down Expand Up @@ -265,6 +265,8 @@ pub struct FuseConfig {
#[serde(default)]
pub fs_type: String,
#[serde(default)]
pub fuse_debug: bool,
#[serde(default)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to handle default value like other configurations.

pub config_path: String,
#[serde(default)]
pub properties: HashMap<String, String>,
Expand Down
1 change: 1 addition & 0 deletions clients/filesystem-fuse/src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ pub(crate) trait PathFileSystem: Send + Sync {
}

// FileSystemContext is the system environment for the fuse file system.
#[derive(Debug)]
pub(crate) struct FileSystemContext {
// system user id
pub(crate) uid: u32,
Expand Down
13 changes: 7 additions & 6 deletions clients/filesystem-fuse/src/fuse_api_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<T: RawFileSystem> FuseApiHandle<T> {
}
}

async fn get_modified_file_stat(
pub async fn get_modified_file_stat(
&self,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use this function to retrieve the file name. use the RawFileSystem::get_file_path

file_id: u64,
size: Option<u64>,
Expand All @@ -64,15 +64,15 @@ impl<T: RawFileSystem> FuseApiHandle<T> {

if let Some(size) = size {
file_stat.size = size;
};
}

if let Some(atime) = atime {
file_stat.atime = atime;
};
}

if let Some(mtime) = mtime {
file_stat.mtime = mtime;
};
}

Ok(file_stat)
}
Expand Down Expand Up @@ -117,6 +117,7 @@ impl<T: RawFileSystem> Filesystem for FuseApiHandle<T> {
}

let file_stat = self.fs.stat(inode).await?;

Ok(ReplyAttr {
ttl: self.default_ttl,
attr: fstat_to_file_attr(&file_stat, &self.fs_context),
Expand Down Expand Up @@ -256,7 +257,7 @@ impl<T: RawFileSystem> Filesystem for FuseApiHandle<T> {
}

type DirEntryStream<'a>
= BoxStream<'a, fuse3::Result<DirectoryEntry>>
= BoxStream<'a, fuse3::Result<DirectoryEntry>>
where
T: 'a;

Expand Down Expand Up @@ -336,7 +337,7 @@ impl<T: RawFileSystem> Filesystem for FuseApiHandle<T> {
}

type DirEntryPlusStream<'a>
= BoxStream<'a, fuse3::Result<DirectoryEntryPlus>>
= BoxStream<'a, fuse3::Result<DirectoryEntryPlus>>
where
T: 'a;

Expand Down
Loading