All of
 help / color / mirror / Atom feed
From: Eric Sandeen <>
To: Alexander Tsvetkov <>,
	Dave Chinner <>
Subject: Re: maxpct option for small xfs filesystems
Date: Wed, 28 Jan 2015 09:44:49 -0600	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 1/28/15 4:41 AM, Alexander Tsvetkov wrote:


>> and what does df -i say after remount?
> Nothing changed after remount:

Sorry, I misremembered the problem.  :(

>> This is actually a problem with the lazy superblock counters I've run into before,
>> but haven't yet fixed.  This kind of workload is such that it never trips the
>> runtime rebalancing.
>>> Looking into ncheck output there are 40512 pairs reported in the output each with own unique
>>> inode number. ncheck doesn't report inodes count by definition, but what does these
>>> 40512 reported inode numbers mean if only actually 640 inodes were allocated? From another hand
>>> each new file should have associated meta-data in the corresponding allocated inode structure, so for
>>> 40512 newly created files I expect the same count of allocated inodes, is it correct?
>> Recheck df -i after remount, I think you will see many more than 640.

> Do you mean that ncheck reports right number of allocated inodes instead of df -i? If counters are incorrect then the
> maxpct limit is not working as well, because there are much more of filesystem space allocated for inodes then defined limit 1%.
> What is expected behaviour in this case when it's required for fs to allocate new inodes starting to exceed defined maxpct
> percentage? Which error is expected to be returned to user, enospc or probably just some warning?

There are a couple of things going on here.

XFS superblock counters are kept in per-cpu variables for scalability; at certain times these per-cpu counts are coalesced into a global counter based on various thresholds.  The thing about the inode counter is that it generally counts up, and it's the high thresholds that we care about (in order to determine if we've hit maxpct), but it's written as one of the low-threshold counters (as with free inodes / free space).

So in your test, you're rapidly running up the counter on a single cpu, and it's not getting coalesced into the main counter, which is where the imaxpct test happens.  So that's why you're able to exceed imaxpct.

The df -i (statfs) output is wrong because of a bug in xfs_fs_statfs.  For a filesystem like XFS which dynamically allocates and deallocates inodes, it's a little tricky to answer the question "how many inodes are available?"  It's limited by free space as well as by imaxpct. There's code in there which does this:

        if (mp->m_maxicount)
                statp->f_files = min_t(typeof(statp->f_files),

so it will never report more than mp->m_maxicount, which is essentially the imaxpct limit, even if we've actually allocated more than that.

A simple fix for this is to recognize that imaxpct is something of a soft limit (it's not critical if we overrun by a few hundred or even thousand inodes), and if the superblock counter of allocated inodes (sbp->sb_icount) exceeds mp->m_maxicount due to such an overrun, we should report that (true) value instead.

I'm working on a couple of patches which should fix both issues.


xfs mailing list

  reply	other threads:[~2015-01-28 15:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 16:14 maxpct option for small xfs filesystems Alexander Tsvetkov
2015-01-26 22:37 ` Dave Chinner
2015-01-27 16:23   ` Alexander Tsvetkov
2015-01-27 16:31     ` Eric Sandeen
2015-01-27 19:15       ` Eric Sandeen
2015-01-28 10:41       ` Alexander Tsvetkov
2015-01-28 15:44         ` Eric Sandeen [this message]
2015-01-28 18:05         ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.