Skip to content
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

crc = "1.4"
flate2 = "0.2"
ioctl = "0.3"
nix = "0.8.1"
lazy_static = "0.2"
libc = "0.2"
minilzo = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#![ allow (unused_parens) ]

#[ macro_use ]
extern crate ioctl;
extern crate nix;

#[ macro_use ]
extern crate lazy_static;
Expand Down
4 changes: 2 additions & 2 deletions src/linux/operations/deduplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ pub fn deduplicate_range (

};

if file_dedupe_range_result != 0 {
if let Err(e) = file_dedupe_range_result {

return Err (
format! (
"Dedupe ioctl returned {}",
file_dedupe_range_result)
e)
);

}
Expand Down
17 changes: 6 additions & 11 deletions src/linux/operations/defragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,14 @@ pub fn defragment_range (
)
};

if ioctl_result != 0 {

return Err (
format! (
match ioctl_result {
Ok(_) => Ok(()),
Err(e) => {
Err(format! (
"Defragment IOCTL returned {}",
ioctl_result));

e))
}
}

// return ok

Ok (())

}

// ex: noet ts=4 filetype=rust
11 changes: 8 additions & 3 deletions src/linux/operations/fiemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@ pub fn get_file_extent_map (

if extent_count != 0 {

let mapped_count = c_file_extent_map.info.mapped_extents as usize;
// file without extents, e.g. due to delayed allocation
if mapped_count == 0 {
break;
}

let last_mapped_extent =
c_file_extent_map.extents [
c_file_extent_map.info.mapped_extents as usize - 1];
c_file_extent_map.extents [mapped_count - 1];

if last_mapped_extent.flags & FIEMAP_EXTENT_LAST != 0 {
break;
Expand Down Expand Up @@ -178,7 +183,7 @@ fn get_c_file_extent_map (

};

if fiemap_result != 0 {
if let Err(e) = fiemap_result {

return Err (
"Error getting file extent map".to_string ()
Expand Down
4 changes: 2 additions & 2 deletions src/linux/operations/filesystem_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn get_filesystem_info (

};

if get_fs_info_result != 0 {
if let Err(e) = get_fs_info_result {

return Err (
"Error getting btrfs filesystem information".to_string ()
Expand Down Expand Up @@ -77,7 +77,7 @@ pub fn get_device_info (

};

if get_dev_info_result != 0 {
if let Err(e) = get_dev_info_result {

match io::Error::last_os_error ().raw_os_error () {

Expand Down
2 changes: 1 addition & 1 deletion src/linux/operations/space_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn get_c_space_info (
c_space_args as * mut IoctlSpaceArgs)
};

if get_space_args_real_result != 0 {
if let Err(e) = get_space_args_real_result {

return Err (
"Error getting btrfs space information".to_string ()
Expand Down