diff --git a/src/add-ons/kernel/file_systems/btrfs/Volume.cpp b/src/add-ons/kernel/file_systems/btrfs/Volume.cpp index ee2cf118cb..5a86ca2e22 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Volume.cpp @@ -534,6 +534,20 @@ Volume::FindBlock(off_t logical, off_t& physical) } +/* Wrapper function for allocating new block + */ +status_t +Volume::GetNewBlock(uint64& logical, fsblock_t& physical, uint64 start, + uint64 flags) +{ + status_t status = fExtentAllocator->AllocateTreeBlock(logical, start, flags); + if (status != B_OK) + return status; + + return FindBlock(logical, physical); +} + + // #pragma mark - Disk scanning and initialization diff --git a/src/add-ons/kernel/file_systems/btrfs/Volume.h b/src/add-ons/kernel/file_systems/btrfs/Volume.h index 4f9acf52cc..11b4debc3a 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Volume.h +++ b/src/add-ons/kernel/file_systems/btrfs/Volume.h @@ -62,6 +62,9 @@ public: status_t FindBlock(off_t logical, fsblock_t& physical); status_t FindBlock(off_t logical, off_t& physical); + status_t GetNewBlock(uint64& logical, fsblock_t& physical, + uint64 start = (uint64)-1, + uint64 flags = BTRFS_BLOCKGROUP_FLAG_METADATA); private: mutex fLock;