All of lore.kernel.org
 help / color / mirror / Atom feed
* Purpose of block reserves
@ 2010-12-09  8:34 Arne Jansen
  2010-12-10  8:37 ` Arne Jansen
  0 siblings, 1 reply; 2+ messages in thread
From: Arne Jansen @ 2010-12-09  8:34 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yanzheng

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Purpose of block reserves
  2010-12-09  8:34 Purpose of block reserves Arne Jansen
@ 2010-12-10  8:37 ` Arne Jansen
  0 siblings, 0 replies; 2+ messages in thread
From: Arne Jansen @ 2010-12-10  8:37 UTC (permalink / raw)
  To: linux-btrfs; +Cc: yanzheng

Arne Jansen wrote:
> 
> 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

> 
> 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
> --

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-10  8:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-09  8:34 Purpose of block reserves Arne Jansen
2010-12-10  8:37 ` Arne Jansen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.