linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Recover preallocated space after a crash?
@ 2020-11-07 19:55 Gionatan Danti
  2020-11-07 20:47 ` Dave Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: Gionatan Danti @ 2020-11-07 19:55 UTC (permalink / raw)
  To: linux-xfs

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?

Thanks.

-- 
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti@assyoma.it - info@assyoma.it
GPG public key ID: FF5F32A8

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Recover preallocated space after a crash?
  2020-11-07 19:55 Recover preallocated space after a crash? Gionatan Danti
@ 2020-11-07 20:47 ` Dave Chinner
  2020-11-07 22:56   ` Gionatan Danti
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2020-11-07 20:47 UTC (permalink / raw)
  To: Gionatan Danti; +Cc: linux-xfs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Recover preallocated space after a crash?
  2020-11-07 20:47 ` Dave Chinner
@ 2020-11-07 22:56   ` Gionatan Danti
  0 siblings, 0 replies; 3+ messages in thread
From: Gionatan Danti @ 2020-11-07 22:56 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs

Il 2020-11-07 21:47 Dave Chinner ha scritto:
> 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.

Hi Dave,
thanks so much for the clear answer.

-- 
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti@assyoma.it - info@assyoma.it
GPG public key ID: FF5F32A8

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-07 22:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-07 19:55 Recover preallocated space after a crash? Gionatan Danti
2020-11-07 20:47 ` Dave Chinner
2020-11-07 22:56   ` Gionatan Danti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).