mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Matteo Croce <technoboy85@gmail.com>,
	linux-xfs@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: ftruncate() after FICLONERANGE costs 300-600us/file, ~10x more than the clone itself
Date: Mon, 6 Jul 2026 23:20:24 -0700	[thread overview]
Message-ID: <akyaqGkBmxt2JG5n@infradead.org> (raw)
In-Reply-To: <20260707055651.GX9392@frogsfrogsfrogs>

On Mon, Jul 06, 2026 at 10:56:51PM -0700, Darrick J. Wong wrote:
> XFS zeroes the tail block when you truncate down, which causes an out of
> place write.

All the file systems do it (or at least should).  But somehow we
manage to be slower.

I wonder if we hit the filemap_write_and_wait_range case in
xfs_vn_setattr_size due to a non-uptodate i_disk_size for this
workload somehow?  Although reflink should update i_disk_size
properly.

> 
> Assuming src.dat is the fully written 90000 byte file, can you
> 
> $ xfs_io -c "reflink src.dat 86016 86016 0" dest.dat
> 
> to link only the eof-block into dest.dat and keep its file size at
> 90000?

Only doing the reflink block aligned and copying data for partial
blocks should indeed always be faster.  But I wonder if we have
some dragons lurking in the truncate down path.


  reply	other threads:[~2026-07-07  6:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 21:45 Matteo Croce
2026-07-07  5:56 ` Darrick J. Wong
2026-07-07  6:20   ` Christoph Hellwig [this message]
2026-07-07 15:09     ` Matteo Croce
2026-07-07 15:07   ` Matteo Croce

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=akyaqGkBmxt2JG5n@infradead.org \
    --to=hch@infradead.org \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=technoboy85@gmail.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

all inboxes | Powered by JetHome®