If the underline filesystem doesn't support FIEMAP, use the inode instead of the physical offset.

This commit is contained in:
Andrea Mazzoleni 2013-09-17 23:31:42 +02:00
parent a3d939d024
commit ca3f5c1c5d
2 changed files with 13 additions and 0 deletions

View file

@ -1,6 +1,11 @@
SnapRAID HISTORY
================
4.1 2013/9
==========
* If the underline filesystem doesn't support the FIEMAP command,
fallback to use the inode number for sorting files.
4.0 2013/9
==========
* New 'scrub' command to periodically check the oldest blocks for silent

8
unix.c
View file

@ -147,6 +147,14 @@ int filephy(const char* path, struct stat* st, uint64_t* physical)
fm.fiemap.fm_extent_count = 1; /* we are interested only at the first block */
if (ioctl(f, FS_IOC_FIEMAP, &fm) == -1) {
/* if the underline filesystem doesn't support FS_IOC_FIEMAP */
/* fallback to use the inode */
if (errno == ENOTSUP) {
close(f);
*physical = st->st_ino;
return 0;
}
close(f);
return -1;
}