diff --git a/HISTORY b/HISTORY index 8f670868..3720ce55 100644 --- a/HISTORY +++ b/HISTORY @@ -4,8 +4,7 @@ SnapRAID HISTORY 4.1 2013/9 ========== * If the underline filesystem doesn't support the FIEMAP command, - automatically fallback to use FIBMAP and then the inode number for sorting - files. + automatically fallback to use FIBMAP for sorting files. * Fixes the import of content files from previous version of SnapRAID that are the result of an incomplete sync. * Added a new -C, --gen-conf option to generate a dummy configuration diff --git a/unix.c b/unix.c index f60b9d07..9033667d 100644 --- a/unix.c +++ b/unix.c @@ -141,14 +141,14 @@ int filephy(const char* path, struct stat* st, uint64_t* physical) } /* first try with FIEMAP */ - /* if works for ext2, ext3, ext4, xfs */ + /* if works for ext2, ext3, ext4, xfs, btrfs */ memset(&fm, 0, sizeof(fm)); fm.fiemap.fm_start = 0; fm.fiemap.fm_length = ~0ULL; fm.fiemap.fm_flags = FIEMAP_FLAG_SYNC; /* required to ensure that just created files report a valid address and not 0 */ fm.fiemap.fm_extent_count = 1; /* we are interested only at the first block */ - if (ioctl(f, FS_IOC_FIEMAP, &fm) == 0) { + if (ioctl(f, FS_IOC_FIEMAP, &fm) != -1) { *physical = fm.fiemap.fm_extents[0].fe_physical; if (close(f) == -1) return -1; @@ -167,7 +167,7 @@ int filephy(const char* path, struct stat* st, uint64_t* physical) /* it works for jfs, reiserfs, ntfs-3g */ /* in exfat it always returns 0, that it's anyway better than the fake inodes */ blknum = 0; /* first block */ - if (ioctl(f, FIBMAP, &blknum) == 0) { + if (ioctl(f, FIBMAP, &blknum) != -1) { *physical = blknum; if (close(f) == -1) return -1;