pxar: fuse: optimize fuse readdir callback
The expensive call to Decoder::read_directory_entry() can be omitted as Decoder::attributes() returns all the information the fuse response needs. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
ffe171c5db
commit
9c25c0330a
@ -712,14 +712,9 @@ extern "C" fn readdir(req: Request, inode: u64, size: size_t, offset: c_int, _fi
|
|||||||
|
|
||||||
if offset < n_entries {
|
if offset < n_entries {
|
||||||
for e in gb_table[offset..gb_table.len()].iter() {
|
for e in gb_table[offset..gb_table.len()].iter() {
|
||||||
let entry = ctx
|
let (filename, entry, _, payload_size) =
|
||||||
.decoder
|
|
||||||
.read_directory_entry(e.1, e.2)
|
|
||||||
.map_err(|_| libc::EIO)?;
|
|
||||||
|
|
||||||
let name = CString::new(entry.filename.as_bytes()).map_err(|_| libc::EIO)?;
|
|
||||||
let (_, entry, _, payload_size) =
|
|
||||||
ctx.decoder.attributes(e.1).map_err(|_| libc::EIO)?;
|
ctx.decoder.attributes(e.1).map_err(|_| libc::EIO)?;
|
||||||
|
let name = CString::new(filename.as_bytes()).map_err(|_| libc::EIO)?;
|
||||||
let item_offset = find_offset(&entry, e.1, e.2);
|
let item_offset = find_offset(&entry, e.1, e.2);
|
||||||
let item_inode = calculate_inode(item_offset, ctx.decoder.root_end_offset());
|
let item_inode = calculate_inode(item_offset, ctx.decoder.root_end_offset());
|
||||||
let attr = stat(item_inode, &entry, payload_size).map_err(|_| libc::EIO)?;
|
let attr = stat(item_inode, &entry, payload_size).map_err(|_| libc::EIO)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user