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 5 commits into
base: branch-gvfs-fuse-dev
Choose a base branch
from

Conversation

unknowntpo
Copy link
Contributor

@unknowntpo unknowntpo commented Dec 18, 2024

What changes were proposed in this pull request?

Implement FuseApiHandleDebug so we can log all input arguments and return values of FuseApiHandle.

Fix: #5873

Does this PR introduce any user-facing change?

No.

How was this patch tested?

manually.

@unknowntpo unknowntpo marked this pull request as ready for review December 19, 2024 22:52
Copy link
Contributor

@diqiu50 diqiu50 left a comment

Choose a reason for hiding this comment

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

Finally, we need to verify the log format to see if it meets expectations. This needs to be validated in the #5886, and you can wait for it to be merged.

inner: FuseApiHandle::new(fs, context),
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

These functions that are not part of the Filesystem trait do not need to add debug logs.

}

impl<T: RawFileSystem> Filesystem for FuseApiHandleDebug<T> {
async fn init(&self, req: Request) -> fuse3::Result<ReplyInit> {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to implement all interfaces of the Filesystem. If they are not implemented yet, an error log should be recorded.

async fn init(&self, req: Request) -> fuse3::Result<ReplyInit> {
debug!("init: req: {:?}", req);
let result = self.inner.init(req).await;
debug!("init result: {:?}", result);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an asynchronous multithreaded model. Logs from two print statements within a single function may be interleaved with logs from other interfaces. It is necessary to identify them in the logs.

async fn lookup(&self, req: Request, parent: Inode, name: &OsStr) -> fuse3::Result<ReplyEntry> {
debug!("lookup: req: {:?}, parent: {:?}, name: {:?}", req, parent, name);
let result = self.inner.lookup(req, parent, name).await;
debug!("lookup result: {:?}", result);
Copy link
Contributor

Choose a reason for hiding this comment

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

If an error is returned, it should be logged using error!.

atime: Option<Timestamp>,
mtime: Option<Timestamp>,
) -> Result<FileStat, Errno> {
debug!("get_modified_file_stat: file_id: {}, size: {:?}, atime: {:?}, mtime: {:?}", file_id, size, atime, mtime);
Copy link
Contributor

Choose a reason for hiding this comment

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

It’s best to convert file_id to a file path to improve readability, for example, "/a/b.txt(2342)". Other variables should follow a similar approach.

@diqiu50
Copy link
Contributor

diqiu50 commented Dec 20, 2024

Please refer to other PRs for the format of PR titles and descriptions.

@unknowntpo unknowntpo changed the title Feat fuse debug log [#5873] feat(gvfs-fuse): add debug log for FuseApiHandle Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants