diff mbox series

[01/12] btrfs: remove the force_bio_submit to submit_extent_page

Message ID 20230216163437.2370948-2-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/12] btrfs: remove the force_bio_submit to submit_extent_page | expand

Commit Message

Christoph Hellwig Feb. 16, 2023, 4:34 p.m. UTC
If force_bio_submit, submit_extent_page simply calls submit_one_bio as
the first thing.  This can just be removed to the two callers that set
force_bio_submit to true.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/extent_io.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

Comments

Johannes Thumshirn Feb. 20, 2023, 9:43 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Qu Wenruo Feb. 21, 2023, 11:15 a.m. UTC | #2
On 2023/2/17 00:34, Christoph Hellwig wrote:
> If force_bio_submit, submit_extent_page simply calls submit_one_bio as
> the first thing.  This can just be removed to the two callers that set
> force_bio_submit to true.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

One less argument is always good.

Just need to get the 2nd patch folded into this one.

Otherwise looks good to me.

Thanks,
Qu
> ---
>   fs/btrfs/extent_io.c | 23 ++++++++++-------------
>   1 file changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index c25fa74d7615f7..b53486ed8804af 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -1027,8 +1027,7 @@ static int submit_extent_page(blk_opf_t opf,
>   			      struct btrfs_bio_ctrl *bio_ctrl,
>   			      u64 disk_bytenr, struct page *page,
>   			      size_t size, unsigned long pg_offset,
> -			      enum btrfs_compression_type compress_type,
> -			      bool force_bio_submit)
> +			      enum btrfs_compression_type compress_type)
>   {
>   	struct btrfs_inode *inode = BTRFS_I(page->mapping->host);
>   	unsigned int cur = pg_offset;
> @@ -1040,9 +1039,6 @@ static int submit_extent_page(blk_opf_t opf,
>   
>   	ASSERT(bio_ctrl->end_io_func);
>   
> -	if (force_bio_submit)
> -		submit_one_bio(bio_ctrl);
> -
>   	while (cur < pg_offset + size) {
>   		u32 offset = cur - pg_offset;
>   		int added;
> @@ -1331,10 +1327,11 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
>   			continue;
>   		}
>   
> +		if (force_bio_submit)
> +			submit_one_bio(bio_ctrl);
>   		ret = submit_extent_page(REQ_OP_READ | read_flags, NULL,
>   					 bio_ctrl, disk_bytenr, page, iosize,
> -					 pg_offset, this_bio_flag,
> -					 force_bio_submit);
> +					 pg_offset, this_bio_flag);
>   		if (ret) {
>   			/*
>   			 * We have to unlock the remaining range, or the page
> @@ -1645,8 +1642,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
>   		ret = submit_extent_page(op | write_flags, wbc,
>   					 bio_ctrl, disk_bytenr,
>   					 page, iosize,
> -					 cur - page_offset(page),
> -					 0, false);
> +					 cur - page_offset(page), 0);
>   		if (ret) {
>   			has_error = true;
>   			if (!saved_ret)
> @@ -2139,7 +2135,7 @@ static int write_one_subpage_eb(struct extent_buffer *eb,
>   
>   	ret = submit_extent_page(REQ_OP_WRITE | write_flags, wbc,
>   			bio_ctrl, eb->start, page, eb->len,
> -			eb->start - page_offset(page), 0, false);
> +			eb->start - page_offset(page), 0);
>   	if (ret) {
>   		btrfs_subpage_clear_writeback(fs_info, page, eb->start, eb->len);
>   		set_btree_ioerr(page, eb);
> @@ -2180,7 +2176,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
>   		set_page_writeback(p);
>   		ret = submit_extent_page(REQ_OP_WRITE | write_flags, wbc,
>   					 bio_ctrl, disk_bytenr, p,
> -					 PAGE_SIZE, 0, 0, false);
> +					 PAGE_SIZE, 0, 0);
>   		if (ret) {
>   			set_btree_ioerr(p, eb);
>   			if (PageWriteback(p))
> @@ -4446,9 +4442,10 @@ static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait,
>   	btrfs_subpage_clear_error(fs_info, page, eb->start, eb->len);
>   
>   	btrfs_subpage_start_reader(fs_info, page, eb->start, eb->len);
> +	submit_one_bio(&bio_ctrl);
>   	ret = submit_extent_page(REQ_OP_READ, NULL, &bio_ctrl,
>   				 eb->start, page, eb->len,
> -				 eb->start - page_offset(page), 0, true);
> +				 eb->start - page_offset(page), 0);
>   	if (ret) {
>   		/*
>   		 * In the endio function, if we hit something wrong we will
> @@ -4558,7 +4555,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
>   			ClearPageError(page);
>   			err = submit_extent_page(REQ_OP_READ, NULL,
>   					 &bio_ctrl, page_offset(page), page,
> -					 PAGE_SIZE, 0, 0, false);
> +					 PAGE_SIZE, 0, 0);
>   			if (err) {
>   				/*
>   				 * We failed to submit the bio so it's the
diff mbox series

Patch

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index c25fa74d7615f7..b53486ed8804af 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1027,8 +1027,7 @@  static int submit_extent_page(blk_opf_t opf,
 			      struct btrfs_bio_ctrl *bio_ctrl,
 			      u64 disk_bytenr, struct page *page,
 			      size_t size, unsigned long pg_offset,
-			      enum btrfs_compression_type compress_type,
-			      bool force_bio_submit)
+			      enum btrfs_compression_type compress_type)
 {
 	struct btrfs_inode *inode = BTRFS_I(page->mapping->host);
 	unsigned int cur = pg_offset;
@@ -1040,9 +1039,6 @@  static int submit_extent_page(blk_opf_t opf,
 
 	ASSERT(bio_ctrl->end_io_func);
 
-	if (force_bio_submit)
-		submit_one_bio(bio_ctrl);
-
 	while (cur < pg_offset + size) {
 		u32 offset = cur - pg_offset;
 		int added;
@@ -1331,10 +1327,11 @@  static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
 			continue;
 		}
 
+		if (force_bio_submit)
+			submit_one_bio(bio_ctrl);
 		ret = submit_extent_page(REQ_OP_READ | read_flags, NULL,
 					 bio_ctrl, disk_bytenr, page, iosize,
-					 pg_offset, this_bio_flag,
-					 force_bio_submit);
+					 pg_offset, this_bio_flag);
 		if (ret) {
 			/*
 			 * We have to unlock the remaining range, or the page
@@ -1645,8 +1642,7 @@  static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
 		ret = submit_extent_page(op | write_flags, wbc,
 					 bio_ctrl, disk_bytenr,
 					 page, iosize,
-					 cur - page_offset(page),
-					 0, false);
+					 cur - page_offset(page), 0);
 		if (ret) {
 			has_error = true;
 			if (!saved_ret)
@@ -2139,7 +2135,7 @@  static int write_one_subpage_eb(struct extent_buffer *eb,
 
 	ret = submit_extent_page(REQ_OP_WRITE | write_flags, wbc,
 			bio_ctrl, eb->start, page, eb->len,
-			eb->start - page_offset(page), 0, false);
+			eb->start - page_offset(page), 0);
 	if (ret) {
 		btrfs_subpage_clear_writeback(fs_info, page, eb->start, eb->len);
 		set_btree_ioerr(page, eb);
@@ -2180,7 +2176,7 @@  static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
 		set_page_writeback(p);
 		ret = submit_extent_page(REQ_OP_WRITE | write_flags, wbc,
 					 bio_ctrl, disk_bytenr, p,
-					 PAGE_SIZE, 0, 0, false);
+					 PAGE_SIZE, 0, 0);
 		if (ret) {
 			set_btree_ioerr(p, eb);
 			if (PageWriteback(p))
@@ -4446,9 +4442,10 @@  static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait,
 	btrfs_subpage_clear_error(fs_info, page, eb->start, eb->len);
 
 	btrfs_subpage_start_reader(fs_info, page, eb->start, eb->len);
+	submit_one_bio(&bio_ctrl);
 	ret = submit_extent_page(REQ_OP_READ, NULL, &bio_ctrl,
 				 eb->start, page, eb->len,
-				 eb->start - page_offset(page), 0, true);
+				 eb->start - page_offset(page), 0);
 	if (ret) {
 		/*
 		 * In the endio function, if we hit something wrong we will
@@ -4558,7 +4555,7 @@  int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
 			ClearPageError(page);
 			err = submit_extent_page(REQ_OP_READ, NULL,
 					 &bio_ctrl, page_offset(page), page,
-					 PAGE_SIZE, 0, 0, false);
+					 PAGE_SIZE, 0, 0);
 			if (err) {
 				/*
 				 * We failed to submit the bio so it's the