From: Dave Chinner <david@fromorbit.com>
To: Gionatan Danti <g.danti@assyoma.it>
Cc: linux-xfs@vger.kernel.org
Subject: Re: Recover preallocated space after a crash?
Date: Sun, 8 Nov 2020 07:47:47 +1100 [thread overview]
Message-ID: <20201107204747.GH7391@dread.disaster.area> (raw)
In-Reply-To: <274ec62926defe526850a4253d2b96a8@assyoma.it>
On Sat, Nov 07, 2020 at 08:55:50PM +0100, Gionatan Danti wrote:
> Hi list,
> it is my understanding that XFS can preallocate some "extra" space via
> speculative EOF preallocation and speculative COW preallocation.
>
> During normal system operation, that extra space is recovered after some
> time. But what if system crashes? Can it be even recovered? If so, it is
> done at mount time or via a (more invasive) fsck?
It will be done silently the next time the inode is cycled through
memory via an open()/close() pair as specualtive prealloc is removed
on the final close() of a file.
Alternatively, you can trigger reclaim on the current set of
in-memory inodes by running:
# xfs_spaceman -c "prealloc -m 64k -s" /mnt
to remove speculative preallocations of more than 64k from all
inodes that are in-memory and wait for the operation to complete.
You still need to bring the inodes into memory, so you can do this
via find command that reads some inode metadata (e.g. find /mnt
-ctime 2>&1 /dev/null). This means you don't need to actually
open/close each inode in userspace - the filesystem will traversal
all the in-memory inodes and clear the prealloc space itself.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2020-11-07 20:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-07 19:55 Recover preallocated space after a crash? Gionatan Danti
2020-11-07 20:47 ` Dave Chinner [this message]
2020-11-07 22:56 ` Gionatan Danti
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=20201107204747.GH7391@dread.disaster.area \
--to=david@fromorbit.com \
--cc=g.danti@assyoma.it \
--cc=linux-xfs@vger.kernel.org \
/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