xfs
[Top] [All Lists]

Some questions about the freelist allocator in XFS

To: xfs@xxxxxxxxxxx
Subject: Some questions about the freelist allocator in XFS
From: Kaho Ng <ngkaho1234@xxxxxxxxx>
Date: Thu, 7 Jul 2016 10:35:12 +0800
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=KwsXYVfIPNs/WYvIamkwhfBAKeeverjaFLopJkGl1tU=; b=Qm2vESfI/JsbQJc/hxFwcAqCrRZAD+SlY2ViAA2eVDsRqx9ziNSU7Qx2O8GjwbzTvU U9CA8VVwy1SJT/x5EMRacHNfKGZMpxhOT+SjeOn85RgcAVs4HQ/1r6L4trVDlH9e6yB/ hdakGfjA34pvcx0dTB6vTCYhbmRADhUUNhIB6JZhOiR8qZOCpv5+5jH15CdtytYjo5yd aHG4uZjFdiM3fF5jeVS+HoHsFhjb7MnLTLAqC81qhg3Hsu18FjC80UX7u/hcAKWR8MiG osdYlAu4d0SHAkRHnWADx8p1jiS2K1C2TjeqbO+oEeudlXwnaNCRBHO87ADORijjBjye d6TQ==
I am trying to investigate how freelist allocator in xfs interacts
with freespace B+Tree allocator.
First I prepared a patch against
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 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, 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...

Attachment: kernel-log
Description: Binary data

Attachment: punch.c
Description: Text Data

Attachment: xfs_alloc.c.patch
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>
  • Some questions about the freelist allocator in XFS, Kaho Ng <=