BFS: Don't send duplicate attribute change notifications to queries on renames.
LiveUpdateRenameMove() sends create/remove notifications, so we don't want to send duplicate ones in the LiveUpdate() hook.
This commit is contained in:
@@ -219,7 +219,7 @@ Index::Create(Transaction& transaction, const char* name, uint32 type)
|
|||||||
status_t
|
status_t
|
||||||
Index::Update(Transaction& transaction, const char* name, int32 type,
|
Index::Update(Transaction& transaction, const char* name, int32 type,
|
||||||
const uint8* oldKey, uint16 oldLength, const uint8* newKey,
|
const uint8* oldKey, uint16 oldLength, const uint8* newKey,
|
||||||
uint16 newLength, Inode* inode)
|
uint16 newLength, Inode* inode, bool updateLiveQueries)
|
||||||
{
|
{
|
||||||
if (name == NULL
|
if (name == NULL
|
||||||
|| (oldKey == NULL && newKey == NULL)
|
|| (oldKey == NULL && newKey == NULL)
|
||||||
@@ -242,9 +242,11 @@ Index::Update(Transaction& transaction, const char* name, int32 type,
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update all live queries about the change, if they have an index or not
|
if (updateLiveQueries) {
|
||||||
fVolume->UpdateLiveQueries(inode, name, type, oldKey, oldLength,
|
// update all live queries about the change, if they have an index or not
|
||||||
newKey, newLength);
|
fVolume->UpdateLiveQueries(inode, name, type, oldKey, oldLength,
|
||||||
|
newKey, newLength);
|
||||||
|
}
|
||||||
|
|
||||||
if (((name != fName || strcmp(name, fName)) && SetTo(name) != B_OK)
|
if (((name != fName || strcmp(name, fName)) && SetTo(name) != B_OK)
|
||||||
|| fNode == NULL)
|
|| fNode == NULL)
|
||||||
@@ -297,14 +299,14 @@ Index::RemoveName(Transaction& transaction, const char* name, Inode* inode)
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
Index::UpdateName(Transaction& transaction, const char* oldName,
|
Index::UpdateName(Transaction& transaction, const char* oldName,
|
||||||
const char* newName, Inode* inode)
|
const char* newName, Inode* inode, bool updateLiveQueries)
|
||||||
{
|
{
|
||||||
ASSERT(inode->IsRegularNode());
|
ASSERT(inode->IsRegularNode());
|
||||||
|
|
||||||
uint16 oldLength = oldName != NULL ? strlen(oldName) : 0;
|
uint16 oldLength = oldName != NULL ? strlen(oldName) : 0;
|
||||||
uint16 newLength = newName != NULL ? strlen(newName) : 0;
|
uint16 newLength = newName != NULL ? strlen(newName) : 0;
|
||||||
return Update(transaction, "name", B_STRING_TYPE, (uint8*)oldName,
|
return Update(transaction, "name", B_STRING_TYPE, (uint8*)oldName,
|
||||||
oldLength, (uint8*)newName, newLength, inode);
|
oldLength, (uint8*)newName, newLength, inode, updateLiveQueries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ public:
|
|||||||
status_t Update(Transaction& transaction, const char* name,
|
status_t Update(Transaction& transaction, const char* name,
|
||||||
int32 type, const uint8* oldKey,
|
int32 type, const uint8* oldKey,
|
||||||
uint16 oldLength, const uint8* newKey,
|
uint16 oldLength, const uint8* newKey,
|
||||||
uint16 newLength, Inode* inode);
|
uint16 newLength, Inode* inode,
|
||||||
|
bool updateLiveQueries = true);
|
||||||
|
|
||||||
status_t InsertName(Transaction& transaction,
|
status_t InsertName(Transaction& transaction,
|
||||||
const char* name, Inode* inode);
|
const char* name, Inode* inode);
|
||||||
@@ -40,7 +41,7 @@ public:
|
|||||||
const char* name, Inode* inode);
|
const char* name, Inode* inode);
|
||||||
status_t UpdateName(Transaction& transaction,
|
status_t UpdateName(Transaction& transaction,
|
||||||
const char* oldName, const char* newName,
|
const char* oldName, const char* newName,
|
||||||
Inode* inode);
|
Inode* inode, bool updateLiveQueries = true);
|
||||||
|
|
||||||
status_t InsertSize(Transaction& transaction, Inode* inode);
|
status_t InsertSize(Transaction& transaction, Inode* inode);
|
||||||
status_t RemoveSize(Transaction& transaction, Inode* inode);
|
status_t RemoveSize(Transaction& transaction, Inode* inode);
|
||||||
|
|||||||
@@ -1299,7 +1299,8 @@ bfs_rename(fs_volume* _volume, fs_vnode* _oldDir, const char* oldName,
|
|||||||
status = inode->SetName(transaction, newName);
|
status = inode->SetName(transaction, newName);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
Index index(volume);
|
Index index(volume);
|
||||||
index.UpdateName(transaction, oldName, newName, inode);
|
index.UpdateName(transaction, oldName, newName, inode,
|
||||||
|
false /* we already updated live queries, above */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user