mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
If the underline filesystem doesn't support FIEMAP, use the inode instead of the physical offset.
This commit is contained in:
parent
194846f01b
commit
f31e4f229d
2 changed files with 13 additions and 0 deletions
5
HISTORY
5
HISTORY
|
|
@ -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
8
unix.c
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue