Skip to content

Commit 2764f3c

Browse files
author
Mansi Pandey
committed
Address PR comments and undo changes to fuser crate
Signed-off-by: Mansi Pandey <[email protected]>
1 parent 9be15ee commit 2764f3c

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

mountpoint-s3-fs/src/fuse.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::ffi::OsStr;
66
use std::path::Path;
77
use std::time::SystemTime;
88
use time::OffsetDateTime;
9-
use tracing::{Instrument, field, instrument};
9+
use tracing::{Instrument, field, instrument, debug};
1010

1111
use crate::fs::{
1212
DirectoryEntry, DirectoryReplier, InodeNo, S3Filesystem, ToErrno, error_metadata::MOUNTPOINT_EVENT_READY,
@@ -111,6 +111,7 @@ where
111111

112112
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=parent, name=?name, pid=req.pid()))]
113113
fn lookup(&self, req: &Request<'_>, parent: InodeNo, name: &OsStr, reply: ReplyEntry) {
114+
debug!("New request");
114115
match block_on(self.fs.lookup(parent, name).in_current_span()) {
115116
Ok(entry) => reply.entry(&entry.ttl, &entry.attr, entry.generation),
116117
Err(e) => fuse_error!("lookup", reply, e, self, req),
@@ -119,6 +120,7 @@ where
119120

120121
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=ino, name=field::Empty, pid=req.pid()))]
121122
fn getattr(&self, req: &Request<'_>, ino: InodeNo, _fh: Option<u64>, reply: ReplyAttr) {
123+
debug!("New request");
122124
match block_on(self.fs.getattr(ino).in_current_span()) {
123125
Ok(attr) => reply.attr(&attr.ttl, &attr.attr),
124126
Err(e) => fuse_error!("getattr", reply, e, self, req),
@@ -127,11 +129,13 @@ where
127129

128130
#[instrument(level="warn", skip_all, fields(req=_req.unique(), ino, nlookup, name=field::Empty, pid=_req.pid()))]
129131
fn forget(&self, _req: &Request<'_>, ino: u64, nlookup: u64) {
132+
debug!("New request");
130133
block_on(self.fs.forget(ino, nlookup));
131134
}
132135

133136
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=ino, name=field::Empty, pid=req.pid()))]
134137
fn open(&self, req: &Request<'_>, ino: InodeNo, flags: i32, reply: ReplyOpen) {
138+
debug!("New request");
135139
match block_on(self.fs.open(ino, flags.into(), req.pid()).in_current_span()) {
136140
Ok(opened) => reply.opened(opened.fh, opened.flags),
137141
Err(e) => fuse_error!("open", reply, e, self, req),
@@ -150,6 +154,7 @@ where
150154
lock: Option<u64>,
151155
reply: ReplyData,
152156
) {
157+
debug!("New request");
153158
let mut bytes_sent = 0;
154159

155160
match block_on(self.fs.read(ino, fh, offset, size, flags, lock).in_current_span()) {
@@ -166,14 +171,16 @@ where
166171

167172
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=parent, name=field::Empty, pid=req.pid()))]
168173
fn opendir(&self, req: &Request<'_>, parent: InodeNo, flags: i32, reply: ReplyOpen) {
174+
debug!("New request");
169175
match block_on(self.fs.opendir(parent, flags).in_current_span()) {
170176
Ok(opened) => reply.opened(opened.fh, opened.flags),
171177
Err(e) => fuse_error!("opendir", reply, e, self, req),
172178
}
173179
}
174180

175-
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=parent, fh=fh, offset=offset, name=field::Empty, pid=req.pid()))]
181+
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=parent, fh=fh, offset=offset, pid=req.pid()))]
176182
fn readdir(&self, req: &Request<'_>, parent: InodeNo, fh: u64, offset: i64, mut reply: fuser::ReplyDirectory) {
183+
debug!("New request");
177184
struct ReplyDirectory<'a> {
178185
inner: &'a mut fuser::ReplyDirectory,
179186
count: &'a mut usize,
@@ -204,7 +211,7 @@ where
204211
}
205212
}
206213

