From: Brian Foster <bfoster@redhat.com>
To: Kaho Ng <ngkaho1234@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: [QUESTION] about the freelist allocator in XFS
Date: Thu, 7 Jul 2016 08:13:23 -0400 [thread overview]
Message-ID: <20160707121323.GA10134@laptop.bfoster> (raw)
In-Reply-To: <CAGeO4WMZtYjaW=L7Hj8CgTd-sO38-xAUMhkZ-x-Z394YjOO7Xg@mail.gmail.com>
On Thu, Jul 07, 2016 at 07:01:35PM +0800, Kaho Ng wrote:
> I am trying to investigate how freelist allocator in xfs interacts
> with freespace B+Tree allocator.
> First I prepared a patch
> <https://gist.github.com/22ffca35929e67c08759b057779b7566> on
> linux-source/fs/xfs/libxfs/xfs_alloc.c to print debugging messages
> (The kernel version used is linux-3.10.0-327.22.2.el7).
> Then, I wrote a simple utility
> <https://gist.github.com/992364ceca984d3f14099ec94aaacd9d> to make
> TONS of
> holes in a filesystem by calling fallocate() to punch holes in a file
> that is almost as large as the volume size.
>
> I created an XFS filesystem image by the following steps:
> 1. fallocate -l 80G /mnt/disk2/xfs
> 2. mkfs.xfs -f -d agcount=1 /mnt/disk2/xfs
>
> Then I created a large file by fallocate:
> fallocate -l 85823746048 /mnt/test/abc
>
> which left only 4 blocks available in the volume finally:
> /dev/loop0 20961280 20961276 4 100% /mnt/test
>
> The result of xfs_bmap against /mnt/test/abc:
> /mnt/test/abc:
> EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
> 0: [0..167624503]: 83000..167707503 0 (83000..167707503) 167624504 10000
>
> After that, I used the hole-punching utility above to create holes on
> the files, and captured the output of kmsg.
>
> When reading the log output
> <https://gist.github.com/890076405e1c13c0a952a579e25e6afe> , I
> realised that there is no B+Tree split
> triggered by xfs_alloc_fix_freelist() when calling xfs_free_extent().
> Isn't B+Tree split possible in by-size B+Tree even when truncating a
> longer freespace record to shorter one? But what I found in the log is
> only a few tree shrinks... And when reading the source code of
> freespace allocator I found that a B+Tree growth in this case is
> impossible at least...
>
I'd suggest to use a combination of xfs_db and tracepoints/xfsstats to
identify what's happening in your test sequence. E.g., unmount and use
xfs_db to identify the state of the free space btree(s) before and after
various points of your test. See [1] for examples of how to use xfs_db
to explore on-disk data structures. See 'man trace-cmd' to work with
tracepoints and /proc/fs/xfs/stats (and /proc/sys/fs/xfs/stats_clear) to
view runtime statistics (which I believe already includes the number of
btree splits).
Brian
[1] http://xfs.org/docs/xfsdocs-xml-dev/XFS_Filesystem_Structure//tmp/en-US/html/index.html
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-07-07 12:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-07 11:01 [QUESTION] about the freelist allocator in XFS Kaho Ng
2016-07-07 12:13 ` Brian Foster [this message]
2016-07-07 22:28 ` Dave Chinner
[not found] ` <CAGeO4WNAdmeXgL4+CAQ1Yqo18XFgv3NZxWVbDTS0xDZLyb3e2w@mail.gmail.com>
2016-07-08 2:29 ` Fwd: " Kaho Ng
[not found] ` <20160708034710.GL12670@dastard>
2016-07-08 4:05 ` Kaho Ng
2016-07-08 5:48 ` Kaho Ng
2016-07-10 23:22 ` Dave Chinner
2016-07-11 7:06 ` Kaho Ng
2016-07-11 22:53 ` Dave Chinner
2016-07-08 19:17 ` Kaho Ng
2016-07-09 12:26 ` Kaho Ng
2016-07-10 16:57 ` Kaho Ng
2016-07-10 23:27 ` Dave Chinner
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=20160707121323.GA10134@laptop.bfoster \
--to=bfoster@redhat.com \
--cc=ngkaho1234@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox