mirror of
https://github.com/Zygo/bees.git
synced 2025-05-18 13:55:44 +02:00
Skip nocow files to speed up processing
If you have a lot of or a few big nocow files (like vm images) which contain a lot of potential deduplication candidates, bees becomes incredibly slow running through a lot "invalid operation" exceptions. Let's just skip over such files to get more bang for the buck. I did no regression testing as this patch seems trivial (and I cannot imagine any pitfalls either). The process progresses much faster for me now.
This commit is contained in:
parent
cc7b4f22b5
commit
2dc027c701
@ -13,6 +13,10 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
// ioctl
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <linux/fs.h>
|
||||||
|
|
||||||
// socket
|
// socket
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
@ -141,6 +145,8 @@ namespace crucible {
|
|||||||
Stat &lstat(const string &filename);
|
Stat &lstat(const string &filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int ioctl_iflags_get(int fd);
|
||||||
|
|
||||||
string st_mode_ntoa(mode_t mode);
|
string st_mode_ntoa(mode_t mode);
|
||||||
|
|
||||||
// Because it's not trivial to do correctly
|
// Because it's not trivial to do correctly
|
||||||
|
@ -488,6 +488,14 @@ namespace crucible {
|
|||||||
lstat(filename);
|
lstat(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ioctl_iflags_get(int fd)
|
||||||
|
{
|
||||||
|
int attr = 0;
|
||||||
|
DIE_IF_MINUS_ONE(ioctl(fd, FS_IOC_GETFLAGS, &attr));
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
readlink_or_die(const string &path)
|
readlink_or_die(const string &path)
|
||||||
{
|
{
|
||||||
|
@ -495,6 +495,14 @@ BeesRoots::open_root_ino_nocache(uint64_t root, uint64_t ino)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int attr = ioctl_iflags_get(rv);
|
||||||
|
if (attr & FS_NOCOW_FL) {
|
||||||
|
BEESLOG("Opening " << name_fd(root_fd) << "/" << file_path << " found incompatible flags " << attr << " (FS_NOCOW_FL)");
|
||||||
|
rv = Fd();
|
||||||
|
BEESCOUNT(open_wrong_flags);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Correct root?
|
// Correct root?
|
||||||
auto file_root = btrfs_get_root_id(rv);
|
auto file_root = btrfs_get_root_id(rv);
|
||||||
if (file_root != root) {
|
if (file_root != root) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user