All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23][v4] Change data reservations to use the ticketing infra
@ 2020-07-21 14:22 Josef Bacik
  2020-07-21 14:22 ` [PATCH 01/23] btrfs: change nr to u64 in btrfs_start_delalloc_roots Josef Bacik
                   ` (24 more replies)
  0 siblings, 25 replies; 41+ messages in thread
From: Josef Bacik @ 2020-07-21 14:22 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

v3->v4:
- Rebased onto a recent misc-next, slight fixup because of commenting around the
  flush states.

v2->v3:
- Rebased onto a recent misc-next

v1->v2:
- Adjusted a comment in may_commit_transaction.
- Fixed one of the intermediate patches to properly update ->reclaim_size.

We've had two different things in place to reserve data and metadata space,
because generally speaking data is much simpler.  However the data reservations
still suffered from the same issues that plagued metadata reservations, you
could get multiple tasks racing in to get reservations.  This causes problems
with cases like write/delete loops where we should be able to fill up the fs,
delete everything, and go again.  You would sometimes race with a flusher that's
trying to unpin the free space, take it's reservations, and then it would fail.

Fix this by moving the data reservations under the metadata ticketing
infrastructure.  This gets rid of that problem, and simplifies our enospc code
more by consolidating it into a single path.  Thanks,

Josef


^ permalink raw reply	[flat|nested] 41+ messages in thread
* [PATCH 00/23][v3] Change data reservations to use the ticketing infra
@ 2020-07-08 13:59 Josef Bacik
  2020-07-08 14:00 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
  0 siblings, 1 reply; 41+ messages in thread
From: Josef Bacik @ 2020-07-08 13:59 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

v2->v3:
- Rebased onto a recent misc-next

v1->v2:
- Adjusted a comment in may_commit_transaction.
- Fixed one of the intermediate patches to properly update ->reclaim_size.

We've had two different things in place to reserve data and metadata space,
because generally speaking data is much simpler.  However the data reservations
still suffered from the same issues that plagued metadata reservations, you
could get multiple tasks racing in to get reservations.  This causes problems
with cases like write/delete loops where we should be able to fill up the fs,
delete everything, and go again.  You would sometimes race with a flusher that's
trying to unpin the free space, take it's reservations, and then it would fail.

Fix this by moving the data reservations under the metadata ticketing
infrastructure.  This gets rid of that problem, and simplifies our enospc code
more by consolidating it into a single path.  Thanks,

Josef



^ permalink raw reply	[flat|nested] 41+ messages in thread
* [PATCH 00/23][v2] Change data reservations to use the ticketing infra
@ 2020-07-07 15:42 Josef Bacik
  2020-07-07 15:42 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
  0 siblings, 1 reply; 41+ messages in thread
From: Josef Bacik @ 2020-07-07 15:42 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

v1->v2:
- Adjusted a comment in may_commit_transaction.
- Fixed one of the intermediate patches to properly update ->reclaim_size.

We've had two different things in place to reserve data and metadata space,
because generally speaking data is much simpler.  However the data reservations
still suffered from the same issues that plagued metadata reservations, you
could get multiple tasks racing in to get reservations.  This causes problems
with cases like write/delete loops where we should be able to fill up the fs,
delete everything, and go again.  You would sometimes race with a flusher that's
trying to unpin the free space, take it's reservations, and then it would fail.

Fix this by moving the data reservations under the metadata ticketing
infrastructure.  This gets rid of that problem, and simplifies our enospc code
more by consolidating it into a single path.  Thanks,

Josef



^ permalink raw reply	[flat|nested] 41+ messages in thread
* [PATCH 00/23] Change data reservations to use the ticketing infra
@ 2020-06-30 13:58 Josef Bacik
  2020-06-30 13:59 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
  0 siblings, 1 reply; 41+ messages in thread
From: Josef Bacik @ 2020-06-30 13:58 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

We've had two different things in place to reserve data and metadata space,
because generally speaking data is much simpler.  However the data reservations
still suffered from the same issues that plagued metadata reservations, you
could get multiple tasks racing in to get reservations.  This causes problems
with cases like write/delete loops where we should be able to fill up the fs,
delete everything, and go again.  You would sometimes race with a flusher that's
trying to unpin the free space, take it's reservations, and then it would fail.

Fix this by moving the data reservations under the metadata ticketing
infrastructure.  This gets rid of that problem, and simplifies our enospc code
more by consolidating it into a single path.  Thanks,

Josef


