From: Christoph Hellwig <hch@lst.de>
To: John Garry <john.g.garry@oracle.com>
Cc: Christoph Hellwig <hch@infradead.org>,
brauner@kernel.org, djwong@kernel.org, cem@kernel.org,
dchinner@redhat.com, hch@lst.de, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
ojaswin@linux.ibm.com, ritesh.list@gmail.com,
martin.petersen@oracle.com, tytso@mit.edu,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH v6 10/13] xfs: iomap COW-based atomic write support
Date: Tue, 18 Mar 2025 06:39:06 +0100 [thread overview]
Message-ID: <20250318053906.GD14470@lst.de> (raw)
In-Reply-To: <eb7a6175-5637-4ea6-a08c-14776aa67d8b@oracle.com>
On Mon, Mar 17, 2025 at 10:18:58AM +0000, John Garry wrote:
> On 17/03/2025 07:26, Christoph Hellwig wrote:
>>> +static bool
>>> +xfs_bmap_valid_for_atomic_write(
>>
>> This is misnamed. It checks if the hardware offload an be used.
>
> ok, so maybe:
>
> xfs_bmap_atomic_write_hw_possible()?
That does sound better.
> Fine, so it will be something like "atomic writes are required to be
> naturally aligned for disk blocks, which is a block layer rule to ensure
> that we won't straddle any boundary or violate write alignment
> requirement".
Much better! Maybe spell out the actual block layer rule, though?
>>
>> Should the atomic and cow be together for coherent naming?
>> But even if the naming is coherent it isn't really
>> self-explanatory, so please add a little top of the function
>> comment introducing it.
>
> I can add a comment, but please let me know of any name suggestion
/*
* Handler for atomic writes implemented by writing out of place through
* the COW fork. If possible we try to use hardware provided atomicy
* instead, which is handled directly in xfs_direct_write_iomap_begin.
*/
>
>>
>>> + error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb, &imap,
>>> + &nimaps, 0);
>>> + if (error)
>>> + goto out_unlock;
>>
>> Why does this need to read the existing data for mapping? You'll
>> overwrite everything through the COW fork anyway.
>>
>
> We next call xfs_reflink_allocate_cow(), which uses the imap as the basis
> to carry the offset and count.
Is xfs_reflink_allocate_cow even the right helper to use? We know we
absolutely want a a COW fork extent, we know there can't be delalloc
extent to convert as we flushed dirty data, so most of the logic in it
is pointless.
next prev parent reply other threads:[~2025-03-18 5:39 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 17:12 [PATCH v6 00/13] large atomic writes for xfs with CoW John Garry
2025-03-13 17:12 ` [PATCH v6 01/13] iomap: inline iomap_dio_bio_opflags() John Garry
2025-03-16 13:40 ` Ritesh Harjani
2025-03-17 6:07 ` Christoph Hellwig
2025-03-13 17:12 ` [PATCH v6 02/13] iomap: comment on atomic write checks in iomap_dio_bio_iter() John Garry
2025-03-17 6:08 ` Christoph Hellwig
2025-03-17 8:22 ` John Garry
2025-03-17 14:16 ` Ritesh Harjani
2025-03-13 17:13 ` [PATCH v6 03/13] iomap: rework IOMAP atomic flags John Garry
2025-03-17 6:11 ` Christoph Hellwig
2025-03-17 9:05 ` John Garry
2025-03-18 5:32 ` Christoph Hellwig
2025-03-18 8:11 ` John Garry
2025-03-17 13:44 ` Ritesh Harjani
2025-03-17 14:25 ` John Garry
2025-03-13 17:13 ` [PATCH v6 04/13] xfs: pass flags to xfs_reflink_allocate_cow() John Garry
2025-03-17 6:15 ` Christoph Hellwig
2025-03-17 9:17 ` John Garry
2025-03-18 5:33 ` Christoph Hellwig
2025-03-18 8:12 ` John Garry
2025-03-13 17:13 ` [PATCH v6 05/13] xfs: allow block allocator to take an alignment hint John Garry
2025-03-17 6:16 ` Christoph Hellwig
2025-03-13 17:13 ` [PATCH v6 06/13] xfs: switch atomic write size check in xfs_file_write_iter() John Garry
2025-03-17 6:18 ` Christoph Hellwig
2025-03-17 9:17 ` John Garry
2025-03-13 17:13 ` [PATCH v6 07/13] xfs: refactor xfs_reflink_end_cow_extent() John Garry
2025-03-17 6:19 ` Christoph Hellwig
2025-03-13 17:13 ` [PATCH v6 08/13] xfs: reflink CoW-based atomic write support John Garry
2025-03-17 6:20 ` Christoph Hellwig
2025-03-13 17:13 ` [PATCH v6 09/13] xfs: add XFS_REFLINK_ALLOC_EXTSZALIGN John Garry
2025-03-13 18:03 ` Darrick J. Wong
2025-03-17 6:23 ` Christoph Hellwig
2025-03-13 17:13 ` [PATCH v6 10/13] xfs: iomap COW-based atomic write support John Garry
2025-03-16 6:53 ` Ritesh Harjani
2025-03-17 8:54 ` John Garry
2025-03-17 14:20 ` Ritesh Harjani
2025-03-17 14:56 ` John Garry
2025-03-18 5:35 ` Christoph Hellwig
2025-03-17 7:26 ` Christoph Hellwig
2025-03-17 10:18 ` John Garry
2025-03-18 5:39 ` Christoph Hellwig [this message]
2025-03-18 8:22 ` John Garry
2025-03-18 8:32 ` Christoph Hellwig
2025-03-18 17:44 ` John Garry
2025-03-19 7:30 ` Christoph Hellwig
2025-03-19 10:24 ` John Garry
2025-03-20 5:29 ` Christoph Hellwig
2025-03-20 9:49 ` John Garry
2025-03-20 14:12 ` Christoph Hellwig
2025-03-13 17:13 ` [PATCH v6 11/13] xfs: add xfs_file_dio_write_atomic() John Garry
2025-03-17 6:41 ` Christoph Hellwig
2025-03-17 9:36 ` John Garry
2025-03-18 5:43 ` Christoph Hellwig
2025-03-18 8:42 ` John Garry
2025-03-18 8:46 ` Christoph Hellwig
2025-03-18 9:12 ` John Garry
2025-03-13 17:13 ` [PATCH v6 12/13] xfs: commit CoW-based atomic writes atomically John Garry
2025-03-17 6:56 ` Christoph Hellwig
2025-03-17 9:43 ` John Garry
2025-03-13 17:13 ` [PATCH v6 13/13] xfs: update atomic write max size John Garry
2025-03-17 7:25 ` Christoph Hellwig
2025-03-17 9:57 ` John Garry
2025-03-18 5:47 ` Christoph Hellwig
2025-03-18 5:48 ` [PATCH v6 00/13] large atomic writes for xfs with CoW Christoph Hellwig
2025-03-18 8:44 ` John Garry
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=20250318053906.GD14470@lst.de \
--to=hch@lst.de \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=john.g.garry@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
/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