blob: b42a4a8ebcadf89d02bfaf5e219f270ec158ba42 [file] [log] [blame]
<?xml version='1.0'?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
]>
<chapter id="Internal_Inodes"><title>Internal Inodes</title>
<para>XFS allocates several inodes when a filesystem is created. These are internal and not accessible from the standard directory structure. These inodes are only accessible from the superblock.</para>
<section id="Quota_Inodes"><title>
Quota Inodes</title>
<para>If quotas are used, two inodes are allocated for user and group quota management. If project quotas are used, these replace the group quota management and therefore uses the group quota inode.</para>
<itemizedlist>
<listitem>
<para>Project quota's primary purpose is to track and monitor disk usage for directories. For this to occur, the directory inode must have the <command>XFS_DIFLAG_PROJINHERIT</command> flag set so all inodes created underneath the directory inherit the project ID.</para>
</listitem>
<listitem>
<para>Inodes and blocks owned by ID zero do not have enforced quotas, but only quota accounting.</para>
</listitem>
<listitem>
<para>­Extended attributes do not contribute towards the ID's quota .</para>
</listitem>
<listitem>
<para>To access each ID's quota information in the file, seek to the ID offset multiplied by the size of <command>xfs_dqblk_t</command> (136 bytes). </para>
</listitem>
</itemizedlist>
<para>
<mediaobject>
<imageobject><imagedata fileref="images/76.png" format="PNG" width="100%" scalefit="0"/></imageobject>
<textobject><phrase>76</phrase></textobject>
</mediaobject>
</para>
<para>
Quota information stored in the two inodes (in data extents) are an array of the <command>xfs_dqblk_t</command> structure where there is one instance for each ID in the system:</para>
<programlisting>
typedef struct xfs_disk_dquot {
__be16 d_magic;
__u8 d_version;
__u8 d_flags;
__be32 d_id;
__be64 d_blk_hardlimit;
__be64 d_blk_softlimit;
__be64 d_ino_hardlimit;
__be64 d_ino_softlimit;
__be64 d_bcount;
__be64 d_icount;
__be32 d_itimer;
__be32 d_btimer;
__be16 d_iwarns;
__be16 d_bwarns;
__be32 d_pad0;
__be64 d_rtb_hardlimit;
__be64 d_rtb_softlimit;
__be64 d_rtbcount;
__be32 d_rtbtimer;
__be16 d_rtbwarns;
__be16 d_pad;
} xfs_disk_dquot_t;
typedef struct xfs_dqblk {
xfs_disk_dquot_t dd_diskdq;
char dd_fill[32];
} xfs_dqblk_t;
</programlisting>
<variablelist>
<varlistentry>
<term>d_magic</term>
<listitem><para>Specifies the signature where these two bytes are 0x4451 (<command>XFS_DQUOT_MAGIC</command>), or "DQ" in ASCII.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_version</term>
<listitem><para>Specifies the structure version, currently this is one (<command>XFS_DQUOT_VERSION</command>).</para></listitem>
</varlistentry>
<varlistentry>
<term>d_flags</term>
<listitem><para>Specifies which type of ID the structure applies to:
<programlisting>
#define XFS_DQ_USER 0x0001
#define XFS_DQ_PROJ 0x0002
#define XFS_DQ_GROUP 0x0004
</programlisting></para></listitem>
</varlistentry>
<varlistentry>
<term>d_id</term>
<listitem><para>The ID for the quota structure. This will be a uid, gid or projid based on the value of <command>d_flags</command>.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_blk_hardlimit</term>
<listitem><para>Specifies the hard limit for the number of filesystem blocks the ID can own. The ID will not be able to use more space than this limit. If it is attempted, <command>ENOSPC</command> will be returned.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_blk_softlimit</term>
<listitem><para>Specifies the soft limit for the number of filesystem blocks the ID can own.  The ID can temporarily use more space than by <command>d_blk_softlimit</command> up to <command>d_blk_hardlimit</command>. If the space is not freed by the time limit specified by ID zero's <command>d_btimer</command> value, the ID will be denied more space until the total blocks owned goes below <command>d_blk_softlimit</command>.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_ino_hardlimit</term>
<listitem><para>Specifies the hard limit for the number of inodes the ID can own. The ID will not be able to create or own any more inodes if <command>d_icount</command> reaches this value.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_ino_softlimit</term>
<listitem><para>Specifies the soft limit for the number of inodes the ID can own. The ID can temporarily create or own more inodes than specified by d_ino_softlimit up to d_ino_hardlimit. If the inode count is not reduced by the time limit specified by ID zero's d_itimer value, the ID will be denied from creating or owning more inodes until the count goes below d_ino_softlimit.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_bcount</term>
<listitem><para>Specifies how many filesystem blocks are actually owned by the ID.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_icount</term>
<listitem><para>Specifies how many inodes are actually owned by the ID.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_itimer</term>
<listitem><para>Specifies the time when the ID's <command>d_icount</command> exceeded <command>d_ino_softlimit</command>. The soft limit will turn into a hard limit after the elapsed time exceeds ID zero's <command>d_itimer</command> value. When d_icount goes back below <command>d_ino_softlimit</command>, <command>d_itimer</command> is reset back to zero. </para></listitem>
</varlistentry>
<varlistentry>
<term>d_btimer</term>
<listitem><para>Specifies the time when the ID's <command>d_bcount</command> exceeded <command>d_blk_softlimit</command>. The soft limit will turn into a hard limit after the elapsed time exceeds ID zero's <command>d_btimer</command> value. When d_bcount goes back below <command>d_blk_softlimit</command>, <command>d_btimer</command> is reset back to zero.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_iwarns
d_bwarns
d_rtbwarns</term>
<listitem><para>Specifies how many times a warning has been issued. Currently not used.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_rtb_hardlimit</term>
<listitem><para>Specifies the hard limit for the number of real-time blocks the ID can own. The ID cannot own more space on the real-time subvolume beyond this limit.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_rtb_softlimit</term>
<listitem><para>Specifies the soft limit for the number of real-time blocks the ID can own. The ID can temporarily own more space than specified by <command>d_rtb_softlimit</command> up to <command>d_rtb_hardlimit</command>. If <command>d_rtbcount</command> is not reduced by the time limit specified by ID zero's <command>d_rtbtimer value</command>, the ID will be denied from owning more space until the count goes below <command>d_rtb_softlimit</command></para></listitem>
</varlistentry>
<varlistentry>
<term>d_rtbcount</term>
<listitem><para>Specifies how many real-time blocks are currently owned by the ID.</para></listitem>
</varlistentry>
<varlistentry>
<term>d_rtbtimer</term>
<listitem><para>Specifies the time when the ID's <command>d_rtbcount</command> exceeded <command>d_rtb_softlimit</command>. The soft limit will turn into a hard limit after the elapsed time exceeds ID zero's <command>d_rtbtimer</command> value. When <command>d_rtbcount</command> goes back below <command>d_rtb_softlimit</command>, <command>d_rtbtimer</command> is reset back to zero.</para></listitem>
</varlistentry>
</variablelist>
</section>
<section id="Real-time_Inodes"><title>Real-time Inodes</title>
<para>There are two inodes allocated to managing the real-time device's space, the Bitmap Inode and the Summary Inode.</para>
<section id="Real-Time_Bitmap_Inode"><title>Real-Time Bitmap Inode</title>
<para>The Bitmap Inode tracks the used/free space in the real-time device using an old-style bitmap. One bit is allocated per real-time extent. The size of an extent is specified by the superblock's <command>sb_rextsize</command> value.</para>
<para>The number of blocks used by the bitmap inode is equal to the number of real-time extents (<command>sb_rextents</command>) divided by the block size (<command>sb_blocksize</command>) and bits per byte. This value is stored in <command>sb_rbmblocks</command>. The nblocks and extent array for the inode should match this.</para>
<programlisting>
xfs_ino_t        sb_rbmino;        </programlisting>
</section><section><title>Real-Time Summary Inode</title>
<programlisting>
xfs_ino_t        sb_rsumino;        </programlisting>
</section></section></chapter>