207-
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=parent, fh=fh, offset=offset, name=field::Empty, pid=req.pid()))]
214+
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=parent, fh=fh, offset=offset, pid=req.pid()))]
208215
fn readdirplus(
209216
&self,
210217
req: &Request<'_>,
@@ -213,6 +220,7 @@ where
213220
offset: i64,
214221
mut reply: fuser::ReplyDirectoryPlus,
215222
) {
223+
debug!("New request");
216224
struct ReplyDirectoryPlus<'a> {
217225
inner: &'a mut fuser::ReplyDirectoryPlus,
218226
count: &'a mut usize,
@@ -252,6 +260,7 @@ where
252260

253261
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=ino, fh=fh, datasync=datasync, name=field::Empty, pid=req.pid()))]
254262
fn fsync(&self, req: &Request<'_>, ino: u64, fh: u64, datasync: bool, reply: ReplyEmpty) {
263+
debug!("New request");
255264
match block_on(self.fs.fsync(ino, fh, datasync).in_current_span()) {
256265
Ok(()) => reply.ok(),
257266
Err(e) => fuse_error!("fsync", reply, e, self, req),
@@ -260,6 +269,7 @@ where
260269

261270
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=ino, fh=fh, name=field::Empty, pid=req.pid()))]
262271
fn flush(&self, req: &Request<'_>, ino: u64, fh: u64, lock_owner: u64, reply: ReplyEmpty) {
272+
debug!("New request");
263273
match block_on(self.fs.flush(ino, fh, lock_owner, req.pid()).in_current_span()) {
264274
Ok(()) => reply.ok(),
265275
Err(e) => fuse_error!("flush", reply, e, self, req),
@@ -277,6 +287,7 @@ where
277287
flush: bool,
278288
reply: ReplyEmpty,
279289
) {
290+
debug!("New request");
280291
match block_on(self.fs.release(ino, fh, flags, lock_owner, flush).in_current_span()) {
281292
Ok(()) => reply.ok(),
282293
Err(e) => fuse_error!("release", reply, e, self, req),
@@ -285,6 +296,7 @@ where
285296

286297
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=ino, fh=fh, name=field::Empty, pid=req.pid()))]
287298
fn releasedir(&self, req: &Request<'_>, ino: u64, fh: u64, flags: i32, reply: ReplyEmpty) {
299+
debug!("New request");
288300
match block_on(self.fs.releasedir(ino, fh, flags).in_current_span()) {
289301
Ok(()) => reply.ok(),
290302
Err(e) => fuse_error!("releasedir", reply, e, self, req),
@@ -302,6 +314,7 @@ where
302314
rdev: u32,
303315
reply: ReplyEntry,
304316
) {
317+
debug!("New request");
305318
// mode_t is u32 on Linux but u16 on macOS, so cast it here
306319
let mode = mode as libc::mode_t;
307320

@@ -313,6 +326,7 @@ where
313326

314327
#[instrument(level="warn", skip_all, fields(req=req.unique(), parent=parent, name=?name, pid=req.pid()))]
315328
fn mkdir(&self, req: &Request<'_>, parent: u64, name: &OsStr, mode: u32, umask: u32, reply: ReplyEntry) {
329+
debug!("New request");
316330
// mode_t is u32 on Linux but u16 on macOS, so cast it here
317331
let mode = mode as libc::mode_t;
318332

@@ -335,6 +349,7 @@ where
335349
lock_owner: Option<u64>,
336350
reply: ReplyWrite,
337351
) {
352+
debug!("New request");
338353
match block_on(
339354
self.fs
340355
.write(ino, fh, offset, data, write_flags, flags, lock_owner)
@@ -351,6 +366,7 @@ where
351366

352367
#[instrument(level="warn", skip_all, fields(req=req.unique(), parent=parent, name=?name, pid=req.pid()))]
353368
fn rmdir(&self, req: &Request<'_>, parent: u64, name: &OsStr, reply: ReplyEmpty) {
369+
debug!("New request");
354370
match block_on(self.fs.rmdir(parent, name).in_current_span()) {
355371
Ok(()) => reply.ok(),
356372
Err(e) => fuse_error!("rmdir", reply, e, self, req),
@@ -359,6 +375,7 @@ where
359375

360376
#[instrument(level="warn", skip_all, fields(req=req.unique(), parent=parent, name=?name, pid=req.pid()))]
361377
fn unlink(&self, req: &Request<'_>, parent: InodeNo, name: &OsStr, reply: ReplyEmpty) {
378+
debug!("New request");
362379
match block_on(self.fs.unlink(parent, name).in_current_span()) {
363380
Ok(()) => reply.ok(),
364381
Err(e) => fuse_error!("unlink", reply, e, self, req),
@@ -384,6 +401,7 @@ where
384401
flags: Option<u32>,
385402
reply: ReplyAttr,
386403
) {
404+
debug!("New request");
387405
let atime = atime.map(|t| match t {
388406
TimeOrNow::SpecificTime(st) => OffsetDateTime::from(st),
389407
TimeOrNow::Now => OffsetDateTime::now_utc(),
@@ -409,6 +427,7 @@ where
409427
flags: u32,
410428
reply: ReplyEmpty,
411429
) {
430+
debug!("New request");
412431
match block_on(
413432
self.fs
414433
.rename(parent, name, newparent, newname, flags.into())
@@ -421,6 +440,7 @@ where
421440

422441
#[instrument(level="warn", skip_all, fields(req=req.unique(), ino=ino, pid=req.pid()))]
423442
fn statfs(&self, req: &Request<'_>, ino: u64, reply: ReplyStatfs) {
443+
debug!("New request");
424444
match block_on(self.fs.statfs(ino).in_current_span()) {
425445
Ok(statfs) => reply.statfs(
426446
statfs.total_blocks,

mountpoint-s3-fuser/src/ll/request.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,19 +2133,19 @@ impl<'a> AnyRequest<'a> {
21332133
}
21342134
}
21352135

2136-
impl Display for AnyRequest<'_> {
2136+
impl fmt::Display for AnyRequest<'_> {
21372137
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21382138
if let Ok(op) = self.operation() {
21392139
write!(
21402140
f,
2141-
"FUSE({:3}) ino {:#018x} {} pid={}",
2142-
self.header.unique, self.header.nodeid, op, self.header.pid
2141+
"FUSE({:3}) ino {:#018x} {}",
2142+
self.header.unique, self.header.nodeid, op
21432143
)
21442144
} else {
21452145
write!(
21462146
f,
2147-
"FUSE({:3}) ino {:#018x} pid={}",
2148-
self.header.unique, self.header.nodeid, self.header.pid
2147+
"FUSE({:3}) ino {:#018x}",
2148+
self.header.unique, self.header.nodeid
21492149
)
21502150
}
21512151
}

0 commit comments

Comments
 (0)