From: Christoph Hellwig <hch@infradead.org>
To: "Pankaj Raghav (Samsung)" <pankaj.raghav@linux.dev>
Cc: Christoph Hellwig <hch@infradead.org>,
Pankaj Raghav <p.raghav@samsung.com>,
linux-xfs@vger.kernel.org, bfoster@redhat.com, lukas@herbolt.com,
"Darrick J . Wong" <djwong@kernel.org>,
dgc@kernel.org, gost.dev@samsung.com, andres@anarazel.de,
kundan.kumar@samsung.com, cem@kernel.org,
Zhang Yi <yi.zhang@huawei.com>,
linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [PATCH v6 3/3] xfs: add support for FALLOC_FL_WRITE_ZEROES
Date: Thu, 18 Jun 2026 06:37:54 -0700 [thread overview]
Message-ID: <ajP0sno47hihsCCo@infradead.org> (raw)
In-Reply-To: <xklmkbxoh7yfm5mkxxpp72wfifngzr2v4nfrn3lgzc57ep7nkj@louxc6z3gfmk>
On Thu, Jun 18, 2026 at 03:26:14PM +0200, Pankaj Raghav (Samsung) wrote:
> existing code **does not** overwrite any user data. Here is why:
>
> - xfs_free_file_space (punch hole) punches inward (offset_ru -> end_rd)
> and zeroes out from (offset -> offset_ru) and (end_rd -> end) with
> xfs_zero_range
Ah, right.
> - Luckily, even though we consider offset_rd to end_ru in
> alloc_file_space, XFS_BMAPI_ZERO will skip zeroing already written
> edge blocks and only offset_ru -> end_rd are zeroed using unmap zero range.
> ( (offset -> offset_ru) -> EXT_NORM, (offset_ru -> end_rd) -> HOLE,
> (end_rd -> end) -> EXT_NORM)
Oh. So this was lucky because of the corner cases. I still think doing
the proper alignment in the higher level code and only calling down for
the area that we really want to zero would be benefitial here, if only
to make the code easier to follow.
next prev parent reply other threads:[~2026-06-18 13:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 11:40 [PATCH v6 0/3] add FALLOC_FL_WRITE_ZEROES support to xfs Pankaj Raghav
2026-06-11 11:40 ` [PATCH v6 1/3] xfs: widen xfs_setfilesize() size argument to xfs_off_t Pankaj Raghav
2026-06-16 13:15 ` Christoph Hellwig
2026-06-11 11:40 ` [PATCH v6 2/3] xfs: add an allocation mode to xfs_alloc_file_space() Pankaj Raghav
2026-06-16 13:15 ` Christoph Hellwig
2026-06-11 11:40 ` [PATCH v6 3/3] xfs: add support for FALLOC_FL_WRITE_ZEROES Pankaj Raghav
2026-06-16 13:31 ` Christoph Hellwig
2026-06-17 9:44 ` Pankaj Raghav (Samsung)
2026-06-18 3:22 ` Zhang Yi
2026-06-18 8:18 ` Pankaj Raghav (Samsung)
2026-06-18 8:57 ` Christoph Hellwig
2026-06-18 8:59 ` Christoph Hellwig
2026-06-18 10:26 ` Zhang Yi
2026-06-18 9:00 ` Christoph Hellwig
2026-06-18 9:28 ` Pankaj Raghav (Samsung)
2026-06-18 9:36 ` Christoph Hellwig
2026-06-18 13:26 ` Pankaj Raghav (Samsung)
2026-06-18 13:37 ` Christoph Hellwig [this message]
2026-06-18 13:57 ` Pankaj Raghav (Samsung)
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=ajP0sno47hihsCCo@infradead.org \
--to=hch@infradead.org \
--cc=andres@anarazel.de \
--cc=bfoster@redhat.com \
--cc=cem@kernel.org \
--cc=dgc@kernel.org \
--cc=djwong@kernel.org \
--cc=gost.dev@samsung.com \
--cc=kundan.kumar@samsung.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=lukas@herbolt.com \
--cc=p.raghav@samsung.com \
--cc=pankaj.raghav@linux.dev \
--cc=yi.zhang@huawei.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