db/update/VirtualDirectory: pass device_id to MakeVirtualDirectoryIfModified()

This commit is contained in:
Max Kellermann 2019-09-03 19:49:32 +02:00
parent a873137702
commit 29fd3172ee
3 changed files with 13 additions and 6 deletions

View File

@ -46,12 +46,11 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
{ {
const ScopeDatabaseLock protect; const ScopeDatabaseLock protect;
contdir = MakeVirtualDirectoryIfModified(directory, name, contdir = MakeVirtualDirectoryIfModified(directory, name,
info); info,
DEVICE_CONTAINER);
if (contdir == nullptr) if (contdir == nullptr)
/* not modified */ /* not modified */
return true; return true;
contdir->device = DEVICE_CONTAINER;
} }
const auto pathname = storage.MapFS(contdir->GetPath()); const auto pathname = storage.MapFS(contdir->GetPath());

View File

@ -23,7 +23,8 @@
Directory * Directory *
UpdateWalk::MakeVirtualDirectoryIfModified(Directory &parent, const char *name, UpdateWalk::MakeVirtualDirectoryIfModified(Directory &parent, const char *name,
const StorageFileInfo &info) noexcept const StorageFileInfo &info,
unsigned virtual_device) noexcept
{ {
Directory *directory = parent.FindChild(name); Directory *directory = parent.FindChild(name);
@ -32,7 +33,9 @@ UpdateWalk::MakeVirtualDirectoryIfModified(Directory &parent, const char *name,
if (directory->IsMount()) if (directory->IsMount())
return nullptr; return nullptr;
if (directory->mtime == info.mtime && !walk_discard) { if (directory->mtime == info.mtime &&
directory->device == virtual_device &&
!walk_discard) {
/* not modified */ /* not modified */
return nullptr; return nullptr;
} }
@ -43,5 +46,6 @@ UpdateWalk::MakeVirtualDirectoryIfModified(Directory &parent, const char *name,
directory = parent.MakeChild(name); directory = parent.MakeChild(name);
directory->mtime = info.mtime; directory->mtime = info.mtime;
directory->device = virtual_device;
return directory; return directory;
} }

View File

@ -141,10 +141,14 @@ private:
* exists already and is unmodified. * exists already and is unmodified.
* *
* The caller must lock the database. * The caller must lock the database.
*
* @param virtual_device one of the DEVICE_* constants
* specifying the kind of virtual directory
*/ */
Directory *MakeVirtualDirectoryIfModified(Directory &parent, Directory *MakeVirtualDirectoryIfModified(Directory &parent,
const char *name, const char *name,
const StorageFileInfo &info) noexcept; const StorageFileInfo &info,
unsigned virtual_device) noexcept;
Directory *DirectoryMakeChildChecked(Directory &parent, Directory *DirectoryMakeChildChecked(Directory &parent,
const char *uri_utf8, const char *uri_utf8,