All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: John Garry <john.g.garry@oracle.com>
Cc: Dave Chinner <david@fromorbit.com>,
	brauner@kernel.org, cem@kernel.org, dchinner@redhat.com,
	hch@lst.de, ritesh.list@gmail.com, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	martin.petersen@oracle.com
Subject: Re: [PATCH 1/4] iomap: Lift blocksize restriction on atomic writes
Date: Fri, 17 Jan 2025 10:29:45 -0800	[thread overview]
Message-ID: <20250117182945.GH1611770@frogsfrogsfrogs> (raw)
In-Reply-To: <01e781da-0798-4de6-ad03-6099f15f308e@oracle.com>

On Fri, Jan 17, 2025 at 10:26:34AM +0000, John Garry wrote:
> On 14/01/2025 23:57, Darrick J. Wong wrote:
> > > i.e. RWF_ATOMIC as implemented by a COW capable filesystem should
> > > always be able to succeed regardless of IO alignment. In these
> > > situations, the REQ_ATOMIC block layer offload to the hardware is a
> > > fast path that is enabled when the user IO and filesystem extent
> > > alignment matches the constraints needed to do a hardware atomic
> > > write.
> > > 
> > > In all other cases, we implement RWF_ATOMIC something like
> > > always-cow or prealloc-beyond-eof-then-xchg-range-on-io-completion
> > > for anything that doesn't correctly align to hardware REQ_ATOMIC.
> > > 
> > > That said, there is nothing that prevents us from first implementing
> > > RWF_ATOMIC constraints as "must match hardware requirements exactly"
> > > and then relaxing them to be less stringent as filesystems
> > > implementations improve. We've relaxed the direct IO hardware
> > > alignment constraints multiple times over the years, so there's
> > > nothing that really prevents us from doing so with RWF_ATOMIC,
> > > either. Especially as we have statx to tell the application exactly
> > > what alignment will get fast hardware offloads...
> > Ok, let's do that then.  Just to be clear -- for any RWF_ATOMIC direct
> > write that's correctly aligned and targets a single mapping in the
> > correct state, we can build the untorn bio and submit it.  For
> > everything else, prealloc some post EOF blocks, write them there, and
> > exchange-range them.
> 
> I have some doubt about this, but I may be misunderstanding the concept:
> 
> So is there any guarantee that what we write into is aligned (after the
> exchange-range routine)? If not, surely every subsequent write with
> RWF_ATOMIC to that logical range will require this exchange-range routine
> until we get something aligned (and correct granularity) - correct?

Correct, you'd still need forcealign to make sure that the new
allocations for exchange-range are aligned to awumin.

--D

> I know that getting unaligned blocks continuously is unlikely, unless a
> heavily fragmented disk. However, databases prefer guaranteed performance
> (which HW offload gives).
> 
> We can use extszhint to hint at granularity, but that does not help with
> alignment (AFAIK).
> 
> > 
> > Tricky questions: How do we avoid collisions between overlapping writes?
> > I guess we find a free file range at the top of the file that is long
> > enough to stage the write, and put it there?  And purge it later?
> > 
> > Also, does this imply that the maximum file size is less than the usual
> > 8EB?
> > 
> > (There's also the question about how to do this with buffered writes,
> > but I guess we could skip that for now.)
> 
> 

  reply	other threads:[~2025-01-17 18:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04 15:43 [PATCH 0/4] large atomic writes for xfs John Garry
2024-12-04 15:43 ` [PATCH 1/4] iomap: Lift blocksize restriction on atomic writes John Garry
2024-12-04 20:35   ` Dave Chinner
2024-12-05  6:30     ` Darrick J. Wong
2024-12-05 11:51       ` John Garry
2024-12-05 10:52     ` John Garry
2024-12-05 21:15       ` Dave Chinner
2024-12-06  9:43         ` John Garry
2024-12-12  1:34         ` Darrick J. Wong
2025-01-14  4:41           ` Dave Chinner
2025-01-14 23:57             ` Darrick J. Wong
2025-01-15  9:30               ` John Garry
2025-01-16  6:52               ` Christoph Hellwig
2025-01-17 18:49                 ` Darrick J. Wong
2025-01-22  6:42                   ` Christoph Hellwig
2025-01-22 10:45                     ` John Garry
2025-01-22 23:51                       ` Dave Chinner
2025-01-23  9:28                         ` John Garry
2025-01-17 10:26               ` John Garry
2025-01-17 18:29                 ` Darrick J. Wong [this message]
2025-01-20  8:29                   ` John Garry
2025-01-22 21:05               ` Dave Chinner
2025-01-13 21:35         ` John Garry
2025-01-14  4:43           ` Dave Chinner
2024-12-04 15:43 ` [PATCH 2/4] xfs: Switch atomic write size check in xfs_file_write_iter() John Garry
2024-12-04 15:43 ` [PATCH 3/4] xfs: Add RT atomic write unit max to xfs_mount John Garry
2024-12-04 15:43 ` [PATCH 4/4] xfs: Update xfs_get_atomic_write_attr() for large atomic writes 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=20250117182945.GH1611770@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=dchinner@redhat.com \
    --cc=hch@lst.de \
    --cc=john.g.garry@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ritesh.list@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.