^ permalink raw reply	[flat|nested] 41+ messages in thread
* [PATCH 0/23][v4] Convert data reservations to the ticketing infrastructure
@ 2020-02-04 16:19 Josef Bacik
  2020-02-04 16:19 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
  0 siblings, 1 reply; 41+ messages in thread
From: Josef Bacik @ 2020-02-04 16:19 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

v3->v4:
- merged the patch that stopped forcing commit for data with the patch that
  removed the bytes_needed parameter to may_commit_transaction.
- fixed the wording in the comment patch as per Nikolay.
- Added the reviewed-by's and tested-by's to everything

v2->v3:
- added a comment patch for the flushing states for data.
- I forgot to add cancel_work_sync() for the new async data flusher thread.
- Cleaned up a few of Nikolay's nits.

v1->v2:
- dropped the RFC
- realized that I mis-translated the transaction commit logic from the old way
  to the new way, so I've reworked a bunch of patches to clearly pull that
  behavior into the generic flushing code.  I've then cleaned it up later to
  make it easy to bisect down to behavior changes.
- Cleaned up the priority flushing, there's no need for an explicit state array.
- Removed the CHUNK_FORCE_ALLOC from the normal flushing as well, simply keep
  the logic of allocating chunks until we've made our reservation or we are
  full, then fall back on the normal flushing mechanism.

-------------- Original email --------------
Nikolay reported a problem where we'd occasionally fail generic/371.  This test
has two tasks running in a loop, one that fallocate and rm's, and one that
pwrite's and rm's.  There is enough space for both of these files to exist at
one time, but sometimes the pwrite would fail.

It would fail because we do not serialize data reseravtions.  If one task is
stuck doing the reclaim work, and another task comes in and steals it's
reservation enough times, we'll give up and return ENOSPC.  We validated this by
adding a printk to the data reservation path to tell us that it was succeeding
at making a reservation while another task was flushing.

To solve this problem I've converted data reservations over to the ticketing
system that metadata uses.  There are some cleanups and some fixes that have to
come before we could do that.  The following are simply cleanups

  [PATCH 01/20] btrfs: change nr to u64 in btrfs_start_delalloc_roots
  [PATCH 02/20] btrfs: remove orig from shrink_delalloc
  [PATCH 03/20] btrfs: handle U64_MAX for shrink_delalloc

The following are fixes that are needed to handle data space infos properly.

  [PATCH 04/20] btrfs: make shrink_delalloc take space_info as an arg
  [PATCH 05/20] btrfs: make ALLOC_CHUNK use the space info flags
  [PATCH 06/20] btrfs: call btrfs_try_granting_tickets when freeing
  [PATCH 07/20] btrfs: call btrfs_try_granting_tickets when unpinning
  [PATCH 08/20] btrfs: call btrfs_try_granting_tickets when reserving
  [PATCH 09/20] btrfs: use the btrfs_space_info_free_bytes_may_use

I then converted the data reservation path over to the ticketing infrastructure,
but I did it in a way that mirrored exactly what we currently have.  The idea is
that I want to be able to bisect regressions that happen from behavior change,
and doing that would be hard if I just had a single patch doing the whole
conversion at once.  So the following patches are only moving code around
logically, but preserve the same behavior as before

  [PATCH 10/20] btrfs: add flushing states for handling data
  [PATCH 11/20] btrfs: add btrfs_reserve_data_bytes and use it
  [PATCH 12/20] btrfs: use ticketing for data space reservations

And then the following patches were changing the behavior of how we flush space
for data reservations.

  [PATCH 13/20] btrfs: run delayed iputs before committing the
  [PATCH 14/20] btrfs: flush delayed refs when trying to reserve data
  [PATCH 15/20] btrfs: serialize data reservations if we are flushing
  [PATCH 16/20] btrfs: rework chunk allocate for data reservations
  [PATCH 17/20] btrfs: drop the commit_cycles stuff for data

And then a cleanup now that the data reservation code is the same as the
metadata reservation code.

  [PATCH 18/20] btrfs: use the same helper for data and metadata

Finally a patch to change the flushing from direct to asynchronous, mirroring
what we do for metadata for better latency.

  [PATCH 19/20] btrfs: do async reclaim for data reservations

And then a final cleanup now that we're where we want to be with the data
reservation path.

  [PATCH 20/20] btrfs: kill the priority_reclaim_space helper

I've marked this as an RFC because I've only tested this with generic/371.  I'm
starting my overnight runs of xfstests now and will likely find regressions, but
I'd like to get review started so this can get merged ASAP.  Thanks,

