Pass an existing or created transaction to CreateVolumeID(). Hopefully it's correct this time. Axel?
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43056 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -425,8 +425,12 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
|
||||
if (!(fFlags & VOLUME_READ_ONLY)) {
|
||||
Attribute attr(fRootNode);
|
||||
if (attr.Get("be:volume_id") == B_ENTRY_NOT_FOUND)
|
||||
CreateVolumeID();
|
||||
if (attr.Get("be:volume_id") == B_ENTRY_NOT_FOUND) {
|
||||
Transaction transaction(this, fRootNode->BlockNumber());
|
||||
fRootNode->WriteLockInTransaction(transaction);
|
||||
CreateVolumeID(transaction);
|
||||
transaction.Done();
|
||||
}
|
||||
}
|
||||
|
||||
// all went fine
|
||||
@@ -509,7 +513,7 @@ Volume::CreateIndicesRoot(Transaction& transaction)
|
||||
|
||||
|
||||
status_t
|
||||
Volume::CreateVolumeID()
|
||||
Volume::CreateVolumeID(Transaction& transaction)
|
||||
{
|
||||
Attribute attr(fRootNode);
|
||||
status_t status;
|
||||
@@ -525,10 +529,7 @@ Volume::CreateVolumeID()
|
||||
uint64_t id;
|
||||
size_t length = sizeof(id);
|
||||
id = ((uint64_t)rand() << 32) | rand();
|
||||
Transaction transaction(this, fRootNode->BlockNumber());
|
||||
fRootNode->WriteLockInTransaction(transaction);
|
||||
attr.Write(transaction, cookie, 0, (uint8_t *)&id, &length, NULL);
|
||||
transaction.Done();
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -766,7 +767,7 @@ Volume::Initialize(int fd, const char* name, uint32 blockSize,
|
||||
return status;
|
||||
}
|
||||
|
||||
CreateVolumeID();
|
||||
CreateVolumeID(transaction);
|
||||
|
||||
WriteSuperBlock();
|
||||
transaction.Done();
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
|
||||
status_t CreateIndicesRoot(Transaction& transaction);
|
||||
|
||||
status_t CreateVolumeID();
|
||||
status_t CreateVolumeID(Transaction& transaction);
|
||||
|
||||
InodeList& RemovedInodes() { return fRemovedInodes; }
|
||||
// This list is guarded by the transaction lock
|
||||
|
||||
Reference in New Issue
Block a user