BTRFS: Implement Remove() in Inode that removes inode_item.

Signed-off-by: Augustin Cavalier <[email protected]>
This commit is contained in:
hyche
2017-12-10 11:03:02 -05:00
committed by Augustin Cavalier
parent b44d924df4
commit 8042a045b0
2 changed files with 19 additions and 0 deletions
@@ -411,6 +411,24 @@ Inode::Insert(Transaction& transaction, BTree::Path* path)
}
/* Remove inode_item
*/
status_t
Inode::Remove(Transaction& transaction, BTree::Path* path)
{
BTree* tree = path->Tree();
btrfs_key key;
key.SetObjectID(fID);
key.SetType(BTRFS_KEY_TYPE_INODE_ITEM);
key.SetOffset(0);
status_t status = tree->RemoveEntries(transaction, path, key, NULL, 1);
if (status != B_OK)
return status;
return B_OK;
}
/* Insert 3 items: inode_ref, dir_item, dir_index
* Basically, make a link between name and its node (location)
*/
@@ -73,6 +73,7 @@ public:
Inode* parent, int32 mode, uint64 size = 0,
uint64 flags = 0);
status_t Insert(Transaction& transaction, BTree::Path* path);
status_t Remove(Transaction& transaction, BTree::Path* path);
status_t MakeReference(Transaction& transaction, BTree::Path* path,
Inode* parent, const char* name, int32 mode);
private: