All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Alexander Tsvetkov <alexander.tsvetkov@oracle.com>,
	Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: maxpct option for small xfs filesystems
Date: Wed, 28 Jan 2015 09:44:49 -0600	[thread overview]
Message-ID: <54C903F1.30203@sandeen.net> (raw)
In-Reply-To: <54C8BCEC.5050101@oracle.com>

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),
                                        statp->f_files,
                                        mp->m_maxicount);

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.

-Eric

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=54C903F1.30203@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=alexander.tsvetkov@oracle.com \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

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