Thread (19 messages) 19 messages, 5 authors, 2021-06-10

Re: [PATCH v2 2/3] btrfs: zoned: fix compressed writes

From: David Sterba <hidden>
Date: 2021-05-24 13:33:36

On Mon, May 24, 2021 at 09:04:40PM +0800, Qu Wenruo wrote:
quoted
This is the interesting part, it means we are just one sector beyond the
stripe boundary.
Definitely a sign of changed bio submission timing.

Just like the code:

+        if (pg_index == 0 && use_append)
+            len = bio_add_zone_append_page(bio, page, PAGE_SIZE, 0);
+        else
+            len = bio_add_page(bio, page, PAGE_SIZE, 0);
+
          page->mapping = NULL;
-        if (submit || bio_add_page(bio, page, PAGE_SIZE, 0) <
-            PAGE_SIZE) {
+        if (submit || len < PAGE_SIZE) {

The code has changed the timing of bio_add_page().

Previously, if we have submit == true, we won't even try to call
bio_add_page().

But now, we will add the page even we're already at the stripe boundary,
thus it causes the extra sector being added to bio, and crosses stripe
boundary.

This part is already super tricky, thus I refactored
submit_extent_page() to do a better job at stripe boundary calculation.
BTW, I can also reproduce the problem in btrfs/027 using the latest
misc-next branch.

Thus to workaround the problem, I'm using the following diff, feel free
to fold in to the offending patch.
The patch is now in master so we'll need a proper fix.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help