Thread (18 messages) 18 messages, 4 authors, 2021-06-16

Re: [PATCH v3 8/9] btrfs: make btrfs_submit_compressed_write() to determine stripe boundary at bio allocation time

From: David Sterba <hidden>
Date: 2021-06-16 14:15:21

On Tue, Jun 15, 2021 at 08:18:35PM +0800, Qu Wenruo wrote:
-		page->mapping = NULL;
-		if (submit || len < PAGE_SIZE) {
+		if (use_append)
+			added = bio_add_zone_append_page(bio, page, real_size,
+					offset_in_page(offset));
+		else
+			added = bio_add_page(bio, page, real_size,
+					offset_in_page(offset));
+		/* bio_add_zone_append_page() may fail */
+		ASSERT(added == 0 || added == real_size);
+		if (added == 0)
+			submit = true;
What's the point of the assert that also gets checked by a regular 'if'?
Either 'added == 0' is completely invalid (ie programmer error) or it's
an condition that must be handled anyway, either as an error as a
strange but valid case.
+
+		cur_disk_bytenr += added;
+		if (cur_disk_bytenr == next_stripe_start)
+			submit = true;
+
+		if (submit) {
 			if (!skip_sum) {
 				ret = btrfs_csum_one_bio(inode, bio, start, 1);
 				if (ret)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help