mirror of
https://github.com/Zygo/bees.git
synced 2025-07-06 10:32:25 +02:00
tempfile: don't need to update the inode if the flags don't change
A small performance optimization, given that we are constantly clobbering the file with new content. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -509,10 +509,14 @@ BeesTempFile::resize(off_t offset)
|
|||||||
// and we don't open FS_NOCOW_FL files for dedupe.
|
// and we don't open FS_NOCOW_FL files for dedupe.
|
||||||
BEESTRACE("Getting FS_COMPR_FL and FS_NOCOMP_FL on m_fd " << name_fd(m_fd));
|
BEESTRACE("Getting FS_COMPR_FL and FS_NOCOMP_FL on m_fd " << name_fd(m_fd));
|
||||||
int flags = ioctl_iflags_get(m_fd);
|
int flags = ioctl_iflags_get(m_fd);
|
||||||
|
const auto orig_flags = flags;
|
||||||
|
|
||||||
flags |= FS_COMPR_FL;
|
flags |= FS_COMPR_FL;
|
||||||
flags &= ~(FS_NOCOMP_FL | FS_NOCOW_FL);
|
flags &= ~(FS_NOCOMP_FL | FS_NOCOW_FL);
|
||||||
BEESTRACE("Setting FS_COMPR_FL and clearing FS_NOCOMP_FL | FS_NOCOW_FL on m_fd " << name_fd(m_fd) << " flags " << to_hex(flags));
|
if (flags != orig_flags) {
|
||||||
ioctl_iflags_set(m_fd, flags);
|
BEESTRACE("Setting FS_COMPR_FL and clearing FS_NOCOMP_FL | FS_NOCOW_FL on m_fd " << name_fd(m_fd) << " flags " << to_hex(flags));
|
||||||
|
ioctl_iflags_set(m_fd, flags);
|
||||||
|
}
|
||||||
|
|
||||||
// That may have queued some delayed ref deletes, so throttle them
|
// That may have queued some delayed ref deletes, so throttle them
|
||||||
bees_throttle(resize_timer.age(), "tmpfile_resize");
|
bees_throttle(resize_timer.age(), "tmpfile_resize");
|
||||||
|
Reference in New Issue
Block a user