History log of /haiku/src/add-ons/kernel/file_systems/btrfs/BTree.cpp
Revision Date Author Comments
# bb2b9b02 24-Jun-2023 Niels Sascha Reedijk <niels.reedijk@gmail.com>

btrfs: use global namespace

The module includes the C-style header file, thus all members are added in the
global namespace.

Change-Id: I5e82c8520b0495e3c437c43cfeea9cc454d39482
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6653
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# cddaf762 25-Jan-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

btrfs: fix build.


# c5e9dd9b 10-Jan-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Fix btrfs_shell build

The hacks to still use actual system headers for zlib didn't quite work.

- Define Z_SOLO, which makes zlib build without any system include
- Remove use of std::max and #include <algorithm> from AVLTree
- Do not include DebugSupport.h because it uses system headers
- Do not include uuid.h and define just what we need

Now it's possible to compile the btrfs_shell on Linux.

Change-Id: I74a14b5f6804db45ab5a9f582ab493d696376fd3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2098
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# b951cbd3 28-May-2019 brjhaiku <brjhaiku@gmail.com>

btrfs: documented BTree class (no functional change)

Change-Id: Ib3d6247bf99fc520ba063c361a7b465224805610


# f10ebdb1 13-Mar-2019 brjhaiku <brjhaiku@gmail.com>

btrfs

* Fixed coding style for all files under /src/add-ons/kernel/file_systems/btrfs
* rewrote crc_table.cpp to generate CRCTable.cpp that conforms to coding style.

Change-Id: I90fcc143320c7a7e9a6dc174f0ad82f40bb8a9b6
Reviewed-on: https://review.haiku-os.org/c/1194
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# cd6365c7 17-May-2018 Jérôme Duval <jerome.duval@gmail.com>

style fixes


# 690d16c6 15-Dec-2017 hyche <cvghy116@gmail.com>

btrfs: Add error log for _Find()


# ce029df2 14-Dec-2017 hyche <cvghy116@gmail.com>

btrfs: Fix wrong function name in log error


# 5686d4e1 14-Dec-2017 hyche <cvghy116@gmail.com>

btrfs: Init status, prevent from unitialized check


# b568492f 14-Dec-2017 hyche <cvghy116@gmail.com>

btrfs: Make SearchSlot() look cleaner


# 52850062 10-Dec-2017 Augustin Cavalier <waddlesplash@gmail.com>

btrfs: Attempt to fix GCC2 build.


# 99768086 29-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Add author and license.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 20185bb9 28-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Implement RemoveEntries() for BTree that will remove consecutive items and its data.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 84bc447c 28-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Implement InsertEntries() that will insert consecutive items and its data.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 883b9bf2 23-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Implement CopyOnWrite relevant functions, and BTree holds new attribute that record its root level.

CopyOnWrite works like this:
* Cache original node
* Allocating new block
* Cache new block to be writable
* Copy original node to new node, and changing.
Also if a node is already be COW-ed it cannot be COW-ed again, it will be changed in-place instead.

InternalCopy does CopyOnWrite all the nodes that we don't need to change anything on them.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 89484dc0 23-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Implement some copy relevant helpers.

Copy() copys data from other node, MoveEntries() changes data on the current node.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 27ffe058 23-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Implement some space relevant helpers.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# bfd7a4fb 12-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Reimplement TreeIterator, add some error checks and remove redundancies.

Add BTree::Path as a attribute so enhance performance, so that everytime we iterate through items it wont search all the root to leaf
again. The Iterator is initialized without rewinding to make more flexible.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 3216460d 12-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Implement BTree::Path and change _Find.

Remove attribute fCurrentSlot in BTree::Node as it will be handled by Path explicitly. BTree control Path by passing its type in
BTree's method, Path also hold BTree type as its attribute to do some internal actions.
Add constant BTREE_KEY_TYPE_ANY, find search key has this type will success regardless of the found key's type.

Split the the _Find function into Traverse and GetEntry. Traverse will fill in the Path (nodes and slots) along way its finding,
GetEntry will get the item data, item size, key from leaf, if the slot is valid, that we have from Traverse. The _Find function also
check type if is correct and then retrieve. Doing this way there will be more flexible, the "read" flag is not needed as we only
need Path to manipulate tree, and it also enhance the performance at some points, because Path caches all the nodes from root to leaf,
so that we don't have to block_cache_put and block_cache_get after each finding.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 8160f31f 16-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Node now holding Volume instead of cache to retrieve more values

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 16de9db5 12-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Fix mismatched type of item size (should be uint32), and ObjectID of first subvolume when lookup directory (described in commit bd2dab1)

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 2ed88a48 05-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Fix node search slot

* Not handle traversing type correctly (looks for the graph).
* Reorder the codes because *slot is uninitialized if type is BTREE_EXACT.
* Incorrect return type: int32 -> status_t

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 46eba5c0 04-Jul-2017 hyche <cvghy116@gmail.com>

BTRFS: Some modifications of BTree _Find

* Added "read" argument, may change variable type in the future instead of just bool variable.
* Now search key's objectId is changed to found key's objectId.


# 370ee09f 26-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: Added logical address (root) for BTree


# 548a0d80 26-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: rename BNode and BPath

Changed name BNode, BPath to Node, Path and move them into BTree
as the original names are already exist in Haiku Storage Kit.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 35a5e5ad 23-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: Combine BNode and _Find

* Replaced fStream by BNode, this might fix errors when handling BTree with multiple levels because fStream remains at leaf after first allocating.
* Changed search algorithm for items (linear search -> binary search)

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 0d726c5c 23-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: Enhanced node search slot to handle btree_traverse type

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# fc4a1e78 22-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: Added SetRoot for tree. Tree root is initialized at mount time

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 7568abd5 22-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: BlockNum -> LogicalAddress to prevent misunderstanding

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 91d7f850 18-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: Added binary search for item slot

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 1481c49c 15-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: Initialize BPath and BNode for tree manipulation

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 875a0552 14-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: Method _Compare from BTree is now in btrfs_key

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# d87124ef 09-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: Refix ticket #12788

* Change block size to node size. Block is not always the same as sector.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 299aba38 09-Jun-2017 hyche <cvghy116@gmail.com>

BTRFS: code cleanups

* Removed struct keyword for declaring variable.
* Renamed BPlusTree to BTree because BtrFS use a variant of BTree not B+Tree.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>