<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/btrfs/ordered-data.c, branch linux-4.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-02-28T15:38:58Z</updated>
<entry>
<title>Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents</title>
<updated>2020-02-28T15:38:58Z</updated>
<author>
<name>Filipe Manana</name>
</author>
<published>2020-02-13T12:29:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cd26d53a27d604bc25636abf90e6fef52604c9fc'/>
<id>urn:sha1:cd26d53a27d604bc25636abf90e6fef52604c9fc</id>
<content type='text'>
commit e75fd33b3f744f644061a4f9662bd63f5434f806 upstream.

In btrfs_wait_ordered_range() once we find an ordered extent that has
finished with an error we exit the loop and don't wait for any other
ordered extents that might be still in progress.

All the users of btrfs_wait_ordered_range() expect that there are no more
ordered extents in progress after that function returns. So past fixes
such like the ones from the two following commits:

  ff612ba7849964 ("btrfs: fix panic during relocation after ENOSPC before
                   writeback happens")

  28aeeac1dd3080 ("Btrfs: fix panic when starting bg cache writeout after
                   IO error")

don't work when there are multiple ordered extents in the range.

Fix that by making btrfs_wait_ordered_range() wait for all ordered extents
even after it finds one that had an error.

Link: https://github.com/kdave/btrfs-progs/issues/228#issuecomment-569777554
CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Qu Wenruo &lt;wqu@suse.com&gt;
Reviewed-by: Josef Bacik &lt;josef@toxicpanda.com&gt;
Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>btrfs: prune unused includes</title>
<updated>2018-08-06T11:12:43Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2018-06-29T08:56:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d7f663fa3ff906247a979c1115bc92cbabfb19ba'/>
<id>urn:sha1:d7f663fa3ff906247a979c1115bc92cbabfb19ba</id>
<content type='text'>
Remove includes if none of the interfaces and exports is used in the
given source file.

Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: remove remaing full_sync logic from btrfs_sync_file</title>
<updated>2018-08-06T11:12:31Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2018-07-19T13:27:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ca5788aba3e8153da38cf99ca3ce2294f032fb51'/>
<id>urn:sha1:ca5788aba3e8153da38cf99ca3ce2294f032fb51</id>
<content type='text'>
The logic to check if the inode is already in the log can now be
simplified since we always wait for the ordered extents to complete
before deciding whether the inode needs to be logged. The big comment
about it can go away too.

CC: Filipe Manana &lt;fdmanana@suse.com&gt;
Suggested-by: Filipe Manana &lt;fdmanana@suse.com&gt;
[ code and changelog copied from mail discussion ]
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: remove the logged extents infrastructure</title>
<updated>2018-08-06T11:12:30Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2018-05-23T15:58:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5636cf7d6dc86f47fd66757dae088e35014da464'/>
<id>urn:sha1:5636cf7d6dc86f47fd66757dae088e35014da464</id>
<content type='text'>
This is no longer used anywhere, remove all of it.

Signed-off-by: Josef Bacik &lt;jbacik@fb.com&gt;
Reviewed-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: replace waitqueue_actvie with cond_wake_up</title>
<updated>2018-05-28T16:23:09Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2018-02-26T15:15:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=093258e6ebaf178bb25da514f0d1f744968cc900'/>
<id>urn:sha1:093258e6ebaf178bb25da514f0d1f744968cc900</id>
<content type='text'>
Use the wrappers and reduce the amount of low-level details about the
waitqueue management.

Reviewed-by: Nikolay Borisov &lt;nborisov@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: replace GPL boilerplate by SPDX -- sources</title>
<updated>2018-04-12T14:29:51Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2018-04-03T17:23:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c1d7c514f745628eb096c5cbb10737855879ae25'/>
<id>urn:sha1:c1d7c514f745628eb096c5cbb10737855879ae25</id>
<content type='text'>
Remove GPL boilerplate text (long, short, one-line) and keep the rest,
ie. personal, company or original source copyright statements. Add the
SPDX header.

Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: qgroup: Use separate meta reservation type for delalloc</title>
<updated>2018-03-30T23:41:14Z</updated>
<author>
<name>Qu Wenruo</name>
</author>
<published>2017-12-12T07:34:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=43b18595d6603cb4197fb9b063915cd7802141a6'/>
<id>urn:sha1:43b18595d6603cb4197fb9b063915cd7802141a6</id>
<content type='text'>
Before this patch, btrfs qgroup is mixing per-transcation meta rsv with
preallocated meta rsv, making it quite easy to underflow qgroup meta
reservation.

Since we have the new qgroup meta rsv types, apply it to delalloc
reservation.

Now for delalloc, most of its reserved space will use META_PREALLOC qgroup
rsv type.

And for callers reducing outstanding extent like btrfs_finish_ordered_io(),
they will convert corresponding META_PREALLOC reservation to
META_PERTRANS.

This is mainly due to the fact that current qgroup numbers will only be
updated in btrfs_commit_transaction(), that's to say if we don't keep
such placeholder reservation, we can exceed qgroup limitation.

And for callers freeing outstanding extent in error handler, we will
just free META_PREALLOC bytes.

This behavior makes callers of btrfs_qgroup_release_meta() or
btrfs_qgroup_convert_meta() to be aware of which type they are.
So in this patch, btrfs_delalloc_release_metadata() and its callers get
an extra parameter to info qgroup to do correct meta convert/release.

The good news is, even we use the wrong type (convert or free), it won't
cause obvious bug, as prealloc type is always in good shape, and the
type only affects how per-trans meta is increased or not.

So the worst case will be at most metadata limitation can be sometimes
exceeded (no convert at all) or metadata limitation is reached too soon
(no free at all).

Signed-off-by: Qu Wenruo &lt;wqu@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: add more __cold annotations</title>
<updated>2018-03-26T13:09:39Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2018-02-19T16:24:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e67c718b5b9a306bde7e966be7b4ca48fa063d73'/>
<id>urn:sha1:e67c718b5b9a306bde7e966be7b4ca48fa063d73</id>
<content type='text'>
The __cold functions are placed to a special section, as they're
expected to be called rarely. This could help i-cache prefetches or help
compiler to decide which branches are more/less likely to be taken
without any other annotations needed.

Though we can't add more __exit annotations, it's still possible to add
__cold (that's also added with __exit). That way the following function
categories are tagged:

- printf wrappers, error messages
- exit helpers

Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: rework outstanding_extents</title>
<updated>2017-11-01T19:45:35Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2017-10-19T18:15:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8b62f87bad9cf06e536799bf8cb942ab95f6bfa4'/>
<id>urn:sha1:8b62f87bad9cf06e536799bf8cb942ab95f6bfa4</id>
<content type='text'>
Right now we do a lot of weird hoops around outstanding_extents in order
to keep the extent count consistent.  This is because we logically
transfer the outstanding_extent count from the initial reservation
through the set_delalloc_bits.  This makes it pretty difficult to get a
handle on how and when we need to mess with outstanding_extents.

Fix this by revamping the rules of how we deal with outstanding_extents.
Now instead everybody that is holding on to a delalloc extent is
required to increase the outstanding extents count for itself.  This
means we'll have something like this

btrfs_delalloc_reserve_metadata	- outstanding_extents = 1
 btrfs_set_extent_delalloc	- outstanding_extents = 2
btrfs_release_delalloc_extents	- outstanding_extents = 1

for an initial file write.  Now take the append write where we extend an
existing delalloc range but still under the maximum extent size

btrfs_delalloc_reserve_metadata - outstanding_extents = 2
  btrfs_set_extent_delalloc
    btrfs_set_bit_hook		- outstanding_extents = 3
    btrfs_merge_extent_hook	- outstanding_extents = 2
btrfs_delalloc_release_extents	- outstanding_extnets = 1

In order to make the ordered extent transition we of course must now
make ordered extents carry their own outstanding_extent reservation, so
for cow_file_range we end up with

btrfs_add_ordered_extent	- outstanding_extents = 2
clear_extent_bit		- outstanding_extents = 1
btrfs_remove_ordered_extent	- outstanding_extents = 0

This makes all manipulations of outstanding_extents much more explicit.
Every successful call to btrfs_delalloc_reserve_metadata _must_ now be
combined with btrfs_release_delalloc_extents, even in the error case, as
that is the only function that actually modifies the
outstanding_extents counter.

The drawback to this is now we are much more likely to have transient
cases where outstanding_extents is much larger than it actually should
be.  This could happen before as we manipulated the delalloc bits, but
now it happens basically at every write.  This may put more pressure on
the ENOSPC flushing code, but I think making this code simpler is worth
the cost.  I have another change coming to mitigate this side-effect
somewhat.

I also added trace points for the counter manipulation.  These were used
by a bpf script I wrote to help track down leak issues.

Signed-off-by: Josef Bacik &lt;jbacik@fb.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: fix integer overflow in calc_reclaim_items_nr</title>
<updated>2017-06-29T18:17:02Z</updated>
<author>
<name>Chris Mason</name>
</author>
<published>2017-06-23T16:48:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6374e57ad8091b9c2db2eecc536c7f0166ce099e'/>
<id>urn:sha1:6374e57ad8091b9c2db2eecc536c7f0166ce099e</id>
<content type='text'>
Dave Jones hit a WARN_ON(nr &lt; 0) in btrfs_wait_ordered_roots() with
v4.12-rc6.  This was because commit 70e7af244 made it possible for
calc_reclaim_items_nr() to return a negative number.  It's not really a
bug in that commit, it just didn't go far enough down the stack to find
all the possible 64-&gt;32 bit overflows.

This switches calc_reclaim_items_nr() to return a u64 and changes everyone
that uses the results of that math to u64 as well.

Reported-by: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Fixes: 70e7af2 ("Btrfs: fix delalloc accounting leak caused by u32 overflow")
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
</feed>
