1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-18 05:45:45 +02:00

roots: comment updates and general cleanup

Fix discussion of nodatasum files, clarifying what we can and cannot do.

Get rid of some BEESNOTE and BEESTRACE calls which cannot be observed
(well, BEESNOTE can, but you have to be quick!).

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell 2018-01-24 23:42:34 -05:00
parent f6909dac17
commit a3f02d5dec

View File

@ -620,7 +620,6 @@ BeesRoots::open_root_ino_nocache(uint64_t root, uint64_t ino)
// errno == ENOENT is common during snapshot delete, ignore it // errno == ENOENT is common during snapshot delete, ignore it
if (errno != ENOENT) { if (errno != ENOENT) {
BEESLOGWARN("Could not open path '" << file_path << "' at root " << root << " " << name_fd(root_fd) << ": " << strerror(errno)); BEESLOGWARN("Could not open path '" << file_path << "' at root " << root << " " << name_fd(root_fd) << ": " << strerror(errno));
BEESNOTE("ipa" << ipa);
} }
continue; continue;
} }
@ -652,19 +651,28 @@ BeesRoots::open_root_ino_nocache(uint64_t root, uint64_t ino)
break; break;
} }
// As of 4.12 the kernel rejects dedup requests with // The kernel rejects dedup requests with
// src and dst that have different datasum flags. // src and dst that have different datasum flags
// (datasum is a flag in the inode).
// //
// We can't detect those from userspace reliably, but // We can detect the common case where a file is
// we can detect the common case where one file is // marked with nodatacow (which implies nodatasum).
// marked with the nodatasum (which implies nodatacow) // nodatacow files are arguably out of scope for dedup,
// on a filesystem that is mounted with datacow. // since dedup would just make them datacow again.
// These are arguably out of scope for dedup. // To handle these we pretend we couldn't open them.
// //
// To fix this properly, we have to keep track of which // A less common case is nodatasum + datacow files.
// pairs of inodes failed to dedup, guess that the reason // Those are availble for dedup but we have to solve
// for failure was a mismatch of datasum flags, and // some other problems before we can dedup them. They
// create temporary files with the right flags somehow. // require a separate hash table namespace from datasum
// + datacow files, and we have to create nodatasum
// temporary files when we rewrite extents.
//
// FIXME: the datasum flag is scooped up by
// TREE_SEARCH_V2 during crawls. We throw the inode
// items away when we should be examining them for the
// nodatasum flag.
int attr = ioctl_iflags_get(rv); int attr = ioctl_iflags_get(rv);
if (attr & FS_NOCOW_FL) { if (attr & FS_NOCOW_FL) {
BEESLOGWARN("Opening " << name_fd(rv) << " found FS_NOCOW_FL flag in " << to_hex(attr)); BEESLOGWARN("Opening " << name_fd(rv) << " found FS_NOCOW_FL flag in " << to_hex(attr));
@ -673,8 +681,6 @@ BeesRoots::open_root_ino_nocache(uint64_t root, uint64_t ino)
break; break;
} }
BEESTRACE("mapped " << BeesFileId(root, ino));
BEESTRACE("\tto " << name_fd(rv));
BEESCOUNT(open_hit); BEESCOUNT(open_hit);
return rv; return rv;
} }