Skip to contentSkip to conversation

Purpose of block reserves

DISCUSSION Arne Jansen 1 participant 2 messages Dec 9, 2010 – Dec 10, 2010 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi,

while reading btrfs source code, I try to make sense of the various uses of block reserves. The working theory is as follows:

1. Every operation has to reserve upfront every single byte it needs to complete its operation fully.
2. If an operation cannot determine how much space it will need, it has to be able to cope with running out of space. Normally it does it by inserting an orphan item, doing its work in multiple transactions and removing the orphan item. The commits in between normally free up enough space to continue the operation.
3. All other enospc situations are errors in program logic and should result in BUG_ON.

It would be great of someone with a deeper knowledge could correct, expand or just confirm this.

Thanks,
Arne

#1 lore raw
Quoted 3 lines · Arne Jansen

while reading btrfs source code, I try to make sense of the various uses of block reserves. The working theory is as follows:

Since there have been no protests, I added this information to the wiki, section "Code documentation".

--
Arne

Quoted 17 lines

1. Every operation has to reserve upfront every single byte it needs to complete its operation fully.
2. If an operation cannot determine how much space it will need, it has to be able to cope with running out of space. Normally it does it by inserting an orphan item, doing its work in multiple transactions and removing the orphan item. The commits in between normally free up enough space to continue the operation.
3. All other enospc situations are errors in program logic and should result in BUG_ON.

It would be great of someone with a deeper knowledge could correct, expand or just confirm this.

Thanks,
Arne
--