summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@inai.de>2012-08-18 00:07:59 +0200
committerArne Jansen <sensille@gmx.net>2012-08-20 10:00:41 +0200
commitaaa392568d9b4f9ef3cbf1a15500e2826d24c7b4 (patch)
treed9f84c42fd9c9fb7dd89a17f670128b1baf0079e
parentff524a2de41ba5d8a0604e858dfd4ad04b9ac95f (diff)
downloadqgroups-doc-aaa392568d9b4f9ef3cbf1a15500e2826d24c7b4.tar.gz
Grammatical and typographical corrections, orthographic suggestionsHEADmaster
- grammar fixes (dashes, comma placement) - typesetting (apply spaces as per LyX manual; monospace font for variable, directory names, etc.) - casing (unix -> Unix) - dissolution of contractions (not used in written style) - word replacement suggestions
-rw-r--r--quota.lyx563
-rw-r--r--quota.pdfbin167283 -> 278741 bytes
2 files changed, 422 insertions, 141 deletions
diff --git a/quota.lyx b/quota.lyx
index 70c3f54..e843384 100644
--- a/quota.lyx
+++ b/quota.lyx
@@ -1,42 +1,60 @@
-#LyX 1.6.7 created this file. For more info see http://www.lyx.org/
-\lyxformat 345
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
\begin_document
\begin_header
\textclass article
\use_default_options true
+\maintain_unincluded_children false
\language english
+\language_package default
\inputencoding auto
+\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
+\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
\paperfontsize default
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
\cite_engine basic
\use_bibtopic false
+\use_indices false
\paperorientation portrait
+\suppress_date false
+\use_refstyle 0
+\index Index
+\shortcut idx
+\color #008000
+\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
-\defskip medskip
+\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
-\author ""
-\author ""
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
\end_header
\begin_body
@@ -58,16 +76,24 @@ Subvolume Quota Concepts
\end_layout
\begin_layout Standard
-The concept of quota has a long standing tradition in the unix world.
+The concept of quota has a long-standing tradition in the Unix world.
Ever since computers allow multiple users to work simultaneously in one
- filesystem, there's the need to prevent one user from using up the full
+ filesystem, there is the need to prevent one user from using up the entire
space.
Every user should get his fair share of the available resources.
\end_layout
\begin_layout Standard
-In case of files the solution is quite straightforward.
- Each file has an 'owner' recorded along with it, and it has a size.
+In case of files, the solution is quite straightforward.
+ Each file has an
+\begin_inset Quotes eld
+\end_inset
+
+owner
+\begin_inset Quotes erd
+\end_inset
+
+ recorded along with it, and it has a size.
Traditional quota just restricts the total size of all files that are owned
by a user.
The concept is quite flexible: if a user hits his quota limit, the administrato
@@ -75,14 +101,30 @@ r can raise it on the fly.
\end_layout
\begin_layout Standard
-On the other hand the traditional approach has only a poor solution to restrict
- directories.
- At installation time the harddisk can be partitioned so that every directory
- (e.g.
- /usr, /var, ...) that needs a limit gets its own partition.
- The obvious problem is, that those limits can't be changed without a reinstall.
+On the other hand, the traditional approach has only a poor solution to
+ restrict directories.
+ At installation time, the harddisk can be partitioned so that every directory
+ (e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.
+\begin_inset space \space{}
+\end_inset
+
+
+\family typewriter
+/usr
+\family default
+,
+\family typewriter
+/var
+\family default
+, ...) that needs a limit gets its own partition.
+ The obvious problem is, that those limits cannot be changed without a reinstall
+ation.
The btrfs subvolume feature builds a bridge.
- Subvolumes correspond in many ways to partitions as every subvolume looks
+ Subvolumes correspond in many ways to partitions, as every subvolume looks
like its own filesystem.
With subvolume quota, it is now possible to restrict each subvolume like
a partition, but keep the flexibility of quota.
@@ -104,7 +146,7 @@ As subvolumes are the basis for snapshots, interesting questions arise as
Btrfs subvolume quota solves these problems by introducing groups of subvolumes
and let the user put limits on them.
It is even possible to have groups of groups.
- In the following we refer to them as
+ In the following, we refer to them as
\begin_inset Quotes eld
\end_inset
@@ -138,9 +180,24 @@ Subvolume Quota Groups
\begin_layout Standard
The basic notion of the Subvolume Quota feature is the qouta group, short
qgroup.
- Qgroups are notated as <level>/<id>, e.g.
- the qgroup 3/2 is a qgroup of level 3.
- For level 0 the leading
+ Qgroups are notated as <level>/<id>, e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.
+\begin_inset space \space{}
+\end_inset
+
+the qgroup 3/2 is a qgroup of level
+\begin_inset space ~
+\end_inset
+
+3.
+ For level
+\begin_inset space ~
+\end_inset
+
+0, the leading
\begin_inset Quotes eld
\end_inset
@@ -149,8 +206,11 @@ The basic notion of the Subvolume Quota feature is the qouta group, short
\end_inset
can be omitted.
- Qgroups of level 0 get created automatically when a subvolume/snapshot
- gets created.
+ Qgroups of level
+\begin_inset space ~
+\end_inset
+
+0 get created automatically when a subvolume/snapshot gets created.
The ID of the qgroup corresponds to the ID of the subvolume, so 0/5 is
the qgroup for the root subvolume.
For the
@@ -168,7 +228,11 @@ btrfs qgroup
\begin_layout Standard
Each qgroup can contain a set of lower level qgroups, thus creating a hierarchy
of qgroups.
- Figure
+ Figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Sample-qgroup-hierarchy"
@@ -212,7 +276,7 @@ Sample qgroup hierarchy
\end_inset
shows an example qgroup tree.
- At the bottom some extents are depicted showing which qgroups reference
+ At the bottom, some extents are depicted showing which qgroups reference
which extents.
It is important to understand the notion of
\emph on
@@ -223,22 +287,36 @@ referenced
exclusive
\emph default
.
- In the example qgroup 0/2 references extents 2 and 3, while 1/2 references
- extents 2-4.
+ In the example, qgroup 0/2 references extents 2 and 3, while 1/2 references
+ extents 2--4.
2/1 references all extents.
\end_layout
\begin_layout Standard
-On the other hand, extent 1 is exclusive to 0/1, extent 2 is exclusive to
- 0/2, while extent 3 is neither exclusive to 0/2 nor to 0/3.
- But because both references can be reached from 1/2, extent 3 is exclusive
- to 1/2.
+On the other hand, extent
+\begin_inset space ~
+\end_inset
+
+1 is exclusive to 0/1, extent
+\begin_inset space ~
+\end_inset
+
+2 is exclusive to 0/2, while extent
+\begin_inset space ~
+\end_inset
+
+3 is neither exclusive to 0/2 nor to 0/3.
+ But because both references can be reached from 1/2, extent
+\begin_inset space ~
+\end_inset
+
+3 is exclusive to 1/2.
All extents are exclusive to 2/1.
So
\emph on
exclusive
\emph default
- doesn't mean there's no other way to reach the extent, but it does mean
+ does not mean there is no other way to reach the extent, but it does mean
that if you delete all subvolumes contained in a qgroup, the extent will
get deleted.
@@ -251,18 +329,25 @@ Exclusive
\begin_layout Standard
All data extents are accounted this way.
- Metadata that belong to a specific subvolume (i.e.
- its fs tree) are also accounted.
+ Metadata that belongs to a specific subvolume (i.
+\begin_inset space \space{}
+\end_inset
+
+e.
+\begin_inset space \space{}
+\end_inset
+
+its filesystem tree) is also accounted.
Checksums and extent allocation information are not accounted.
\end_layout
\begin_layout Standard
-In turn the
+In turn, the
\emph on
referenced
\emph default
count of a qgroup can be limited.
- All writes beyond that limit will lead to a
+ All writes beyond this limit will lead to a
\begin_inset Quotes eld
\end_inset
@@ -288,12 +373,16 @@ Things get a bit more complicated when new subvolumes or snapshots are created.
\begin_layout Standard
Creation of a snapshot is the hard case.
- Obviously the snapshot will reference the exact amount of space as its
+ Obviously, the snapshot will reference the exact amount of space as its
source, and both source and destination now have an
\emph on
exclusive
\emph default
- count of 0 (4k to be precise, as the roots of the trees are not shared).
+ count of 0 (4
+\begin_inset space \thinspace{}
+\end_inset
+
+kB to be precise, as the roots of the trees are not shared).
But what about qgroups of higher levels? If the qgroup contains both the
source and the destination, nothing changes.
If the qgroup contains only the source, it might lose some
@@ -313,17 +402,17 @@ exclusive
\begin_inset Quotes erd
\end_inset
-, but that's wrong, or at least not enough.
- There could have been an extent that's referenced from the source and another
- subvolume from that qgroup.
+, but that is wrong, or at least not enough.
+ There could have been an extent that is referenced from the source and
+ another subvolume from that qgroup.
This extent would have been exclusive to the qgroup, but not to the source
subvolume.
- With the creation of the snapshot the qgroup would also lose this extent
+ With the creation of the snapshot, the qgroup would also lose this extent
from its exclusive set.
\end_layout
\begin_layout Standard
-So how can this problem be solved? In the instant the snapshot gets created
+So how can this problem be solved? In the instant the snapshot gets created,
we already have to know the correct
\emph on
exclusive
@@ -346,7 +435,7 @@ Use Cases
\end_layout
\begin_layout Subsection
-single-user machine
+Single-user machine
\end_layout
\begin_layout Subsubsection
@@ -355,8 +444,23 @@ Replacement for partitions
\begin_layout Standard
The simplest use case is to use qgroups as simple replacement for partitions.
- Btrfs takes the disk as a whole, and /, /usr, /var etc.
- are created as subvolumes.
+ Btrfs takes the disk as a whole, and
+\family typewriter
+/
+\family default
+,
+\family typewriter
+/usr
+\family default
+,
+\family typewriter
+/var
+\family default
+ etc.
+\begin_inset space \space{}
+\end_inset
+
+are created as subvolumes.
As each subvolume gets it own qgroup automatically, they can simply be
restricted.
No hierarchy is needed for that.
@@ -396,13 +500,34 @@ Restricting homes
\end_layout
\begin_layout Standard
-When you have several users on a machine, with home dirs probably under
- /home, you might want to restrict /home as a whole, while restricting every
- user to an indiviual limit.
- This is easily accomplished by creating a qgroup for /home, e.g.
- 1/1, and assigning all user-subvols to it.
- Restricting this qgroup will limit /home, while every user subvol can get
- it's own (lower) limit.
+When you have several users on a machine, with home directories probably
+ under
+\family typewriter
+/home
+\family default
+, you might want to restrict
+\family typewriter
+/home
+\family default
+ as a whole, while restricting every user to an indiviual limit as well.
+ This is easily accomplished by creating a qgroup for
+\family typewriter
+/home
+\family default
+, e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.
+\begin_inset space \space{}
+\end_inset
+
+1/1, and assigning all user subvolumes to it.
+ Restricting this qgroup will limit
+\family typewriter
+/home
+\family default
+, while every user subvolume can get its own (lower) limit.
\end_layout
\begin_layout Subsubsection
@@ -418,33 +543,41 @@ Accounting snapshots to the user
\begin_layout Standard
Let's say the user is allowed to create snapshots via some mechanism.
It would only be fair to account space used by the snapshots to the user.
- This doesn't mean the user doubles his usage as soon as he takes a snapshot.
- Of course files that are present in his home and the snapshot should only
+ This does not mean the user doubles his usage as soon as he takes a snapshot.
+ Of course, files that are present in his home and the snapshot should only
be accounted once.
This can be accomplished by creating a qgroup for each user, say 1/<uid>.
The user home and all snapshots are assigned to this qgroup.
Limiting it will extend the limit to all snapshots, counting files only
once.
- To limit /home as a whole, a higher level group 2/1 replacing 1/1 from
- the previous example is needed, with all user-qgroups assigned to it.
+ To limit
+\family typewriter
+/home
+\family default
+ as a whole, a higher level group 2/1 replacing 1/1 from the previous example
+ is needed, with all user qgroups assigned to it.
\end_layout
\begin_layout Subsubsection
-Don't account snapshots
+Do not account snapshots
\end_layout
\begin_layout Standard
On the other hand, when the snapshots get created automatically, the user
has no chance to control them, so the space used by them should not be
accounted to him.
- This is already the case when creating snapshots in example
+ This is already the case when creating snapshots in the example from section
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "sub:restricting-homes"
\end_inset
-
+.
\end_layout
\begin_layout Subsubsection
@@ -452,18 +585,22 @@ Snapshots for backup purposes
\end_layout
\begin_layout Standard
-This szenario is a mixture of the previous two.
+This scenario is a mixture of the previous two.
The user can create snapshots, but some snapshots for backup purposes are
being created by the system.
- User's snapshots should be accounted to the user, system's not.
- The solution is similar to
+ The user's snapshots should be accounted to the user, not the system.
+ The solution is similar to the one from section
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "sub:accounting-snapshots-to"
\end_inset
-, but don't assign system snapshots to users qgroup.
+, but do not assign system snapshots to user's qgroup.
\end_layout
\begin_layout Section
@@ -494,10 +631,16 @@ qgroup_record_ref(ref_root, start, num_bytes, operation);
\end_layout
\begin_layout Standard
-In fact these parameters are all contained in the delayed ref structure,
+In fact, these parameters are all contained in the delayed ref structure,
so just the delayed ref node is passed instead.
This function gets called from the central point where backrefs are added
- to the filesystem, btrfs_add_delayed_*_ref.
+ to the filesystem,
+\family typewriter
+btrfs_\SpecialChar \-
+add_\SpecialChar \-
+delayed_*_ref
+\family default
+.
\end_layout
\begin_layout Standard
@@ -565,16 +708,19 @@ Extent with lazy references
The back references that are recorded for the extent may not tell the full
truth.
- In figure
+ In figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Extent-with-lazy"
\end_inset
- a tree is depicted where the actual extent only has 2 back references recorded,
- whereas there are 5 roots referencing it.
-
+, a tree is depicted where the actual extent only has two back references
+ recorded, whereas there are five roots referencing it.
\end_layout
\begin_layout Standard
@@ -586,7 +732,7 @@ The solution is to walk up the tree and follow all back references until
\begin_layout Enumerate
The code runs in kernel space with very limited stack space.
- With a recursion the stack may overflow.
+ With a recursion, the stack may overflow.
\end_layout
\begin_layout Enumerate
@@ -638,9 +784,24 @@ add root to ulist of roots
\end_deeper
\end_deeper
\begin_layout Standard
-The lists here are called 'ulists', because they only accept new items if
- they are not already in the list, i.e.
- if they are unique.
+The lists here are called
+\begin_inset Quotes eld
+\end_inset
+
+ulists
+\begin_inset Quotes erd
+\end_inset
+
+, because they only accept new items if they are not already in the list,
+ i.
+\begin_inset space \thinspace{}
+\end_inset
+
+e.
+\begin_inset space \space{}
+\end_inset
+
+if they are unique.
\end_layout
\begin_layout Standard
@@ -650,7 +811,11 @@ The step to add all backrefs for an extent involves finding all recorded
Because this code might run some time, new delayed refs for any extent
in the tree might be added in the meantime.
To avoid a race condition here, each delayed ref gets a sequence number.
- Only delayed refs with seq < own seq are considered.
+ Only delayed refs with seq
+\begin_inset space ~
+\end_inset
+
+< own seq are considered.
Also, no delayed ref with a higher seq than own seq must be run while the
roots are searched for.
\end_layout
@@ -664,9 +829,13 @@ Calculate refcnt for all qgroups
\end_layout
\begin_layout Standard
-After the list of referencing roots is known, the next 3 steps all operate
+After the list of referencing roots is known, the next three steps all operate
on the qgroup hierarchy.
- A sample hierarchy is depicted in figure
+ A sample hierarchy is depicted in figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Sample-qgroup-hierarchy"
@@ -689,29 +858,42 @@ The first operation on the tree is to calculate the number of references
\begin_layout Standard
As in the previous step, the tree is walked iteratively with the help of
ulists to avoid recursion.
- Figure
+ Figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:qgroup-tree-after-1"
\end_inset
- depicts the state after this step is done for extent 3, where the ref from
- 0/2 should get deleted.
- The Figure omits the fs-trees and their roots, as qgroups of level 0 directly
- correspond to a root.
-
+ depicts the state after this step is done for extent
+\begin_inset space ~
+\end_inset
+
+3, where the ref from 0/2 should get deleted.
+ The Figure omits the fs trees and their roots, as qgroups of level
+\begin_inset space ~
+\end_inset
+
+0 directly correspond to a root.
\end_layout
\begin_layout Standard
As the refcnt is part of the qgroup struct, the algorithm would require
that all refcnts in all qgroups be set to zero before it can run.
To avoid this, a global sequence number is used to determine the refcnt.
- Only one thread at a time can currently do refcounting on the tree (that
- is easily changed should it impose a limit).
+ Only one thread at a time can currently do refcounting on the tree (this
+ is easily changable, should it impose a limit).
This thread grabs the next sequence number and walks up the tree.
If the refcnt of the visited qgroup is smaller than the seq, it is not
- yet set and known to be 0.
+ yet set and known to be
+\begin_inset space ~
+\end_inset
+
+0.
Otherwise, it is incremented.
After the algorithm has run, the global sequence number is incremented
by the max refcnt found.
@@ -743,7 +925,11 @@ name "fig:qgroup-tree-after"
\end_inset
-qgroup tree after refcnt augmentation for extent 3
+qgroup tree after refcnt augmentation for extent
+\begin_inset space ~
+\end_inset
+
+3
\end_layout
\end_inset
@@ -763,16 +949,16 @@ Tag qgroups
\begin_layout Standard
The next step is to walk up the tree again, but this time starting with
ref_root, the root to add/remove.
- Remember that the previous step doesn't include the ref_root.
+ Remember that the previous step does not include the ref_root.
Every qgroup that is being visited on the way up will be tagged in preparation
for the next step.
- Additionally, under certain conditions a first adjustment is made to the
+ Additionally, under certain conditions, a first adjustment is made to the
values of the visited qgroups.
\end_layout
\begin_layout Itemize
If the refcnt is zero and the operation is to add a reference, this means
- this qgroup is not yet referencing this extent, but after the operation
+ this qgroup is not yet referencing this extent, but after the operation,
it will, so the
\emph on
referenced
@@ -782,7 +968,7 @@ referenced
\begin_layout Itemize
If the refcnt is zero and the operation is to remove a reference, this means
- this qgroup is currently referencing the extent, but through the operation
+ this qgroup is currently referencing the extent, but through the operation,
it will lose its last reference, so the
\emph on
referenced
@@ -796,33 +982,40 @@ If the refcnt is zero and the number of roots found in the first step is
\end_layout
\begin_layout Itemize
-in case of addition: the added reference will be the only reference, so
+In case of addition: the added reference will be the only reference, so
\emph on
exclusive
\emph default
- of the qgroup is increased by num_bytes
+ of the qgroup is increased by num_bytes.
\end_layout
\begin_layout Itemize
-in case of removal: the reference is the last to remove, which means it
+In case of removal: the reference is the last to remove, which means it
is currently exclusive to ref_root, so
\emph on
exclusive
\emph default
- of the qgroup is decreased by num_bytes
+ of the qgroup is decreased by num_bytes.
\end_layout
\begin_layout Standard
-Figure
+Figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:qgroup-tree-after-1"
\end_inset
- depicts the situation given the reference for 0/2 to extent 3 is to be
- deleted.
+ depicts the situation given the reference for 0/2 to extent
+\begin_inset space ~
+\end_inset
+
+3 is to be deleted.
\emph on
Referenced
@@ -890,13 +1083,21 @@ exclusive
exclusive
\emph default
counts of the tagged qgroups already got adjusted in the previous step.
- All roots from step 1 are walked again, tagged qgroups are skipped.
+ All roots from step
+\begin_inset space ~
+\end_inset
+
+1 are walked again, tagged qgroups are skipped.
If the refcnt equals the number of roots found in step one,
\emph on
exclusive
\emph default
gets increased if the ref is to be removed and decreased otherwise.
- Figure
+ Figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:update-of-exclusive"
@@ -904,7 +1105,11 @@ reference "fig:update-of-exclusive"
\end_inset
shows the outcome of this step.
- Extent 3 is now
+ Extent
+\begin_inset space ~
+\end_inset
+
+3 is now
\emph on
exclusive
\emph default
@@ -914,8 +1119,12 @@ exclusive
exclusives
\emph default
are untouched.
- Extent 3 was exclusive to 1/2 and 2/1 and still is, while it wasn't exclusive
- to 0/2 and 1/1 and still isn't.
+ Extent
+\begin_inset space ~
+\end_inset
+
+3 was exclusive to 1/2 and 2/1 and still is, while it was not exclusive
+ to 0/2 and 1/1 and still is not.
\end_layout
\begin_layout Standard
@@ -944,7 +1153,7 @@ name "fig:update-of-exclusive"
\end_inset
-update of
+Update of
\emph on
exclusive
\emph default
@@ -966,10 +1175,14 @@ Tracking Groups
\end_layout
\begin_layout Standard
-As seen in the introductory chapter, when taking a snapshot the values of
- several qgroups might need to be adjusted.
+As seen in the introductory chapter, when taking a snapshot, the values
+ of several qgroups might need to be adjusted.
This is easiest to see when looking at some examples.
- Figure
+ Figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Tracking-snapshots"
@@ -1029,7 +1242,7 @@ referenced
exclusive
\emph default
for all snapshots of a subvolume.
- The gray qgroups 0/2-0/4 are all snapshot of 0/1.
+ The gray qgroups 0/2--0/4 are all snapshot of 0/1.
Before 0/4 is created, 1/2 contains 0/2 and 0/3.
The moment 0/4 gets created, it is added to 1/2.
The
@@ -1044,7 +1257,11 @@ referenced
\emph default
count, as not all extents from 0/4 might be new to 1/2.
The solution is to add another qgroup, 1/3, that tracks 0/1 and all subvolumes
- of it (Figure
+ of it (figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:A-tracking-qgroup"
@@ -1126,7 +1343,11 @@ does not change,
exclusive
\emph default
needs to be corrected.
- For this, we need another tracking group, 1/4 (Figure
+ For this, we need another tracking group, 1/4 (figure
+\begin_inset space ~
+\end_inset
+
+
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:A-snapshot-of"
@@ -1209,9 +1430,9 @@ On-disk quota tree layout
\begin_layout Standard
Qgroups add a new tree, the quota tree.
- 4 new keys are used in this tree.
- The overall status is recorded in a status item, each qgroup has 2 items,
- one to record the user configured limits and one to record the current
+ Four new keys are used in this tree.
+ The overall status is recorded in a status item, and each qgroup has two
+ items, one to record the user configured limits and one to record the current
\emph on
referenced
@@ -1221,8 +1442,8 @@ referenced
exclusive
\emph default
counts.
- Each parent/child-relationship between qgroups gets 2 qgroup_relation items,
- one per direction.
+ Each parent/child-relationship between qgroups gets two qgroup_relation
+ items, one per direction.
The on-disk structure is still preliminary.
\end_layout
@@ -1235,7 +1456,7 @@ exclusive
\end_layout
\begin_layout LyX-Code
- * There's only one instance of this key present,
+ * There is only one instance of this key present,
\end_layout
\begin_layout LyX-Code
@@ -1320,20 +1541,74 @@ exclusive
\end_layout
\begin_layout Standard
-The keys are chosen in a way that first comes the STATUS_KEY, followed by
- all INFO_KEYs, followed by all LIMIT_KEYs.
- After that, for each qgroup present all relations follow.
- Only the INFO_KEYs and the STATUS_KEY get updated regularly.
- The idea is that those keys stay close to each other, to minimize writes.
- The RELATION_KEY is chosen in a way that by a simple enumeration all children
- and parents for a given qgroup can be found.
- The qgroupid is composed of a 16 bit 'level' field, followed by a 48 bit
- 'id' field.
- A qgroupid is represented as level/id, e.g.
- 2/100.
- In the case of a subvolume, the level is 0, and the 'id' is just the internal
- tree objectid (5 or >= 256).
- On the command line, the user will be able to use the subvolume-path as
+The keys are chosen in a way such that
+\family typewriter
+STATUS_KEY
+\family default
+ comes first, followed by all
+\family typewriter
+INFO_KEY
+\family default
+s, followed by all
+\family typewriter
+LIMIT_KEY
+\family default
+s.
+ After that, for each qgroup present, all relations follow.
+ Only the
+\family typewriter
+INFO_KEY
+\family default
+s and the
+\family typewriter
+STATUS_KEY
+\family default
+ get updated regularly.
+ The idea is that those keys stay close to each other to minimize writes.
+ The
+\family typewriter
+RELATION_KEY
+\family default
+ is chosen in a way that, by a simple enumeration, all children and parents
+ for a given qgroup can be found.
+ The qgroupid is composed of a 16\SpecialChar \nobreakdash-
+bit
+\begin_inset Quotes eld
+\end_inset
+
+level
+\begin_inset Quotes erd
+\end_inset
+
+ field, followed by a 48\SpecialChar \nobreakdash-
+bit
+\begin_inset Quotes eld
+\end_inset
+
+id
+\begin_inset Quotes erd
+\end_inset
+
+ field.
+ A qgroupid is represented as level/id, e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.
+\begin_inset space \space{}
+\end_inset
+
+2/100.
+ In the case of a subvolume, the level is 0, and the
+\begin_inset Quotes eld
+\end_inset
+
+id
+\begin_inset Quotes erd
+\end_inset
+
+ is just the internal tree objectid (5 or >= 256).
+ On the command line, the user will be able to use the subvolume path as
the identifier.
\end_layout
@@ -1530,10 +1805,14 @@ __le64 excl_cmpr;
\end_layout
\begin_layout Standard
-For all uncompressed data the same value will be recorded for compressed
+For all uncompressed data, the same value will be recorded for compressed
and uncompressed.
- The *_cmpr values represent the amount of disk space used, the other values
- the amount of space from a user perspective.
+ The
+\family typewriter
+*_cmpr
+\family default
+ values represent the amount of disk space used, the other values the amount
+ of space from a user perspective.
The uncompressed values are hard to get, so a first version might not support
them yet and just record the on-disk values instead.
\end_layout
@@ -1606,7 +1885,6 @@ The flags record which of the limits are to be enforced.
A straightforward implementation might be very inaccurate and the first
version will probably not implement it.
Those values are nevertheless included here as a means for future expansion.
-
\end_layout
\begin_layout Subsection
@@ -1616,28 +1894,31 @@ Estimation
\begin_layout Standard
In btrfs, each file operation is encapsulated into a transaction.
All necessary space for the transaction has to be reserved before any modificat
-ion is done to the structures, as there's no way to back out in the middle.
- That's what block reserves are used for.
+ion is done to the structures, as there is no way to back out in the middle.
+ That is what block reserves are used for.
\end_layout
\begin_layout Standard
-The same holds for quota: it's not possible to deny an operation in the
+The same holds for quota: it is not possible to deny an operation in the
middle of it.
- The only point where an EDQUOT (Quota exceeded) error can be generated
- is before the operation start.
+ The only point where an
+\family typewriter
+EDQUOT
+\family default
+ (Quota exceeded) error can be generated is before the start of the operation.
The easiest way would be to only deny it if one of the affected qgroups
is already over quota, but that would allow large operations to exceed
the quota by far.
This implementation tries to estimate the needed space for the operation
- and reserves it at operation start.
+ and reserves it at the start of the operation.
If the reservation fails, the operation is denied.
\end_layout
\begin_layout Standard
The reservation is recorded in each qgroup.
- Also it is saved in the trans_handle, so it can be freed on end_transaction.
+ Also, it is saved in the trans_handle, so it can be freed on end_transaction.
The estimation is not a worst-case estimation like the block reservation.
- It shouldn't deny requests too early.
+ It should not deny requests too early.
On the other hand, it might be possible that a qgroup goes slightly over
quota.
\end_layout
diff --git a/quota.pdf b/quota.pdf
index 7eb9c8a..577546b 100644
--- a/quota.pdf
+++ b/quota.pdf
Binary files differ