Josef


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

end of thread, other threads:[~2020-08-17 10:43 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 14:22 [PATCH 00/23][v4] Change data reservations to use the ticketing infra Josef Bacik
2020-07-21 14:22 ` [PATCH 01/23] btrfs: change nr to u64 in btrfs_start_delalloc_roots Josef Bacik
2020-07-21 14:22 ` [PATCH 02/23] btrfs: remove orig from shrink_delalloc Josef Bacik
2020-07-21 14:22 ` [PATCH 03/23] btrfs: handle U64_MAX for shrink_delalloc Josef Bacik
2020-07-21 14:22 ` [PATCH 04/23] btrfs: make shrink_delalloc take space_info as an arg Josef Bacik
2020-07-21 14:22 ` [PATCH 05/23] btrfs: make ALLOC_CHUNK use the space info flags Josef Bacik
2020-07-21 14:22 ` [PATCH 06/23] btrfs: call btrfs_try_granting_tickets when freeing reserved bytes Josef Bacik
2020-07-21 14:22 ` [PATCH 07/23] btrfs: call btrfs_try_granting_tickets when unpinning anything Josef Bacik
2020-07-21 14:22 ` [PATCH 08/23] btrfs: call btrfs_try_granting_tickets when reserving space Josef Bacik
2020-07-21 14:22 ` [PATCH 09/23] btrfs: use the btrfs_space_info_free_bytes_may_use helper for delalloc Josef Bacik
2020-07-21 14:22 ` [PATCH 10/23] btrfs: use btrfs_start_delalloc_roots in shrink_delalloc Josef Bacik
2020-07-21 14:22 ` [PATCH 11/23] btrfs: check tickets after waiting on ordered extents Josef Bacik
2020-07-21 14:22 ` [PATCH 12/23] btrfs: add flushing states for handling data reservations Josef Bacik
2020-08-13 16:27   ` David Sterba
2020-07-21 14:22 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
2020-08-13 16:35   ` David Sterba
2020-07-21 14:22 ` [PATCH 14/23] btrfs: add btrfs_reserve_data_bytes and use it Josef Bacik
2020-07-21 14:22 ` [PATCH 15/23] btrfs: use ticketing for data space reservations Josef Bacik
2020-08-13 16:50   ` David Sterba
2020-08-13 16:51   ` David Sterba
2020-08-13 17:12     ` David Sterba
2020-07-21 14:22 ` [PATCH 16/23] btrfs: serialize data reservations if we are flushing Josef Bacik
2020-07-21 14:22 ` [PATCH 17/23] btrfs: use the same helper for data and metadata reservations Josef Bacik
2020-07-21 14:22 ` [PATCH 18/23] btrfs: drop the commit_cycles stuff for data reservations Josef Bacik
2020-07-21 14:22 ` [PATCH 19/23] btrfs: don't force commit if we are data Josef Bacik
2020-07-21 14:22 ` [PATCH 20/23] btrfs: run delayed iputs before committing the transaction for data Josef Bacik
2020-07-21 14:22 ` [PATCH 21/23] btrfs: flush delayed refs when trying to reserve data space Josef Bacik
2020-07-21 14:22 ` [PATCH 22/23] btrfs: do async reclaim for data reservations Josef Bacik
2020-07-21 14:22 ` [PATCH 23/23] btrfs: add a comment explaining the data flush steps Josef Bacik
2020-07-22  8:35 ` [PATCH 00/23][v4] Change data reservations to use the ticketing infra Nikolay Borisov
2020-08-13 15:10   ` David Sterba
2020-08-13 15:14 ` David Sterba
2020-08-17 10:42   ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2020-07-08 13:59 [PATCH 00/23][v3] " Josef Bacik
2020-07-08 14:00 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
2020-07-07 15:42 [PATCH 00/23][v2] Change data reservations to use the ticketing infra Josef Bacik
2020-07-07 15:42 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
2020-06-30 13:58 [PATCH 00/23] Change data reservations to use the ticketing infra Josef Bacik
2020-06-30 13:59 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
2020-07-07 14:39   ` Nikolay Borisov
2020-07-07 14:54     ` Josef Bacik
2020-07-07 15:01     ` Josef Bacik
2020-02-04 16:19 [PATCH 0/23][v4] Convert data reservations to the ticketing infrastructure Josef Bacik
2020-02-04 16:19 ` [PATCH 13/23] btrfs: add the data transaction commit logic into may_commit_transaction Josef Bacik
2020-02-04 16:56   ` Johannes Thumshirn

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.